refactor: move asset stacks to their own entity (#6353)

* feat: auto-stack burst photos

* feat: move stacks to asset stack entity

* chore: pin node version with volta in server

* chore: update e2e cases

* chore: cleanup

* feat: migrate existing stacks

---------

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
Zack Pollard
2024-01-27 18:52:14 +00:00
committed by GitHub
parent c4b8c853bc
commit 25cad79657
29 changed files with 538 additions and 243 deletions
+16 -3
View File
@@ -1,9 +1,18 @@
import { AssetEntity, AssetType, ExifEntity } from '@app/infra/entities';
import { AssetEntity, AssetStackEntity, AssetType, ExifEntity } from '@app/infra/entities';
import { authStub } from './auth.stub';
import { fileStub } from './file.stub';
import { libraryStub } from './library.stub';
import { userStub } from './user.stub';
export const assetStackStub = (stackId: string, assets: AssetEntity[]): AssetStackEntity => {
return {
id: stackId,
assets: assets,
primaryAsset: assets[0],
primaryAssetId: assets[0].id,
};
};
export const assetStub = {
noResizePath: Object.freeze<AssetEntity>({
id: 'asset-id',
@@ -120,7 +129,7 @@ export const assetStub = {
}),
primaryImage: Object.freeze<AssetEntity>({
id: 'asset-id',
id: 'primary-asset-id',
deviceAssetId: 'device-asset-id',
fileModifiedAt: new Date('2023-02-23T05:06:29.716Z'),
fileCreatedAt: new Date('2023-02-23T05:06:29.716Z'),
@@ -157,7 +166,11 @@ export const assetStub = {
exifInfo: {
fileSizeInByte: 5_000,
} as ExifEntity,
stack: [{ id: 'stack-child-asset-1' } as AssetEntity, { id: 'stack-child-asset-2' } as AssetEntity],
stack: assetStackStub('stack-1', [
{ id: 'primary-asset-id' } as AssetEntity,
{ id: 'stack-child-asset-1' } as AssetEntity,
{ id: 'stack-child-asset-2' } as AssetEntity,
]),
}),
image: Object.freeze<AssetEntity>({
+1
View File
@@ -248,6 +248,7 @@ export const sharedLinkStub = {
profileDescription: 'sRGB',
bitsPerSample: 8,
colorspace: 'sRGB',
autoStackId: null,
},
tags: [],
sharedLinks: [],
@@ -0,0 +1,10 @@
import { IAssetStackRepository } from '@app/domain';
export const newAssetStackRepositoryMock = (): jest.Mocked<IAssetStackRepository> => {
return {
create: jest.fn(),
update: jest.fn(),
delete: jest.fn(),
getById: jest.fn(),
};
};
+1
View File
@@ -1,6 +1,7 @@
export * from './access.repository.mock';
export * from './album.repository.mock';
export * from './api-key.repository.mock';
export * from './asset-stack.repository.mock';
export * from './asset.repository.mock';
export * from './audit.repository.mock';
export * from './communication.repository.mock';