Improve job status notifications
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
text,
|
||||
uniqueIndex
|
||||
} from 'drizzle-orm/sqlite-core';
|
||||
import type { TaskStageContext } from '@/lib/types';
|
||||
|
||||
type FilingMetrics = {
|
||||
revenue: number | null;
|
||||
@@ -520,6 +521,7 @@ export const taskRun = sqliteTable('task_run', {
|
||||
status: text('status').$type<'queued' | 'running' | 'completed' | 'failed'>().notNull(),
|
||||
stage: text('stage').notNull(),
|
||||
stage_detail: text('stage_detail'),
|
||||
stage_context: text('stage_context', { mode: 'json' }).$type<TaskStageContext | null>(),
|
||||
resource_key: text('resource_key'),
|
||||
notification_read_at: text('notification_read_at'),
|
||||
notification_silenced_at: text('notification_silenced_at'),
|
||||
@@ -535,6 +537,7 @@ export const taskRun = sqliteTable('task_run', {
|
||||
finished_at: text('finished_at')
|
||||
}, (table) => ({
|
||||
taskUserCreatedIndex: index('task_user_created_idx').on(table.user_id, table.created_at),
|
||||
taskUserUpdatedIndex: index('task_user_updated_idx').on(table.user_id, table.updated_at),
|
||||
taskStatusIndex: index('task_status_idx').on(table.status),
|
||||
taskUserResourceStatusIndex: index('task_user_resource_status_idx').on(
|
||||
table.user_id,
|
||||
@@ -552,6 +555,7 @@ export const taskStageEvent = sqliteTable('task_stage_event', {
|
||||
user_id: text('user_id').notNull().references(() => user.id, { onDelete: 'cascade' }),
|
||||
stage: text('stage').notNull(),
|
||||
stage_detail: text('stage_detail'),
|
||||
stage_context: text('stage_context', { mode: 'json' }).$type<TaskStageContext | null>(),
|
||||
status: text('status').$type<'queued' | 'running' | 'completed' | 'failed'>().notNull(),
|
||||
created_at: text('created_at').notNull()
|
||||
}, (table) => ({
|
||||
|
||||
Reference in New Issue
Block a user