mirror of
https://github.com/immich-app/immich.git
synced 2025-12-24 09:14:58 +03:00
feat: persistent memories (#8330)
* feat: persistent memories * refactor: use new add/remove asset utility
This commit is contained in:
30
server/test/fixtures/memory.stub.ts
vendored
Normal file
30
server/test/fixtures/memory.stub.ts
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import { MemoryEntity, MemoryType } from 'src/entities/memory.entity';
|
||||
import { assetStub } from 'test/fixtures/asset.stub';
|
||||
import { userStub } from 'test/fixtures/user.stub';
|
||||
|
||||
export const memoryStub = {
|
||||
empty: <MemoryEntity>{
|
||||
id: 'memoryEmpty',
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
memoryAt: new Date(2024),
|
||||
ownerId: userStub.admin.id,
|
||||
owner: userStub.admin,
|
||||
type: MemoryType.ON_THIS_DAY,
|
||||
data: { year: 2024 },
|
||||
isSaved: false,
|
||||
assets: [],
|
||||
},
|
||||
memory1: <MemoryEntity>{
|
||||
id: 'memory1',
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
memoryAt: new Date(2024),
|
||||
ownerId: userStub.admin.id,
|
||||
owner: userStub.admin,
|
||||
type: MemoryType.ON_THIS_DAY,
|
||||
data: { year: 2024 },
|
||||
isSaved: false,
|
||||
assets: [assetStub.image1],
|
||||
},
|
||||
};
|
||||
@@ -8,6 +8,7 @@ export interface IAccessRepositoryMock {
|
||||
authDevice: jest.Mocked<IAccessRepository['authDevice']>;
|
||||
library: jest.Mocked<IAccessRepository['library']>;
|
||||
timeline: jest.Mocked<IAccessRepository['timeline']>;
|
||||
memory: jest.Mocked<IAccessRepository['memory']>;
|
||||
person: jest.Mocked<IAccessRepository['person']>;
|
||||
partner: jest.Mocked<IAccessRepository['partner']>;
|
||||
}
|
||||
@@ -49,6 +50,10 @@ export const newAccessRepositoryMock = (reset = true): IAccessRepositoryMock =>
|
||||
checkPartnerAccess: jest.fn().mockResolvedValue(new Set()),
|
||||
},
|
||||
|
||||
memory: {
|
||||
checkOwnerAccess: jest.fn().mockResolvedValue(new Set()),
|
||||
},
|
||||
|
||||
person: {
|
||||
checkFaceOwnerAccess: jest.fn().mockResolvedValue(new Set()),
|
||||
checkOwnerAccess: jest.fn().mockResolvedValue(new Set()),
|
||||
|
||||
14
server/test/repositories/memory.repository.mock.ts
Normal file
14
server/test/repositories/memory.repository.mock.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { IMemoryRepository } from 'src/interfaces/memory.interface';
|
||||
|
||||
export const newMemoryRepositoryMock = (): jest.Mocked<IMemoryRepository> => {
|
||||
return {
|
||||
search: jest.fn().mockResolvedValue([]),
|
||||
get: jest.fn(),
|
||||
create: jest.fn(),
|
||||
update: jest.fn(),
|
||||
delete: jest.fn(),
|
||||
getAssetIds: jest.fn().mockResolvedValue(new Set()),
|
||||
addAssetIds: jest.fn(),
|
||||
removeAssetIds: jest.fn(),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user