import { AssetEntity, AssetType } from '@app/infra/entities'; import { Paginated, PaginationOptions } from '../domain.util'; export type AssetStats = Record; export interface AssetStatsOptions { isFavorite?: boolean; isArchived?: boolean; } export interface AssetSearchOptions { isVisible?: boolean; type?: AssetType; order?: 'ASC' | 'DESC'; } export interface LivePhotoSearchOptions { ownerId: string; livePhotoCID: string; otherAssetId: string; type: AssetType; } export interface MapMarkerSearchOptions { isFavorite?: boolean; fileCreatedBefore?: Date; fileCreatedAfter?: Date; } export interface MapMarker { id: string; lat: number; lon: number; } export enum WithoutProperty { THUMBNAIL = 'thumbnail', ENCODED_VIDEO = 'encoded-video', EXIF = 'exif', CLIP_ENCODING = 'clip-embedding', OBJECT_TAGS = 'object-tags', FACES = 'faces', SIDECAR = 'sidecar', } export enum WithProperty { SIDECAR = 'sidecar', } export enum TimeBucketSize { DAY = 'DAY', MONTH = 'MONTH', } export interface TimeBucketOptions { size: TimeBucketSize; isArchived?: boolean; isFavorite?: boolean; albumId?: string; personId?: string; userId?: string; } export interface TimeBucketItem { timeBucket: string; count: number; } export const IAssetRepository = 'IAssetRepository'; export interface IAssetRepository { getByDate(ownerId: string, date: Date): Promise; getByIds(ids: string[]): Promise; getByAlbumId(pagination: PaginationOptions, albumId: string): Paginated; getByUserId(pagination: PaginationOptions, userId: string): Paginated; getWithout(pagination: PaginationOptions, property: WithoutProperty): Paginated; getWith(pagination: PaginationOptions, property: WithProperty): Paginated; getFirstAssetForAlbumId(albumId: string): Promise; getLastUpdatedAssetForAlbumId(albumId: string): Promise; deleteAll(ownerId: string): Promise; getAll(pagination: PaginationOptions, options?: AssetSearchOptions): Paginated; save(asset: Partial): Promise; findLivePhotoMatch(options: LivePhotoSearchOptions): Promise; getMapMarkers(ownerId: string, options?: MapMarkerSearchOptions): Promise; getStatistics(ownerId: string, options: AssetStatsOptions): Promise; getTimeBuckets(options: TimeBucketOptions): Promise; getByTimeBucket(timeBucket: string, options: TimeBucketOptions): Promise; }