chore(server) Add user FK to album entity (#1569)

This commit is contained in:
Alex
2023-02-06 20:47:06 -06:00
committed by GitHub
parent ac39ebddc0
commit 3cc4af5947
14 changed files with 173 additions and 96 deletions

View File

@@ -13,7 +13,7 @@ export class AlbumResponseDto {
shared!: boolean;
sharedUsers!: UserResponseDto[];
assets!: AssetResponseDto[];
owner?: UserResponseDto;
@ApiProperty({ type: 'integer' })
assetCount!: number;
}
@@ -27,6 +27,7 @@ export function mapAlbum(entity: AlbumEntity): AlbumResponseDto {
sharedUsers.push(user);
}
});
return {
albumName: entity.albumName,
albumThumbnailAssetId: entity.albumThumbnailAssetId,
@@ -34,6 +35,7 @@ export function mapAlbum(entity: AlbumEntity): AlbumResponseDto {
updatedAt: entity.updatedAt,
id: entity.id,
ownerId: entity.ownerId,
owner: entity.owner ? mapUser(entity.owner) : undefined,
sharedUsers,
shared: sharedUsers.length > 0 || entity.sharedLinks?.length > 0,
assets: entity.assets?.map((assetAlbum) => mapAsset(assetAlbum.assetInfo)) || [],
@@ -50,6 +52,7 @@ export function mapAlbumExcludeAssetInfo(entity: AlbumEntity): AlbumResponseDto
sharedUsers.push(user);
}
});
return {
albumName: entity.albumName,
albumThumbnailAssetId: entity.albumThumbnailAssetId,
@@ -57,6 +60,7 @@ export function mapAlbumExcludeAssetInfo(entity: AlbumEntity): AlbumResponseDto
updatedAt: entity.updatedAt,
id: entity.id,
ownerId: entity.ownerId,
owner: entity.owner ? mapUser(entity.owner) : undefined,
sharedUsers,
shared: sharedUsers.length > 0 || entity.sharedLinks?.length > 0,
assets: [],