metis-desk/modules/resources/src/api/domain/resource-revision.entity.ts

38 lines
869 B
TypeScript
Raw Normal View History

2026-10-08 14:43:34 +00:00
import type { UniqueID } from "@repo/rdx-ddd";
import { DomainEntity } from "@repo/rdx-ddd";
2026-10-05 11:13:51 +00:00
import type { ResourceSpecification, ResourceValues } from "./value-objects/resource-values.vo";
2026-10-10 10:01:58 +00:00
2026-10-05 11:13:51 +00:00
export type ResourceRevisionProps = Readonly<{
values: ResourceValues;
specification: ResourceSpecification;
2026-10-05 11:13:51 +00:00
actorId: UniqueID;
recordedAt: string;
}>;
2026-10-10 10:01:58 +00:00
2026-10-05 11:13:51 +00:00
export class ResourceRevision extends DomainEntity<ResourceRevisionProps> {
static create(props: ResourceRevisionProps) {
return new ResourceRevision(props);
}
2026-10-10 10:01:58 +00:00
2026-10-05 11:13:51 +00:00
static rehydrate(props: ResourceRevisionProps, id: UniqueID) {
return new ResourceRevision(props, id);
}
2026-10-10 10:01:58 +00:00
get specification() {
return this.props.specification;
}
2026-10-05 11:13:51 +00:00
get values() {
return this.props.values;
}
2026-10-10 10:01:58 +00:00
2026-10-05 11:13:51 +00:00
get actorId() {
return this.props.actorId;
}
2026-10-10 10:01:58 +00:00
2026-10-05 11:13:51 +00:00
get recordedAt() {
return this.props.recordedAt;
}
}