refactor(server): mime types (#3197)

* refactor(server): mime type check

* chore: open api

* chore: remove duplicate test
This commit is contained in:
Jason Rasmussen
2023-07-10 13:56:45 -04:00
committed by GitHub
parent 785f61ba70
commit 6180828ed2
26 changed files with 287 additions and 324 deletions

View File

@@ -190,13 +190,11 @@ export const userEntityStub = {
export const fileStub = {
livePhotoStill: Object.freeze({
originalPath: 'fake_path/asset_1.jpeg',
mimeType: 'image/jpg',
checksum: Buffer.from('file hash', 'utf8'),
originalName: 'asset_1.jpeg',
}),
livePhotoMotion: Object.freeze({
originalPath: 'fake_path/asset_1.mp4',
mimeType: 'image/jpeg',
checksum: Buffer.from('live photo file hash', 'utf8'),
originalName: 'asset_1.mp4',
}),
@@ -221,7 +219,6 @@ export const assetEntityStub = {
encodedVideoPath: null,
createdAt: new Date('2023-02-23T05:06:29.716Z'),
updatedAt: new Date('2023-02-23T05:06:29.716Z'),
mimeType: null,
isFavorite: true,
isArchived: false,
duration: null,
@@ -251,7 +248,6 @@ export const assetEntityStub = {
encodedVideoPath: null,
createdAt: new Date('2023-02-23T05:06:29.716Z'),
updatedAt: new Date('2023-02-23T05:06:29.716Z'),
mimeType: null,
isFavorite: true,
isArchived: false,
duration: null,
@@ -285,7 +281,6 @@ export const assetEntityStub = {
encodedVideoPath: null,
createdAt: new Date('2023-02-23T05:06:29.716Z'),
updatedAt: new Date('2023-02-23T05:06:29.716Z'),
mimeType: null,
isFavorite: true,
isArchived: false,
isReadOnly: false,
@@ -307,8 +302,8 @@ export const assetEntityStub = {
owner: userEntityStub.user1,
ownerId: 'user-id',
deviceId: 'device-id',
originalPath: '/original/path.ext',
resizePath: '/uploads/user-id/thumbs/path.ext',
originalPath: '/original/path.jpg',
resizePath: '/uploads/user-id/thumbs/path.jpg',
checksum: Buffer.from('file hash', 'utf8'),
type: AssetType.IMAGE,
webpPath: '/uploads/user-id/webp/path.ext',
@@ -316,7 +311,6 @@ export const assetEntityStub = {
encodedVideoPath: null,
createdAt: new Date('2023-02-23T05:06:29.716Z'),
updatedAt: new Date('2023-02-23T05:06:29.716Z'),
mimeType: null,
isFavorite: true,
isArchived: false,
isReadOnly: false,
@@ -326,7 +320,7 @@ export const assetEntityStub = {
livePhotoVideoId: null,
tags: [],
sharedLinks: [],
originalFileName: 'asset-id.ext',
originalFileName: 'asset-id.jpg',
faces: [],
sidecarPath: null,
exifInfo: {
@@ -351,7 +345,6 @@ export const assetEntityStub = {
encodedVideoPath: null,
createdAt: new Date('2023-02-23T05:06:29.716Z'),
updatedAt: new Date('2023-02-23T05:06:29.716Z'),
mimeType: null,
isFavorite: true,
isArchived: false,
isReadOnly: false,
@@ -412,7 +405,6 @@ export const assetEntityStub = {
encodedVideoPath: null,
createdAt: new Date('2023-02-23T05:06:29.716Z'),
updatedAt: new Date('2023-02-23T05:06:29.716Z'),
mimeType: null,
isFavorite: false,
isArchived: false,
isReadOnly: false,
@@ -447,7 +439,6 @@ export const assetEntityStub = {
encodedVideoPath: null,
createdAt: new Date('2023-02-23T05:06:29.716Z'),
updatedAt: new Date('2023-02-23T05:06:29.716Z'),
mimeType: null,
isFavorite: true,
isArchived: false,
isReadOnly: false,
@@ -621,7 +612,6 @@ const assetResponse: AssetResponseDto = {
updatedAt: today,
isFavorite: false,
isArchived: false,
mimeType: 'image/jpeg',
smartInfo: {
tags: [],
objects: ['a', 'b', 'c'],
@@ -909,7 +899,6 @@ export const sharedLinkStub = {
isFavorite: false,
isArchived: false,
isReadOnly: false,
mimeType: 'image/jpeg',
smartInfo: {
assetId: 'id_1',
tags: [],
@@ -1136,7 +1125,7 @@ export const personStub = {
ownerId: userEntityStub.admin.id,
owner: userEntityStub.admin,
name: '',
thumbnailPath: '/path/to/thumbnail',
thumbnailPath: '/path/to/thumbnail.jpg',
faces: [],
}),
withName: Object.freeze<PersonEntity>({
@@ -1146,7 +1135,7 @@ export const personStub = {
ownerId: userEntityStub.admin.id,
owner: userEntityStub.admin,
name: 'Person 1',
thumbnailPath: '/path/to/thumbnail',
thumbnailPath: '/path/to/thumbnail.jpg',
faces: [],
}),
noThumbnail: Object.freeze<PersonEntity>({
@@ -1166,7 +1155,7 @@ export const personStub = {
ownerId: userEntityStub.admin.id,
owner: userEntityStub.admin,
name: '',
thumbnailPath: '/new/path/to/thumbnail',
thumbnailPath: '/new/path/to/thumbnail.jpg',
faces: [],
}),
};