diff --git a/src/backend/common/database/drizzle/repositories/QueueRepository.ts b/src/backend/common/database/drizzle/repositories/QueueRepository.ts index 91b8da6f..a6296e52 100644 --- a/src/backend/common/database/drizzle/repositories/QueueRepository.ts +++ b/src/backend/common/database/drizzle/repositories/QueueRepository.ts @@ -40,9 +40,9 @@ export class DrizzleQueueRepository extends DrizzleBaseRepository<'queueStates'> )); } - async create(data: typeof this.table.$inferInsert & {playId?: PlaySelect['id']}): Promise { + async create(data: typeof this.table.$inferInsert & {playId?: PlaySelect['id'], event?: boolean}): Promise { const res = await super.create(data) as QueueStateSelect; - if(data.playId !== undefined) { + if(data.event === true && data.playId !== undefined) { try { await this.db.insert(playEvents).values({...queueStateToPlayEvent(res), playId: data.playId}); } catch (e) { @@ -52,9 +52,9 @@ export class DrizzleQueueRepository extends DrizzleBaseRepository<'queueStates'> return res; } - async updateById(id: number, data: Partial & {playId?: PlaySelect['id']}): Promise { + async updateById(id: number, data: Partial & {playId?: PlaySelect['id'], event?: boolean}): Promise { const res = await super.updateById(id, data) as QueueStateSelect; - if(data.playId !== undefined) { + if(data.event === true && data.playId !== undefined) { try { await this.db.insert(playEvents).values({...queueStateToPlayEvent(res), playId: data.playId}); } catch (e) {