mirror of
https://github.com/immich-app/immich.git
synced 2025-12-28 09:14:59 +03:00
refactor: migration tag repository to kysely (#16398)
This commit is contained in:
60
server/test/fixtures/tag.stub.ts
vendored
60
server/test/fixtures/tag.stub.ts
vendored
@@ -1,49 +1,51 @@
|
||||
import { TagResponseDto } from 'src/dtos/tag.dto';
|
||||
import { TagEntity } from 'src/entities/tag.entity';
|
||||
import { userStub } from 'test/fixtures/user.stub';
|
||||
import { TagItem } from 'src/types';
|
||||
|
||||
const parent = Object.freeze<TagEntity>({
|
||||
const parent = Object.freeze<TagItem>({
|
||||
id: 'tag-parent',
|
||||
createdAt: new Date('2021-01-01T00:00:00Z'),
|
||||
updatedAt: new Date('2021-01-01T00:00:00Z'),
|
||||
value: 'Parent',
|
||||
color: null,
|
||||
userId: userStub.admin.id,
|
||||
user: userStub.admin,
|
||||
parentId: null,
|
||||
});
|
||||
|
||||
const child = Object.freeze<TagEntity>({
|
||||
const child = Object.freeze<TagItem>({
|
||||
id: 'tag-child',
|
||||
createdAt: new Date('2021-01-01T00:00:00Z'),
|
||||
updatedAt: new Date('2021-01-01T00:00:00Z'),
|
||||
value: 'Parent/Child',
|
||||
color: null,
|
||||
parent,
|
||||
userId: userStub.admin.id,
|
||||
user: userStub.admin,
|
||||
parentId: parent.id,
|
||||
});
|
||||
|
||||
const tag = {
|
||||
id: 'tag-1',
|
||||
createdAt: new Date('2021-01-01T00:00:00Z'),
|
||||
updatedAt: new Date('2021-01-01T00:00:00Z'),
|
||||
value: 'Tag1',
|
||||
color: null,
|
||||
parentId: null,
|
||||
};
|
||||
|
||||
const color = {
|
||||
id: 'tag-1',
|
||||
createdAt: new Date('2021-01-01T00:00:00Z'),
|
||||
updatedAt: new Date('2021-01-01T00:00:00Z'),
|
||||
value: 'Tag1',
|
||||
color: '#000000',
|
||||
parentId: null,
|
||||
};
|
||||
|
||||
const upsert = { userId: 'tag-user', updateId: 'uuid-v7' };
|
||||
|
||||
export const tagStub = {
|
||||
tag1: Object.freeze<TagEntity>({
|
||||
id: 'tag-1',
|
||||
createdAt: new Date('2021-01-01T00:00:00Z'),
|
||||
updatedAt: new Date('2021-01-01T00:00:00Z'),
|
||||
value: 'Tag1',
|
||||
color: null,
|
||||
userId: userStub.admin.id,
|
||||
user: userStub.admin,
|
||||
}),
|
||||
parent,
|
||||
child,
|
||||
color1: Object.freeze<TagEntity>({
|
||||
id: 'tag-1',
|
||||
createdAt: new Date('2021-01-01T00:00:00Z'),
|
||||
updatedAt: new Date('2021-01-01T00:00:00Z'),
|
||||
value: 'Tag1',
|
||||
color: '#000000',
|
||||
userId: userStub.admin.id,
|
||||
user: userStub.admin,
|
||||
}),
|
||||
tag,
|
||||
tagCreate: { ...tag, ...upsert },
|
||||
color,
|
||||
colorCreate: { ...color, ...upsert },
|
||||
parentUpsert: { ...parent, ...upsert },
|
||||
childUpsert: { ...child, ...upsert },
|
||||
};
|
||||
|
||||
export const tagResponseStub = {
|
||||
|
||||
@@ -7,7 +7,7 @@ export const newTagRepositoryMock = (): Mocked<RepositoryInterface<TagRepository
|
||||
getAll: vitest.fn(),
|
||||
getByValue: vitest.fn(),
|
||||
upsertValue: vitest.fn(),
|
||||
upsertAssetTags: vitest.fn(),
|
||||
replaceAssetTags: vitest.fn(),
|
||||
|
||||
get: vitest.fn(),
|
||||
create: vitest.fn(),
|
||||
|
||||
Reference in New Issue
Block a user