forked from pinks/eris
1
0
Fork 0
nyx/db/jobStore.ts

23 lines
717 B
TypeScript
Raw Normal View History

2023-09-10 18:56:17 +00:00
import { GrammyTypes, IKV } from "../deps.ts";
2023-09-12 01:57:44 +00:00
import { PngInfo, SdTxt2ImgInfo } from "../sd.ts";
2023-09-10 18:56:17 +00:00
import { db } from "./db.ts";
export interface JobSchema {
2023-09-12 01:57:44 +00:00
task:
| { type: "txt2img"; params: Partial<PngInfo> }
| { type: "img2img"; params: Partial<PngInfo>; fileId: string };
from: GrammyTypes.User;
chat: GrammyTypes.Chat;
requestMessageId: number;
replyMessageId?: number;
2023-09-10 18:56:17 +00:00
status:
| { type: "waiting" }
| { type: "processing"; progress: number; worker: string; updatedDate: Date }
| { type: "done"; info?: SdTxt2ImgInfo; startDate?: Date; endDate?: Date };
}
export const jobStore = new IKV.Store(db, "job", {
schema: new IKV.Schema<JobSchema>(),
indices: ["status.type"],
});