mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
refactor(server): tags (#2589)
* refactor: tags * chore: open api * chore: unused import * feat: add/remove/get tag assets * chore: open api * chore: finish tag tests for add/remove assets
This commit is contained in:
@@ -2,17 +2,19 @@ import {
|
||||
AlbumEntity,
|
||||
APIKeyEntity,
|
||||
AssetEntity,
|
||||
AssetFaceEntity,
|
||||
AssetType,
|
||||
PersonEntity,
|
||||
ExifEntity,
|
||||
PartnerEntity,
|
||||
PersonEntity,
|
||||
SharedLinkEntity,
|
||||
SharedLinkType,
|
||||
SystemConfig,
|
||||
TagEntity,
|
||||
TagType,
|
||||
TranscodePreset,
|
||||
UserEntity,
|
||||
UserTokenEntity,
|
||||
AssetFaceEntity,
|
||||
ExifEntity,
|
||||
} from '@app/infra/entities';
|
||||
import {
|
||||
AlbumResponseDto,
|
||||
@@ -23,6 +25,7 @@ import {
|
||||
mapUser,
|
||||
SearchResult,
|
||||
SharedLinkResponseDto,
|
||||
TagResponseDto,
|
||||
VideoFormat,
|
||||
VideoInfo,
|
||||
VideoStreamInfo,
|
||||
@@ -988,3 +991,24 @@ export const faceStub = {
|
||||
embedding: [1, 2, 3, 4],
|
||||
}),
|
||||
};
|
||||
|
||||
export const tagStub = {
|
||||
tag1: Object.freeze<TagEntity>({
|
||||
id: 'tag-1',
|
||||
name: 'Tag1',
|
||||
type: TagType.CUSTOM,
|
||||
userId: userEntityStub.admin.id,
|
||||
user: userEntityStub.admin,
|
||||
renameTagId: null,
|
||||
assets: [],
|
||||
}),
|
||||
};
|
||||
|
||||
export const tagResponseStub = {
|
||||
tag1: Object.freeze<TagResponseDto>({
|
||||
id: 'tag-1',
|
||||
name: 'Tag1',
|
||||
type: 'CUSTOM',
|
||||
userId: 'admin_id',
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -15,6 +15,7 @@ export * from './shared-link.repository.mock';
|
||||
export * from './smart-info.repository.mock';
|
||||
export * from './storage.repository.mock';
|
||||
export * from './system-config.repository.mock';
|
||||
export * from './tag.repository.mock';
|
||||
export * from './user-token.repository.mock';
|
||||
export * from './user.repository.mock';
|
||||
|
||||
|
||||
16
server/libs/domain/test/tag.repository.mock.ts
Normal file
16
server/libs/domain/test/tag.repository.mock.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { ITagRepository } from '../src';
|
||||
|
||||
export const newTagRepositoryMock = (): jest.Mocked<ITagRepository> => {
|
||||
return {
|
||||
getAll: jest.fn(),
|
||||
getById: jest.fn(),
|
||||
create: jest.fn(),
|
||||
update: jest.fn(),
|
||||
remove: jest.fn(),
|
||||
hasAsset: jest.fn(),
|
||||
hasName: jest.fn(),
|
||||
getAssets: jest.fn(),
|
||||
addAssets: jest.fn(),
|
||||
removeAssets: jest.fn(),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user