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
|
|
|
|
2026-10-09 08:38:19 +00:00
|
|
|
import type { 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;
|
|
|
|
|
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
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|