metis-desk/modules/companies/src/api/domain/intervention-revision.entity.ts

27 lines
818 B
TypeScript

import type { UniqueID } from "@repo/rdx-ddd";
import { DomainEntity } from "@repo/rdx-ddd";
import type { InterventionValues } from "./value-objects/intervention-values.vo";
export type InterventionRevisionProps = Readonly<{
values: InterventionValues;
actorId: UniqueID;
recordedAt: string;
}>;
export class InterventionRevision extends DomainEntity<InterventionRevisionProps> {
static create(props: InterventionRevisionProps) {
return new InterventionRevision(Object.freeze({ ...props }));
}
static rehydrate(props: InterventionRevisionProps, id: UniqueID) {
return new InterventionRevision(Object.freeze({ ...props }), id);
}
get values() {
return this.props.values;
}
get actorId() {
return this.props.actorId;
}
get recordedAt() {
return this.props.recordedAt;
}
}