refactor: migrate library repository to kysely (#15271)

This commit is contained in:
Daniel Dietzler
2025-01-15 22:01:28 +01:00
committed by GitHub
parent 81568dbda3
commit a2207f2eef
5 changed files with 225 additions and 205 deletions

View File

@@ -1,3 +1,5 @@
import { Insertable, Updateable } from 'kysely';
import { Libraries } from 'src/db';
import { LibraryStatsResponseDto } from 'src/dtos/library.dto';
import { LibraryEntity } from 'src/entities/library.entity';
@@ -6,10 +8,10 @@ export const ILibraryRepository = 'ILibraryRepository';
export interface ILibraryRepository {
getAll(withDeleted?: boolean): Promise<LibraryEntity[]>;
getAllDeleted(): Promise<LibraryEntity[]>;
get(id: string, withDeleted?: boolean): Promise<LibraryEntity | null>;
create(library: Partial<LibraryEntity>): Promise<LibraryEntity>;
get(id: string, withDeleted?: boolean): Promise<LibraryEntity | undefined>;
create(library: Insertable<Libraries>): Promise<LibraryEntity>;
delete(id: string): Promise<void>;
softDelete(id: string): Promise<void>;
update(library: Partial<LibraryEntity>): Promise<LibraryEntity>;
update(id: string, library: Updateable<Libraries>): Promise<LibraryEntity>;
getStatistics(id: string): Promise<LibraryStatsResponseDto | undefined>;
}