2026-07-31 16:22:09 +08:00

35 lines
670 B
TypeScript

import { ObjectId } from "mongodb";
export type AutomationTaskType =
| "AUTO_ACCEPT"
| "AUTO_OPEN_RX"
| "AUTO_PASS_RX";
export type AutomationTaskStatus =
| "PENDING"
| "RUNNING"
| "SUCCEEDED"
| "CANCELLED"
| "FAILED";
export interface AutomationTask {
_id: ObjectId;
taskKey: string;
type: AutomationTaskType;
corpId: string;
orderId: string;
rxId?: string;
status: AutomationTaskStatus;
dueAt: number;
nextRunAt: number;
expiresAt: number;
attempts: number;
leaseUntil: number;
leaseOwner: string;
lastError: string;
result?: Record<string, unknown>;
createdAt: number;
updatedAt: number;
completedAt?: number;
}