2023-12-03 16:20:52 +03:00
|
|
|
import { Result } from "../../../core/helpers/result";
|
|
|
|
import { ActivePipeline } from "../../../core/models/active_pipeline_model";
|
2023-11-14 20:44:06 +03:00
|
|
|
import { pipelineRealTimeService } from "../realtime_presentation";
|
|
|
|
|
|
|
|
export class PipelineStatusUseCase {
|
2023-11-20 00:48:40 +03:00
|
|
|
async call(): Promise<Result<Error, ActivePipeline>> {
|
2023-11-14 20:44:06 +03:00
|
|
|
try {
|
2023-11-28 18:34:41 +03:00
|
|
|
const status = pipelineRealTimeService.status;
|
|
|
|
if (status.projectUUID !== null) {
|
|
|
|
return Result.ok(status);
|
|
|
|
}
|
|
|
|
if (status.projectUUID === null) {
|
|
|
|
return Result.error(new Error("pipelineRealTimeService does not have an active project instance"));
|
|
|
|
}
|
2023-11-14 20:44:06 +03:00
|
|
|
} catch (error) {
|
|
|
|
return Result.error(error as Error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|