refactor: migrate move repository to kysely (#15327)

* refactor: migrate move repository to kysely

* fix: tests

* fix: tests
This commit is contained in:
Alex 2025-01-13 22:22:03 -06:00 committed by GitHub
parent fc99c5f530
commit a35af2b242
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 56 additions and 35 deletions

View file

@ -1,3 +1,5 @@
import { Insertable, Updateable } from 'kysely';
import { MoveHistory } from 'src/db';
import { MoveEntity } from 'src/entities/move.entity';
import { PathType } from 'src/enum';
@ -6,8 +8,8 @@ export const IMoveRepository = 'IMoveRepository';
export type MoveCreate = Pick<MoveEntity, 'oldPath' | 'newPath' | 'entityId' | 'pathType'> & Partial<MoveEntity>;
export interface IMoveRepository {
create(entity: MoveCreate): Promise<MoveEntity>;
getByEntity(entityId: string, pathType: PathType): Promise<MoveEntity | null>;
update(entity: Partial<MoveEntity>): Promise<MoveEntity>;
delete(move: MoveEntity): Promise<MoveEntity>;
create(entity: Insertable<MoveHistory>): Promise<MoveEntity>;
getByEntity(entityId: string, pathType: PathType): Promise<MoveEntity | undefined>;
update(id: string, entity: Updateable<MoveHistory>): Promise<MoveEntity>;
delete(id: string): Promise<MoveEntity>;
}