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

View File

@@ -85,8 +85,9 @@ export const userEntityStub = {
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: [],
}),
@@ -99,8 +100,9 @@ export const userEntityStub = {
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: [],
}),
@@ -113,8 +115,9 @@ export const userEntityStub = {
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: [],
}),
@@ -317,8 +320,8 @@ export const albumStub = {
assets: [],
albumThumbnailAsset: null,
albumThumbnailAssetId: null,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
createdAt: new Date(),
updatedAt: new Date(),
sharedLinks: [],
sharedUsers: [],
}),
@@ -330,8 +333,8 @@ export const albumStub = {
assets: [],
albumThumbnailAsset: null,
albumThumbnailAssetId: null,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
createdAt: new Date(),
updatedAt: new Date(),
sharedLinks: [],
sharedUsers: [userEntityStub.user1],
}),
@@ -343,8 +346,8 @@ export const albumStub = {
assets: [],
albumThumbnailAsset: null,
albumThumbnailAssetId: null,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
createdAt: new Date(),
updatedAt: new Date(),
sharedLinks: [],
sharedUsers: [userEntityStub.admin],
}),
@@ -356,8 +359,8 @@ export const albumStub = {
assets: [assetEntityStub.image],
albumThumbnailAsset: null,
albumThumbnailAssetId: null,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
createdAt: new Date(),
updatedAt: new Date(),
sharedLinks: [],
sharedUsers: [],
}),
@@ -369,8 +372,8 @@ export const albumStub = {
assets: [],
albumThumbnailAsset: assetEntityStub.image,
albumThumbnailAssetId: assetEntityStub.image.id,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
createdAt: new Date(),
updatedAt: new Date(),
sharedLinks: [],
sharedUsers: [],
}),
@@ -382,8 +385,8 @@ export const albumStub = {
assets: [],
albumThumbnailAsset: null,
albumThumbnailAssetId: null,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
createdAt: new Date(),
updatedAt: new Date(),
sharedLinks: [],
sharedUsers: [],
}),
@@ -395,8 +398,8 @@ export const albumStub = {
assets: [assetEntityStub.image],
albumThumbnailAsset: assetEntityStub.livePhotoMotionAsset,
albumThumbnailAssetId: assetEntityStub.livePhotoMotionAsset.id,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
createdAt: new Date(),
updatedAt: new Date(),
sharedLinks: [],
sharedUsers: [],
}),
@@ -408,8 +411,8 @@ export const albumStub = {
assets: [assetEntityStub.image],
albumThumbnailAsset: assetEntityStub.image,
albumThumbnailAssetId: assetEntityStub.image.id,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
createdAt: new Date(),
updatedAt: new Date(),
sharedLinks: [],
sharedUsers: [],
}),
@@ -468,8 +471,8 @@ const assetResponse: AssetResponseDto = {
const albumResponse: AlbumResponseDto = {
albumName: 'Test Album',
albumThumbnailAssetId: null,
createdAt: today.toISOString(),
updatedAt: today.toISOString(),
createdAt: today,
updatedAt: today,
id: 'album-123',
ownerId: 'admin_id',
owner: mapUser(userEntityStub.admin),
@@ -645,8 +648,8 @@ export const sharedLinkStub = {
user: userEntityStub.admin,
key: Buffer.from('secret-key', 'utf8'),
type: SharedLinkType.ALBUM,
createdAt: today.toISOString(),
expiresAt: tomorrow.toISOString(),
createdAt: today,
expiresAt: tomorrow,
allowUpload: true,
allowDownload: true,
showExif: true,
@@ -659,8 +662,8 @@ export const sharedLinkStub = {
user: userEntityStub.admin,
key: Buffer.from('secret-key', 'utf8'),
type: SharedLinkType.ALBUM,
createdAt: today.toISOString(),
expiresAt: yesterday.toISOString(),
createdAt: today,
expiresAt: yesterday,
allowUpload: true,
allowDownload: true,
showExif: true,
@@ -672,8 +675,8 @@ export const sharedLinkStub = {
user: userEntityStub.admin,
key: Buffer.from('secret-key', 'utf8'),
type: SharedLinkType.ALBUM,
createdAt: today.toISOString(),
expiresAt: tomorrow.toISOString(),
createdAt: today,
expiresAt: tomorrow,
allowUpload: false,
allowDownload: false,
showExif: true,
@@ -683,8 +686,8 @@ export const sharedLinkStub = {
ownerId: authStub.admin.id,
owner: userEntityStub.admin,
albumName: 'Test Album',
createdAt: today.toISOString(),
updatedAt: today.toISOString(),
createdAt: today,
updatedAt: today,
albumThumbnailAsset: null,
albumThumbnailAssetId: null,
sharedUsers: [],
@@ -763,9 +766,9 @@ export const sharedLinkResponseStub = {
allowDownload: true,
allowUpload: true,
assets: [],
createdAt: today.toISOString(),
createdAt: today,
description: undefined,
expiresAt: tomorrow.toISOString(),
expiresAt: tomorrow,
id: '123',
key: '7365637265742d6b6579',
showExif: true,
@@ -777,9 +780,9 @@ export const sharedLinkResponseStub = {
allowDownload: true,
allowUpload: true,
assets: [],
createdAt: today.toISOString(),
createdAt: today,
description: undefined,
expiresAt: yesterday.toISOString(),
expiresAt: yesterday,
id: '123',
key: '7365637265742d6b6579',
showExif: true,
@@ -791,8 +794,8 @@ export const sharedLinkResponseStub = {
userId: 'admin_id',
key: '7365637265742d6b6579',
type: SharedLinkType.ALBUM,
createdAt: today.toISOString(),
expiresAt: tomorrow.toISOString(),
createdAt: today,
expiresAt: tomorrow,
description: undefined,
allowUpload: false,
allowDownload: false,
@@ -805,8 +808,8 @@ export const sharedLinkResponseStub = {
userId: 'admin_id',
key: '7365637265742d6b6579',
type: SharedLinkType.ALBUM,
createdAt: today.toISOString(),
expiresAt: tomorrow.toISOString(),
createdAt: today,
expiresAt: tomorrow,
description: undefined,
allowUpload: false,
allowDownload: false,