2026-01-05 10:03:35 -05:00
|
|
|
import { MapAsset } from 'src/dtos/asset-response.dto';
|
2026-03-11 16:17:31 +01:00
|
|
|
import { SharedLinkType } from 'src/enum';
|
2026-02-11 17:49:00 +01:00
|
|
|
import { AssetFactory } from 'test/factories/asset.factory';
|
2024-03-20 19:32:04 +01:00
|
|
|
import { authStub } from 'test/fixtures/auth.stub';
|
|
|
|
|
import { userStub } from 'test/fixtures/user.stub';
|
2023-07-31 21:28:07 -04:00
|
|
|
|
|
|
|
|
const today = new Date();
|
|
|
|
|
const tomorrow = new Date();
|
|
|
|
|
const yesterday = new Date();
|
|
|
|
|
tomorrow.setDate(today.getDate() + 1);
|
|
|
|
|
yesterday.setDate(yesterday.getDate() - 1);
|
|
|
|
|
|
|
|
|
|
const sharedLinkBytes = Buffer.from(
|
|
|
|
|
'2c2b646895f84753bff43fb696ad124f3b0faf2a0bd547406f26fa4a76b5c71990092baa536275654b2ab7a191fb21a6d6cd',
|
|
|
|
|
'hex',
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export const sharedLinkStub = {
|
|
|
|
|
individual: Object.freeze({
|
|
|
|
|
id: '123',
|
2023-12-09 23:34:12 -05:00
|
|
|
userId: authStub.admin.user.id,
|
2023-07-31 21:28:07 -04:00
|
|
|
key: sharedLinkBytes,
|
2025-07-15 14:50:13 -04:00
|
|
|
type: SharedLinkType.Individual,
|
2023-07-31 21:28:07 -04:00
|
|
|
createdAt: today,
|
|
|
|
|
expiresAt: tomorrow,
|
|
|
|
|
allowUpload: true,
|
|
|
|
|
allowDownload: true,
|
|
|
|
|
showExif: true,
|
2025-04-18 23:10:34 +02:00
|
|
|
albumId: null,
|
|
|
|
|
album: null,
|
2023-07-31 21:28:07 -04:00
|
|
|
description: null,
|
2026-02-11 17:49:00 +01:00
|
|
|
assets: [AssetFactory.create()],
|
2025-04-16 20:08:49 +02:00
|
|
|
password: 'password',
|
2025-07-28 14:16:55 -04:00
|
|
|
slug: null,
|
2025-04-18 23:10:34 +02:00
|
|
|
}),
|
2023-07-31 21:28:07 -04:00
|
|
|
valid: Object.freeze({
|
|
|
|
|
id: '123',
|
2023-12-09 23:34:12 -05:00
|
|
|
userId: authStub.admin.user.id,
|
2023-07-31 21:28:07 -04:00
|
|
|
user: userStub.admin,
|
|
|
|
|
key: sharedLinkBytes,
|
2025-07-15 14:50:13 -04:00
|
|
|
type: SharedLinkType.Album,
|
2023-07-31 21:28:07 -04:00
|
|
|
createdAt: today,
|
|
|
|
|
expiresAt: tomorrow,
|
|
|
|
|
allowUpload: true,
|
|
|
|
|
allowDownload: true,
|
|
|
|
|
showExif: true,
|
|
|
|
|
albumId: null,
|
|
|
|
|
description: null,
|
2023-10-29 09:35:38 +08:00
|
|
|
password: null,
|
2025-04-18 23:10:34 +02:00
|
|
|
assets: [] as MapAsset[],
|
|
|
|
|
album: null,
|
2025-07-28 14:16:55 -04:00
|
|
|
slug: null,
|
2025-04-18 23:10:34 +02:00
|
|
|
}),
|
2023-07-31 21:28:07 -04:00
|
|
|
expired: Object.freeze({
|
|
|
|
|
id: '123',
|
2023-12-09 23:34:12 -05:00
|
|
|
userId: authStub.admin.user.id,
|
2023-07-31 21:28:07 -04:00
|
|
|
user: userStub.admin,
|
|
|
|
|
key: sharedLinkBytes,
|
2025-07-15 14:50:13 -04:00
|
|
|
type: SharedLinkType.Album,
|
2023-07-31 21:28:07 -04:00
|
|
|
createdAt: today,
|
|
|
|
|
expiresAt: yesterday,
|
|
|
|
|
allowUpload: true,
|
|
|
|
|
allowDownload: true,
|
|
|
|
|
showExif: true,
|
|
|
|
|
description: null,
|
2023-10-29 09:35:38 +08:00
|
|
|
password: null,
|
2023-07-31 21:28:07 -04:00
|
|
|
albumId: null,
|
2025-04-18 23:10:34 +02:00
|
|
|
assets: [] as MapAsset[],
|
|
|
|
|
album: null,
|
2025-07-28 14:16:55 -04:00
|
|
|
slug: null,
|
2025-04-18 23:10:34 +02:00
|
|
|
}),
|
|
|
|
|
passwordRequired: Object.freeze({
|
2023-10-29 09:35:38 +08:00
|
|
|
id: '123',
|
2023-12-09 23:34:12 -05:00
|
|
|
userId: authStub.admin.user.id,
|
2023-10-29 09:35:38 +08:00
|
|
|
key: sharedLinkBytes,
|
2025-07-15 14:50:13 -04:00
|
|
|
type: SharedLinkType.Album,
|
2023-10-29 09:35:38 +08:00
|
|
|
createdAt: today,
|
|
|
|
|
expiresAt: tomorrow,
|
|
|
|
|
allowUpload: true,
|
|
|
|
|
allowDownload: true,
|
|
|
|
|
showExif: true,
|
2025-07-28 14:16:55 -04:00
|
|
|
slug: null,
|
2023-10-29 09:35:38 +08:00
|
|
|
description: null,
|
|
|
|
|
password: 'password',
|
|
|
|
|
assets: [],
|
|
|
|
|
albumId: null,
|
2025-04-18 23:10:34 +02:00
|
|
|
album: null,
|
2023-10-29 09:35:38 +08:00
|
|
|
}),
|
2023-07-31 21:28:07 -04:00
|
|
|
};
|