refactor: remove album entity, update types (#17450)

This commit is contained in:
Daniel Dietzler 2025-04-18 23:10:34 +02:00 committed by GitHub
parent 854ea13d6a
commit 52ae06c119
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
44 changed files with 473 additions and 396 deletions

View file

@ -1,13 +1,14 @@
import { Selectable } from 'kysely';
import { AssetJobStatus as DatabaseAssetJobStatus, Exif as DatabaseExif } from 'src/db';
import { Albums, AssetJobStatus as DatabaseAssetJobStatus, Exif as DatabaseExif } from 'src/db';
import { MapAsset } from 'src/dtos/asset-response.dto';
import { AssetEntity } from 'src/entities/asset.entity';
import {
AlbumUserRole,
AssetFileType,
AssetStatus,
AssetType,
MemoryType,
Permission,
SharedLinkType,
SourceType,
UserStatus,
} from 'src/enum';
@ -44,7 +45,7 @@ export type Library = {
exclusionPatterns: string[];
deletedAt: Date | null;
refreshedAt: Date | null;
assets?: Asset[];
assets?: MapAsset[];
};
export type AuthApiKey = {
@ -96,7 +97,26 @@ export type Memory = {
data: OnThisDayData;
ownerId: string;
isSaved: boolean;
assets: Asset[];
assets: MapAsset[];
};
export type Asset = {
id: string;
checksum: Buffer<ArrayBufferLike>;
deviceAssetId: string;
deviceId: string;
fileCreatedAt: Date;
fileModifiedAt: Date;
isExternal: boolean;
isVisible: boolean;
libraryId: string | null;
livePhotoVideoId: string | null;
localDateTime: Date;
originalFileName: string;
originalPath: string;
ownerId: string;
sidecarPath: string | null;
type: AssetType;
};
export type User = {
@ -128,39 +148,6 @@ export type StorageAsset = {
encodedVideoPath: string | null;
};
export type Asset = {
createdAt: Date;
updatedAt: Date;
deletedAt: Date | null;
id: string;
updateId: string;
status: AssetStatus;
checksum: Buffer<ArrayBufferLike>;
deviceAssetId: string;
deviceId: string;
duplicateId: string | null;
duration: string | null;
encodedVideoPath: string | null;
fileCreatedAt: Date | null;
fileModifiedAt: Date | null;
isArchived: boolean;
isExternal: boolean;
isFavorite: boolean;
isOffline: boolean;
isVisible: boolean;
libraryId: string | null;
livePhotoVideoId: string | null;
localDateTime: Date | null;
originalFileName: string;
originalPath: string;
ownerId: string;
sidecarPath: string | null;
stack?: Stack | null;
stackId: string | null;
thumbhash: Buffer<ArrayBufferLike> | null;
type: AssetType;
};
export type SidecarWriteAsset = {
id: string;
sidecarPath: string | null;
@ -173,7 +160,7 @@ export type Stack = {
primaryAssetId: string;
owner?: User;
ownerId: string;
assets: AssetEntity[];
assets: MapAsset[];
assetCount?: number;
};
@ -187,6 +174,28 @@ export type AuthSharedLink = {
password: string | null;
};
export type SharedLink = {
id: string;
album?: Album | null;
albumId: string | null;
allowDownload: boolean;
allowUpload: boolean;
assets: MapAsset[];
createdAt: Date;
description: string | null;
expiresAt: Date | null;
key: Buffer;
password: string | null;
showExif: boolean;
type: SharedLinkType;
userId: string;
};
export type Album = Selectable<Albums> & {
owner: User;
assets: MapAsset[];
};
export type AuthSession = {
id: string;
};