refactor: database types (#19624)

This commit is contained in:
Jason Rasmussen
2025-06-30 13:19:16 -04:00
committed by GitHub
parent 09cbc5d3f4
commit e60bc3c304
99 changed files with 518 additions and 889 deletions

View File

@@ -2,9 +2,10 @@ import { Insertable, Kysely, Updateable } from 'kysely';
import { DateTime } from 'luxon';
import { InjectKysely } from 'nestjs-kysely';
import { columns } from 'src/database';
import { DB, Notifications } from 'src/db';
import { DummyValue, GenerateSql } from 'src/decorators';
import { NotificationSearchDto } from 'src/dtos/notification.dto';
import { DB } from 'src/schema';
import { NotificationTable } from 'src/schema/tables/notification.table';
export class NotificationRepository {
constructor(@InjectKysely() private db: Kysely<DB>) {}
@@ -53,7 +54,7 @@ export class NotificationRepository {
.execute();
}
create(notification: Insertable<Notifications>) {
create(notification: Insertable<NotificationTable>) {
return this.db
.insertInto('notifications')
.values(notification)
@@ -70,7 +71,7 @@ export class NotificationRepository {
.executeTakeFirst();
}
update(id: string, notification: Updateable<Notifications>) {
update(id: string, notification: Updateable<NotificationTable>) {
return this.db
.updateTable('notifications')
.set(notification)
@@ -80,7 +81,7 @@ export class NotificationRepository {
.executeTakeFirstOrThrow();
}
async updateAll(ids: string[], notification: Updateable<Notifications>) {
async updateAll(ids: string[], notification: Updateable<NotificationTable>) {
await this.db.updateTable('notifications').set(notification).where('id', 'in', ids).execute();
}