boostercloud / booster

Booster Framework
https://www.boosterframework.com
Apache License 2.0
416 stars 86 forks source link

Calculated fields #1539

Closed MarcAstr0 closed 2 months ago

MarcAstr0 commented 3 months ago

Description

Due to the changes introduced in version 2.11.0, this PR introduces the @CalculatedField decorator for read model fields, which are calculated using getters using other properties of the read model. e.g.,

@ReadModel({
  authorize: 'all',
})
export class PersonReadModel {
  public constructor(
    readonly id: UUID,
    readonly firstName: string,
    readonly lastName: string
  ) {}

  @CalculatedField(['firstName', 'lastName'])
  public get fullName(): Promise<string> {
    return Promise.resolve(`${this.firstName} ${this.lastName}`)
  }
}

This decorator receives a list of the read model's properties as an input parameter. The calculated field uses these properties to calculate its value. The decorator ensures that these properties are fetched from the database so that the calculated field is calculated correctly, even if the user did not explicitly request these dependencies.

Changes

Checks

MarcAstr0 commented 3 months ago

/integration sha=c9dcfc3c4768ff9098f4d1d766f91e7018c85046

what-the-diff[bot] commented 3 months ago

PR Summary

github-actions[bot] commented 3 months ago

:hourglass: Integration tests are running...

Check their status here πŸ‘ˆ

github-actions[bot] commented 3 months ago

:x: Oh no! Integration tests have failed

github-actions[bot] commented 3 months ago

:x: Oh no! Integration tests have failed

github-actions[bot] commented 3 months ago

:x: Oh no! Integration tests have failed

github-actions[bot] commented 3 months ago

:x: Oh no! Integration tests have failed

github-actions[bot] commented 3 months ago

:x: Oh no! Integration tests have failed

github-actions[bot] commented 3 months ago

:x: Oh no! Integration tests have failed

github-actions[bot] commented 3 months ago

:x: Oh no! Integration tests have failed

MarcAstr0 commented 3 months ago

/integration sha=e815183

github-actions[bot] commented 3 months ago

:hourglass: Integration tests are running...

Check their status here πŸ‘ˆ

github-actions[bot] commented 3 months ago

:x: Oh no! Integration tests have failed

MarcAstr0 commented 3 months ago

/integration sha=7d65cb3

github-actions[bot] commented 3 months ago

:hourglass: Integration tests are running...

Check their status here πŸ‘ˆ

github-actions[bot] commented 3 months ago

:x: Oh no! Integration tests have failed

github-actions[bot] commented 3 months ago

:x: Oh no! Integration tests have failed

github-actions[bot] commented 3 months ago

:x: Oh no! Integration tests have failed

github-actions[bot] commented 3 months ago

:x: Oh no! Integration tests have failed

github-actions[bot] commented 3 months ago

:x: Oh no! Integration tests have failed

github-actions[bot] commented 3 months ago

:x: Oh no! Integration tests have failed

github-actions[bot] commented 3 months ago

:x: Oh no! Integration tests have failed

MarcAstr0 commented 3 months ago

/integration sha=008414c64635315ceda16888eaf39c0d73161b9e

github-actions[bot] commented 3 months ago

:hourglass: Integration tests are running...

Check their status here πŸ‘ˆ

github-actions[bot] commented 3 months ago

:x: Oh no! Integration tests have failed

MarcAstr0 commented 3 months ago

/integration sha=ebf97f1536d507ec8127efa618913017a17875bd

github-actions[bot] commented 3 months ago

:hourglass: Integration tests are running...

Check their status here πŸ‘ˆ

github-actions[bot] commented 3 months ago

:x: Oh no! Integration tests have failed

MarcAstr0 commented 3 months ago

/integration sha=3b899a6bc06d65be4f1f2bf59f3becb67abe995e

github-actions[bot] commented 3 months ago

:hourglass: Integration tests are running...

Check their status here πŸ‘ˆ

github-actions[bot] commented 3 months ago

:x: Oh no! Integration tests have failed

MarcAstr0 commented 3 months ago

/integration sha=3b899a6bc06d65be4f1f2bf59f3becb67abe995e

github-actions[bot] commented 3 months ago

:hourglass: Integration tests are running...

Check their status here πŸ‘ˆ

github-actions[bot] commented 3 months ago

:x: Oh no! Integration tests have failed

MarcAstr0 commented 3 months ago

/integration sha=3b899a6bc06d65be4f1f2bf59f3becb67abe995e

github-actions[bot] commented 3 months ago

:hourglass: Integration tests are running...

Check their status here πŸ‘ˆ

github-actions[bot] commented 3 months ago

:x: Oh no! Integration tests have failed

github-actions[bot] commented 3 months ago

:x: Oh no! Integration tests have failed

github-actions[bot] commented 3 months ago

:x: Oh no! Integration tests have failed

MarcAstr0 commented 3 months ago

/integration sha=3b899a6bc06d65be4f1f2bf59f3becb67abe995e

github-actions[bot] commented 3 months ago

:hourglass: Integration tests are running...

Check their status here πŸ‘ˆ

github-actions[bot] commented 3 months ago

:white_check_mark: Integration tests have finished successfully!

MarcAstr0 commented 3 months ago

/integration sha=85ea3c15ed9f3acf080593bec19df41e4bff93fe

github-actions[bot] commented 3 months ago

:hourglass: Integration tests are running...

Check their status here πŸ‘ˆ

github-actions[bot] commented 3 months ago

:white_check_mark: Integration tests have finished successfully!

MarcAstr0 commented 2 months ago

/integration sha=56633030c1307dc0adf1bc187387e69731cbc387

github-actions[bot] commented 2 months ago

:hourglass: Integration tests are running...

Check their status here πŸ‘ˆ

github-actions[bot] commented 2 months ago

:white_check_mark: Integration tests have finished successfully!

MarcAstr0 commented 2 months ago

/integration sha=2077b2cb598e6b6259ef8e2d1b6756e8cead1f53

github-actions[bot] commented 2 months ago

:hourglass: Integration tests are running...

Check their status here πŸ‘ˆ