mirror of
				https://github.com/immich-app/immich.git
				synced 2025-11-03 19:17:11 -05:00 
			
		
		
		
	* feat(server): user metadata * add missing method to user mock * update migration to include cascades * update sql files * test: fix e2e * chore: clean up --------- Co-authored-by: Daniel Dietzler <mail@ddietzler.dev>
		
			
				
	
	
		
			136 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			136 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import { UserAvatarColor, UserMetadataKey } from 'src/entities/user-metadata.entity';
 | 
						|
import { UserEntity } from 'src/entities/user.entity';
 | 
						|
import { authStub } from 'test/fixtures/auth.stub';
 | 
						|
 | 
						|
export const userDto = {
 | 
						|
  user1: {
 | 
						|
    email: 'user1@immich.app',
 | 
						|
    password: 'Password123',
 | 
						|
    name: 'User 1',
 | 
						|
  },
 | 
						|
  user2: {
 | 
						|
    email: 'user2@immich.app',
 | 
						|
    password: 'Password123',
 | 
						|
    name: 'User 2',
 | 
						|
  },
 | 
						|
  user3: {
 | 
						|
    email: 'user3@immich.app',
 | 
						|
    password: 'Password123',
 | 
						|
    name: 'User 3',
 | 
						|
  },
 | 
						|
  userWithQuota: {
 | 
						|
    email: 'quota-user@immich.app',
 | 
						|
    password: 'Password123',
 | 
						|
    name: 'User with quota',
 | 
						|
    quotaSizeInBytes: 42,
 | 
						|
  },
 | 
						|
};
 | 
						|
 | 
						|
export const userStub = {
 | 
						|
  admin: Object.freeze<UserEntity>({
 | 
						|
    ...authStub.admin.user,
 | 
						|
    password: 'admin_password',
 | 
						|
    name: 'admin_name',
 | 
						|
    storageLabel: 'admin',
 | 
						|
    oauthId: '',
 | 
						|
    shouldChangePassword: false,
 | 
						|
    profileImagePath: '',
 | 
						|
    createdAt: new Date('2021-01-01'),
 | 
						|
    deletedAt: null,
 | 
						|
    updatedAt: new Date('2021-01-01'),
 | 
						|
    tags: [],
 | 
						|
    assets: [],
 | 
						|
    metadata: [],
 | 
						|
    quotaSizeInBytes: null,
 | 
						|
    quotaUsageInBytes: 0,
 | 
						|
  }),
 | 
						|
  user1: Object.freeze<UserEntity>({
 | 
						|
    ...authStub.user1.user,
 | 
						|
    password: 'immich_password',
 | 
						|
    name: 'immich_name',
 | 
						|
    storageLabel: null,
 | 
						|
    oauthId: '',
 | 
						|
    shouldChangePassword: false,
 | 
						|
    profileImagePath: '',
 | 
						|
    createdAt: new Date('2021-01-01'),
 | 
						|
    deletedAt: null,
 | 
						|
    updatedAt: new Date('2021-01-01'),
 | 
						|
    tags: [],
 | 
						|
    assets: [],
 | 
						|
    metadata: [
 | 
						|
      {
 | 
						|
        user: authStub.user1.user,
 | 
						|
        userId: authStub.user1.user.id,
 | 
						|
        key: UserMetadataKey.PREFERENCES,
 | 
						|
        value: { avatar: { color: UserAvatarColor.PRIMARY } },
 | 
						|
      },
 | 
						|
    ],
 | 
						|
    quotaSizeInBytes: null,
 | 
						|
    quotaUsageInBytes: 0,
 | 
						|
  }),
 | 
						|
  user2: Object.freeze<UserEntity>({
 | 
						|
    ...authStub.user2.user,
 | 
						|
    password: 'immich_password',
 | 
						|
    name: 'immich_name',
 | 
						|
    storageLabel: null,
 | 
						|
    oauthId: '',
 | 
						|
    shouldChangePassword: false,
 | 
						|
    profileImagePath: '',
 | 
						|
    createdAt: new Date('2021-01-01'),
 | 
						|
    deletedAt: null,
 | 
						|
    updatedAt: new Date('2021-01-01'),
 | 
						|
    tags: [],
 | 
						|
    assets: [],
 | 
						|
    quotaSizeInBytes: null,
 | 
						|
    quotaUsageInBytes: 0,
 | 
						|
  }),
 | 
						|
  storageLabel: Object.freeze<UserEntity>({
 | 
						|
    ...authStub.user1.user,
 | 
						|
    password: 'immich_password',
 | 
						|
    name: 'immich_name',
 | 
						|
    storageLabel: 'label-1',
 | 
						|
    oauthId: '',
 | 
						|
    shouldChangePassword: false,
 | 
						|
    profileImagePath: '',
 | 
						|
    createdAt: new Date('2021-01-01'),
 | 
						|
    deletedAt: null,
 | 
						|
    updatedAt: new Date('2021-01-01'),
 | 
						|
    tags: [],
 | 
						|
    assets: [],
 | 
						|
    quotaSizeInBytes: null,
 | 
						|
    quotaUsageInBytes: 0,
 | 
						|
  }),
 | 
						|
  externalPathRoot: Object.freeze<UserEntity>({
 | 
						|
    ...authStub.user1.user,
 | 
						|
    password: 'immich_password',
 | 
						|
    name: 'immich_name',
 | 
						|
    storageLabel: 'label-1',
 | 
						|
    oauthId: '',
 | 
						|
    shouldChangePassword: false,
 | 
						|
    profileImagePath: '',
 | 
						|
    createdAt: new Date('2021-01-01'),
 | 
						|
    deletedAt: null,
 | 
						|
    updatedAt: new Date('2021-01-01'),
 | 
						|
    tags: [],
 | 
						|
    assets: [],
 | 
						|
    quotaSizeInBytes: null,
 | 
						|
    quotaUsageInBytes: 0,
 | 
						|
  }),
 | 
						|
  profilePath: Object.freeze<UserEntity>({
 | 
						|
    ...authStub.user1.user,
 | 
						|
    password: 'immich_password',
 | 
						|
    name: 'immich_name',
 | 
						|
    storageLabel: 'label-1',
 | 
						|
    oauthId: '',
 | 
						|
    shouldChangePassword: false,
 | 
						|
    profileImagePath: '/path/to/profile.jpg',
 | 
						|
    createdAt: new Date('2021-01-01'),
 | 
						|
    deletedAt: null,
 | 
						|
    updatedAt: new Date('2021-01-01'),
 | 
						|
    tags: [],
 | 
						|
    assets: [],
 | 
						|
    quotaSizeInBytes: null,
 | 
						|
    quotaUsageInBytes: 0,
 | 
						|
  }),
 | 
						|
};
 |