mirror of
https://github.com/FoxxMD/multi-scrobbler.git
synced 2026-09-03 05:10:00 +03:00
feat: Implement queue context with migration
This commit is contained in:
+1
@@ -0,0 +1 @@
|
||||
ALTER TABLE `play_queue_states` ADD `context` text;
|
||||
+1216
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
import { integer, sqliteTable, text, index, uniqueIndex, customType, type AnySQLiteColumn } from "drizzle-orm/sqlite-core";
|
||||
import { defineRelations } from 'drizzle-orm';
|
||||
import dayjs, { type Dayjs } from "dayjs";
|
||||
import { COMPONENT_TYPE_CLIENT, COMPONENT_TYPE_SOURCE, type ErrorLike, type PlayObject } from "../../../../../core/Atomic.ts";
|
||||
import { COMPONENT_TYPE_CLIENT, COMPONENT_TYPE_SOURCE, type ErrorLike, type PlayObject, type QueueContext } from "../../../../../core/Atomic.ts";
|
||||
import { asPlayCheap } from "../../../../../core/PlayMarshalUtils.ts";
|
||||
import type {ExternalMetadataTerm, PlayTransformPartsConfig, SearchAndReplaceTerm} from "../../../../../core/Transform.ts";
|
||||
import type {JobRangeCount, JobRangeTime} from "../../../infrastructure/Job.ts";
|
||||
@@ -144,6 +144,7 @@ export const queueStates = sqliteTable("play_queue_states", {
|
||||
queueStatus: text({enum: ['queued','completed','failed']}).notNull().default('queued'),
|
||||
retries: integer().notNull().default(0),
|
||||
error: ErrorLikeJson('error'),
|
||||
context: text({mode: 'json'}).$type<QueueContext>(),
|
||||
createdAt: DayjsTimestamp('createdAt').notNull().$defaultFn(() => dayjs()),
|
||||
updatedAt: DayjsTimestamp('updatedAt').notNull().$defaultFn(() => dayjs()).$onUpdate(() => dayjs())
|
||||
}, (table) => [
|
||||
|
||||
@@ -655,6 +655,12 @@ export const QUEUE_STATUS_COMPLETED: QueueStatus = 'completed';
|
||||
export const QUEUE_STATUS_FAILED: QueueStatus = 'failed';
|
||||
export const QUEUE_STATUSES: QueueStatus[] = [QUEUE_STATUS_COMPLETED, QUEUE_STATUS_FAILED, QUEUE_STATUS_QUEUED];
|
||||
|
||||
export interface QueueContext {
|
||||
transform?: boolean
|
||||
dupeCheck?: boolean
|
||||
useCache?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
* @see https://github.com/ts-essentials/ts-essentials/issues/339#issuecomment-4681920369 */
|
||||
export type Replace<Type, Keys extends keyof Type, TReplace> = StrictOmit<Type, Keys> & Record<Keys, TReplace>
|
||||
|
||||
Reference in New Issue
Block a user