refactor: migrate stacks (#17559)

chore: migrate stacks
This commit is contained in:
Daniel Dietzler 2025-04-12 14:33:35 +02:00 committed by GitHub
parent 5dac315af7
commit a373034629
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 153 additions and 63 deletions

View file

@ -1,5 +1,6 @@
import { Selectable } from 'kysely';
import { Exif as DatabaseExif } from 'src/db';
import { AssetEntity } from 'src/entities/asset.entity';
import {
AlbumUserRole,
AssetFileType,
@ -147,6 +148,7 @@ export type Asset = {
originalPath: string;
ownerId: string;
sidecarPath: string | null;
stack?: Stack | null;
stackId: string | null;
thumbhash: Buffer<ArrayBufferLike> | null;
type: AssetType;
@ -159,6 +161,15 @@ export type SidecarWriteAsset = {
tags: Array<{ value: string }>;
};
export type Stack = {
id: string;
primaryAssetId: string;
owner?: User;
ownerId: string;
assets: AssetEntity[];
assetCount?: number;
};
export type AuthSharedLink = {
id: string;
expiresAt: Date | null;
@ -276,7 +287,7 @@ export const columns = {
'quotaSizeInBytes',
'quotaUsageInBytes',
],
tagDto: ['id', 'value', 'createdAt', 'updatedAt', 'color', 'parentId'],
tag: ['tags.id', 'tags.value', 'tags.createdAt', 'tags.updatedAt', 'tags.color', 'tags.parentId'],
apiKey: ['id', 'name', 'userId', 'createdAt', 'updatedAt', 'permissions'],
syncAsset: [
'id',
@ -292,6 +303,7 @@ export const columns = {
'isVisible',
'updateId',
],
stack: ['stack.id', 'stack.primaryAssetId', 'ownerId'],
syncAssetExif: [
'exif.assetId',
'exif.description',
@ -320,4 +332,35 @@ export const columns = {
'exif.fps',
'exif.updateId',
],
exif: [
'exif.assetId',
'exif.autoStackId',
'exif.bitsPerSample',
'exif.city',
'exif.colorspace',
'exif.country',
'exif.dateTimeOriginal',
'exif.description',
'exif.exifImageHeight',
'exif.exifImageWidth',
'exif.exposureTime',
'exif.fileSizeInByte',
'exif.fNumber',
'exif.focalLength',
'exif.fps',
'exif.iso',
'exif.latitude',
'exif.lensModel',
'exif.livePhotoCID',
'exif.longitude',
'exif.make',
'exif.model',
'exif.modifyDate',
'exif.orientation',
'exif.profileDescription',
'exif.projectionType',
'exif.rating',
'exif.state',
'exif.timeZone',
],
} as const;