diff --git a/server/src/entities/move.entity.ts b/server/src/entities/move.entity.ts deleted file mode 100644 index 0570d98edc..0000000000 --- a/server/src/entities/move.entity.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { PathType } from 'src/enum'; - -export class MoveEntity { - id!: string; - entityId!: string; - pathType!: PathType; - oldPath!: string; - newPath!: string; -} diff --git a/server/src/repositories/move.repository.ts b/server/src/repositories/move.repository.ts index 706e23cef7..21c52aec65 100644 --- a/server/src/repositories/move.repository.ts +++ b/server/src/repositories/move.repository.ts @@ -3,49 +3,38 @@ import { Insertable, Kysely, sql, Updateable } from 'kysely'; import { InjectKysely } from 'nestjs-kysely'; import { DB, MoveHistory } from 'src/db'; import { DummyValue, GenerateSql } from 'src/decorators'; -import { MoveEntity } from 'src/entities/move.entity'; import { AssetPathType, PathType } from 'src/enum'; -export type MoveCreate = Pick & Partial; - @Injectable() export class MoveRepository { constructor(@InjectKysely() private db: Kysely) {} - create(entity: Insertable): Promise { - return this.db - .insertInto('move_history') - .values(entity) - .returningAll() - .executeTakeFirstOrThrow() as Promise; + create(entity: Insertable) { + return this.db.insertInto('move_history').values(entity).returningAll().executeTakeFirstOrThrow(); } @GenerateSql({ params: [DummyValue.UUID, DummyValue.STRING] }) - getByEntity(entityId: string, pathType: PathType): Promise { + getByEntity(entityId: string, pathType: PathType) { return this.db .selectFrom('move_history') .selectAll() .where('entityId', '=', entityId) .where('pathType', '=', pathType) - .executeTakeFirst() as Promise; + .executeTakeFirst(); } - update(id: string, entity: Updateable): Promise { + update(id: string, entity: Updateable) { return this.db .updateTable('move_history') .set(entity) .where('id', '=', id) .returningAll() - .executeTakeFirstOrThrow() as unknown as Promise; + .executeTakeFirstOrThrow(); } @GenerateSql({ params: [DummyValue.UUID] }) - delete(id: string): Promise { - return this.db - .deleteFrom('move_history') - .where('id', '=', id) - .returningAll() - .executeTakeFirstOrThrow() as unknown as Promise; + delete(id: string) { + return this.db.deleteFrom('move_history').where('id', '=', id).returningAll().executeTakeFirstOrThrow(); } @GenerateSql()