refactor(server, web): create shared link (#2879)

* refactor: shared links

* chore: open api

* fix: tsc error
This commit is contained in:
Jason Rasmussen
2023-06-20 21:08:43 -04:00
committed by GitHub
parent 746ca5d5ed
commit 868f629f32
61 changed files with 2150 additions and 2642 deletions

View File

@@ -777,6 +777,21 @@ export const loginResponseStub = {
};
export const sharedLinkStub = {
individual: Object.freeze({
id: '123',
userId: authStub.admin.id,
user: userEntityStub.admin,
key: sharedLinkBytes,
type: SharedLinkType.INDIVIDUAL,
createdAt: today,
expiresAt: tomorrow,
allowUpload: true,
allowDownload: true,
showExif: true,
album: undefined,
description: null,
assets: [assetEntityStub.image],
} as SharedLinkEntity),
valid: Object.freeze({
id: '123',
userId: authStub.admin.id,
@@ -789,6 +804,8 @@ export const sharedLinkStub = {
allowDownload: true,
showExif: true,
album: undefined,
albumId: null,
description: null,
assets: [],
} as SharedLinkEntity),
expired: Object.freeze({
@@ -802,6 +819,8 @@ export const sharedLinkStub = {
allowUpload: true,
allowDownload: true,
showExif: true,
description: null,
albumId: null,
assets: [],
} as SharedLinkEntity),
readonlyNoExif: Object.freeze<SharedLinkEntity>({
@@ -815,7 +834,9 @@ export const sharedLinkStub = {
allowUpload: false,
allowDownload: false,
showExif: false,
description: null,
assets: [],
albumId: 'album-123',
album: {
id: 'album-123',
ownerId: authStub.admin.id,
@@ -903,7 +924,7 @@ export const sharedLinkResponseStub = {
allowUpload: true,
assets: [],
createdAt: today,
description: undefined,
description: null,
expiresAt: tomorrow,
id: '123',
key: sharedLinkBytes.toString('base64url'),
@@ -917,7 +938,7 @@ export const sharedLinkResponseStub = {
allowUpload: true,
assets: [],
createdAt: today,
description: undefined,
description: null,
expiresAt: yesterday,
id: '123',
key: sharedLinkBytes.toString('base64url'),
@@ -932,7 +953,7 @@ export const sharedLinkResponseStub = {
type: SharedLinkType.ALBUM,
createdAt: today,
expiresAt: tomorrow,
description: undefined,
description: null,
allowUpload: false,
allowDownload: false,
showExif: true,
@@ -946,7 +967,7 @@ export const sharedLinkResponseStub = {
type: SharedLinkType.ALBUM,
createdAt: today,
expiresAt: tomorrow,
description: undefined,
description: null,
allowUpload: false,
allowDownload: false,
showExif: false,

View File

@@ -3,9 +3,12 @@ import { IAccessRepository } from '@app/domain';
export const newAccessRepositoryMock = (): jest.Mocked<IAccessRepository> => {
return {
hasPartnerAccess: jest.fn(),
hasAlbumAssetAccess: jest.fn(),
hasOwnerAssetAccess: jest.fn(),
hasPartnerAssetAccess: jest.fn(),
hasSharedLinkAssetAccess: jest.fn(),
hasAlbumOwnerAccess: jest.fn(),
};
};