Parent
Part of #739
Context
Read models currently use class-based metadata:
interface ReadModelMetadata<TReadModel extends ReadModelInterface = ReadModelInterface> {
readonly class: Class<ReadModelInterface>
readonly properties: Array<PropertyMetadata>
readonly authorizer: ReadModelAuthorizer
readonly before: NonNullable<ReadModelFilterHooks<TReadModel>['before']>
}
Projections are stored separately in config:
projections: Record<EntityName, Array<ProjectionMetadata>>
unProjections: Record<EntityName, Array<ProjectionMetadata>>
Proposed Changes
- Create
readModel() DSL function in packages/core/src/dsl/read-model.ts
- Create
projection() DSL function (or integrate with read model)
- Update metadata types to remove class references
- Update read model reader and searcher to use new metadata
- Reimplement decorators as wrappers
- Update GraphQL subscription infrastructure
Design Considerations
- Read models are the query side of CQRS — they need property metadata for GraphQL
- Projections link entities to read models — the DSL needs a clean way to express this
- Read models have authorization and before hooks (similar to commands)
- GraphQL subscriptions use read model classes — needs careful migration
Acceptance Criteria
Parent
Part of #739
Context
Read models currently use class-based metadata:
Projections are stored separately in config:
Proposed Changes
readModel()DSL function inpackages/core/src/dsl/read-model.tsprojection()DSL function (or integrate with read model)Design Considerations
Acceptance Criteria
readModel()andprojection()DSL functions created