2025-01-21 11:24:48 -06:00
|
|
|
import { Insertable, Updateable } from 'kysely';
|
|
|
|
|
import { Albums } from 'src/db';
|
|
|
|
|
import { AlbumUserCreateDto } from 'src/dtos/album.dto';
|
2024-03-20 16:02:51 -05:00
|
|
|
import { AlbumEntity } from 'src/entities/album.entity';
|
2024-03-29 12:56:16 +01:00
|
|
|
import { IBulkAsset } from 'src/utils/asset.util';
|
2023-03-02 21:47:08 -05:00
|
|
|
|
2023-02-25 09:12:03 -05:00
|
|
|
export const IAlbumRepository = 'IAlbumRepository';
|
|
|
|
|
|
2023-03-26 04:46:48 +02:00
|
|
|
export interface AlbumAssetCount {
|
|
|
|
|
albumId: string;
|
|
|
|
|
assetCount: number;
|
2025-01-25 23:37:19 -05:00
|
|
|
startDate: Date | null;
|
|
|
|
|
endDate: Date | null;
|
2023-03-26 04:46:48 +02:00
|
|
|
}
|
|
|
|
|
|
2023-08-15 14:34:02 -04:00
|
|
|
export interface AlbumInfoOptions {
|
|
|
|
|
withAssets: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-29 12:56:16 +01:00
|
|
|
export interface IAlbumRepository extends IBulkAsset {
|
2025-01-21 11:24:48 -06:00
|
|
|
getById(id: string, options: AlbumInfoOptions): Promise<AlbumEntity | undefined>;
|
2023-03-26 04:46:48 +02:00
|
|
|
getByAssetId(ownerId: string, assetId: string): Promise<AlbumEntity[]>;
|
2023-10-18 11:56:00 -04:00
|
|
|
removeAsset(assetId: string): Promise<void>;
|
2023-11-26 16:23:43 +01:00
|
|
|
getMetadataForIds(ids: string[]): Promise<AlbumAssetCount[]>;
|
2023-03-26 04:46:48 +02:00
|
|
|
getOwned(ownerId: string): Promise<AlbumEntity[]>;
|
|
|
|
|
getShared(ownerId: string): Promise<AlbumEntity[]>;
|
|
|
|
|
getNotShared(ownerId: string): Promise<AlbumEntity[]>;
|
2023-09-18 17:56:50 +02:00
|
|
|
restoreAll(userId: string): Promise<void>;
|
|
|
|
|
softDeleteAll(userId: string): Promise<void>;
|
2023-02-25 09:12:03 -05:00
|
|
|
deleteAll(userId: string): Promise<void>;
|
2025-01-21 11:24:48 -06:00
|
|
|
create(album: Insertable<Albums>, assetIds: string[], albumUsers: AlbumUserCreateDto[]): Promise<AlbumEntity>;
|
|
|
|
|
update(id: string, album: Updateable<Albums>): Promise<AlbumEntity>;
|
2024-07-17 07:43:35 -04:00
|
|
|
delete(id: string): Promise<void>;
|
2023-08-01 21:29:14 -04:00
|
|
|
updateThumbnails(): Promise<number | undefined>;
|
2023-02-25 09:12:03 -05:00
|
|
|
}
|