This commit is contained in:
2025-12-11 13:50:38 +01:00
parent e4c1be628d
commit c7e5de40d6
212 changed files with 2965 additions and 763 deletions

View File

@@ -1,3 +1,5 @@
import type { IValueObject } from '@gridpilot/shared/domain';
export type SessionStateValue =
| 'PENDING'
| 'IN_PROGRESS'
@@ -30,7 +32,11 @@ const VALID_TRANSITIONS: Record<SessionStateValue, SessionStateValue[]> = {
CANCELLED: [],
};
export class SessionState {
export interface SessionStateProps {
value: SessionStateValue;
}
export class SessionState implements IValueObject<SessionStateProps> {
private readonly _value: SessionStateValue;
private constructor(value: SessionStateValue) {
@@ -93,4 +99,12 @@ export class SessionState {
this._value === 'CANCELLED'
);
}
get props(): SessionStateProps {
return { value: this._value };
}
equals(other: IValueObject<SessionStateProps>): boolean {
return this.props.value === other.props.value;
}
}