import Inject from "@entity-access/entity-access/dist/di/di.js"; import RepairConversationWorkflow from "../../../../../server/workflows/repair/conversations/RepairConversationWorkflow.js"; import Page from "@entity-access/server-pages/dist/Page.js"; import { Prepare } from "@entity-access/server-pages/dist/decorators/Prepare.js"; import { AppWorkflowContext } from "../../../../../server/workflows/AppWorkflowContext.js"; @Prepare.authorize export default class extends Page { @Inject private workflowContext: AppWorkflowContext; async run() { this.sessionUser.ensureIsAdmin(); if(/post/i.test(this.method)) { // start the repair task await RepairConversationWorkflow.getStatus(this.workflowContext); await RepairConversationWorkflow.startAsync(this.workflowContext); } const result = await RepairConversationWorkflow.getStatus(this.workflowContext); return this.json(result); } }