LaiTool_PRO/src/define/db/model/taskList.ts

45 lines
1.5 KiB
TypeScript
Raw Normal View History

2025-08-19 14:33:59 +08:00
import Realm, { ObjectSchema } from 'realm'
import { BookBackTaskStatus, BookBackTaskType, TaskExecuteType } from '@/define/enum/bookEnum'
export class TaskListModel extends Realm.Object<TaskListModel> {
id!: string
bookId!: string
bookTaskId!: string
bookTaskDetailId!: string
name!: string // 任务名称,小说名+批次名+分镜名
type!: BookBackTaskType
status!: BookBackTaskStatus
errorMessage!: string | null
executeType!: TaskExecuteType // 任务执行类型,手动还是自动
createTime!: Date
updateTime!: Date
startTime!: number
endTime!: number
messageName?: string
taskId?: string // 任务ID可能是视频生成任务的ID
taskMessage?: string // 任务消息,可能是视频生成任务的消息
2025-08-19 14:33:59 +08:00
static schema: ObjectSchema = {
name: 'TaskList',
properties: {
id: 'string',
bookId: { type: 'string', indexed: true },
bookTaskId: { type: 'string', indexed: true },
bookTaskDetailId: { type: 'string', indexed: true },
name: 'string',
type: 'string',
status: 'string',
errorMessage: 'string?',
executeType: { type: 'string', default: TaskExecuteType.AUTO },
createTime: 'date',
updateTime: 'date',
startTime: 'int',
endTime: 'int',
messageName: 'string?',
taskId: 'string?', // 任务ID可能是视频生成任务的ID
taskMessage: 'string?' // 任务消息,可能是视频生成任务的消息
2025-08-19 14:33:59 +08:00
},
primaryKey: 'id'
}
}