Files
Checkmate/server/src/domain/egress/egress-state.service.ts
T

20 lines
761 B
TypeScript
Raw Normal View History

2026-09-14 10:26:09 +01:00
import { IEgressStateRepository } from "@/domain/egress/egress-state.repository.interface.js";
import type { EgressState } from "@/domain/egress/egress.type.js";
export interface IEgressStateService {
getState(): Promise<EgressState>;
}
const SERVICE_NAME = "EgressStateService";
// Read-only view of the instance-global egress state for the API process. Transitions are
// owned by the worker (egress.service.ts); this exists so the controller never touches the repository.
export class EgressStateService implements IEgressStateService {
static SERVICE_NAME = SERVICE_NAME;
constructor(private egressStateRepository: IEgressStateRepository) {}
getState = async (): Promise<EgressState> => {
return this.egressStateRepository.findSingleton();
};
}