mirror of
https://github.com/immich-app/immich.git
synced 2025-11-17 06:42:34 +09:00
chore(web): improve type checking (#2644)
* fix(web): use id instead of assetId * chore(web): improve type checking * fix test jobs * improve type checking and resolve errors
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { AlbumResponseDto } from '@api';
|
||||
import { Sync } from 'factory.ts';
|
||||
import type { AlbumResponseDto } from '@api';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { Sync } from 'factory.ts';
|
||||
import { userFactory } from './user-factory';
|
||||
|
||||
export const albumFactory = Sync.makeFactory<AlbumResponseDto>({
|
||||
albumName: Sync.each(() => faker.commerce.product()),
|
||||
@@ -8,8 +9,10 @@ export const albumFactory = Sync.makeFactory<AlbumResponseDto>({
|
||||
assetCount: Sync.each((i) => i % 5),
|
||||
assets: [],
|
||||
createdAt: Sync.each(() => faker.date.past().toISOString()),
|
||||
updatedAt: Sync.each(() => faker.date.past().toISOString()),
|
||||
id: Sync.each(() => faker.datatype.uuid()),
|
||||
ownerId: Sync.each(() => faker.datatype.uuid()),
|
||||
owner: userFactory.build(),
|
||||
shared: false,
|
||||
sharedUsers: []
|
||||
});
|
||||
|
||||
18
web/src/test-data/factories/user-factory.ts
Normal file
18
web/src/test-data/factories/user-factory.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import type { UserResponseDto } from '@api';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { Sync } from 'factory.ts';
|
||||
|
||||
export const userFactory = Sync.makeFactory<UserResponseDto>({
|
||||
id: Sync.each(() => faker.datatype.uuid()),
|
||||
email: Sync.each(() => faker.internet.email()),
|
||||
firstName: Sync.each(() => faker.name.firstName()),
|
||||
lastName: Sync.each(() => faker.name.lastName()),
|
||||
storageLabel: Sync.each(() => faker.random.alphaNumeric()),
|
||||
profileImagePath: '',
|
||||
shouldChangePassword: Sync.each(() => faker.datatype.boolean()),
|
||||
isAdmin: true,
|
||||
createdAt: Sync.each(() => faker.date.past().toISOString()),
|
||||
deletedAt: null,
|
||||
updatedAt: Sync.each(() => faker.date.past().toISOString()),
|
||||
oauthId: ''
|
||||
});
|
||||
Reference in New Issue
Block a user