refactor(server): use date type for entities (#2602)

This commit is contained in:
Michel Heusschen
2023-05-30 15:15:56 +02:00
committed by GitHub
parent 3d505e425d
commit 789e3e3924
49 changed files with 243 additions and 217 deletions
@@ -6,12 +6,12 @@ export class UserResponseDto {
firstName!: string;
lastName!: string;
storageLabel!: string | null;
createdAt!: string;
profileImagePath!: string;
shouldChangePassword!: boolean;
isAdmin!: boolean;
deletedAt?: Date;
updatedAt?: string;
createdAt!: Date;
deletedAt!: Date | null;
updatedAt!: Date;
oauthId!: string;
}
@@ -22,10 +22,10 @@ export function mapUser(entity: UserEntity): UserResponseDto {
firstName: entity.firstName,
lastName: entity.lastName,
storageLabel: entity.storageLabel,
createdAt: entity.createdAt,
profileImagePath: entity.profileImagePath,
shouldChangePassword: entity.shouldChangePassword,
isAdmin: entity.isAdmin,
createdAt: entity.createdAt,
deletedAt: entity.deletedAt,
updatedAt: entity.updatedAt,
oauthId: entity.oauthId,
@@ -47,8 +47,9 @@ const adminUser: UserEntity = Object.freeze({
oauthId: '',
shouldChangePassword: false,
profileImagePath: '',
createdAt: '2021-01-01',
updatedAt: '2021-01-01',
createdAt: new Date('2021-01-01'),
deletedAt: null,
updatedAt: new Date('2021-01-01'),
tags: [],
assets: [],
storageLabel: 'admin',
@@ -64,8 +65,9 @@ const immichUser: UserEntity = Object.freeze({
oauthId: '',
shouldChangePassword: false,
profileImagePath: '',
createdAt: '2021-01-01',
updatedAt: '2021-01-01',
createdAt: new Date('2021-01-01'),
deletedAt: null,
updatedAt: new Date('2021-01-01'),
tags: [],
assets: [],
storageLabel: null,
@@ -81,8 +83,9 @@ const updatedImmichUser: UserEntity = Object.freeze({
oauthId: '',
shouldChangePassword: true,
profileImagePath: '',
createdAt: '2021-01-01',
updatedAt: '2021-01-01',
createdAt: new Date('2021-01-01'),
deletedAt: null,
updatedAt: new Date('2021-01-01'),
tags: [],
assets: [],
storageLabel: null,
@@ -91,15 +94,15 @@ const updatedImmichUser: UserEntity = Object.freeze({
const adminUserResponse = Object.freeze({
id: adminUserAuth.id,
email: 'admin@test.com',
deletedAt: undefined,
firstName: 'admin_first_name',
lastName: 'admin_last_name',
isAdmin: true,
oauthId: '',
shouldChangePassword: false,
profileImagePath: '',
createdAt: '2021-01-01',
updatedAt: '2021-01-01',
createdAt: new Date('2021-01-01'),
deletedAt: null,
updatedAt: new Date('2021-01-01'),
storageLabel: 'admin',
});
@@ -140,15 +143,15 @@ describe(UserService.name, () => {
{
id: adminUserAuth.id,
email: 'admin@test.com',
deletedAt: undefined,
firstName: 'admin_first_name',
lastName: 'admin_last_name',
isAdmin: true,
oauthId: '',
shouldChangePassword: false,
profileImagePath: '',
createdAt: '2021-01-01',
updatedAt: '2021-01-01',
createdAt: new Date('2021-01-01'),
deletedAt: null,
updatedAt: new Date('2021-01-01'),
storageLabel: 'admin',
},
]);