Adapt web client to consume new server response format
This commit is contained in:
@@ -2,7 +2,7 @@ import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
import { IsEnum, IsInt, IsString, Min } from 'class-validator';
|
||||
import { AssetOrder } from 'src/enum';
|
||||
import { TimeBucketAssets, TimelineStack } from 'src/services/timeline.service.types';
|
||||
import { AssetDescription, TimeBucketAssets, TimelineStack } from 'src/services/timeline.service.types';
|
||||
import { Optional, ValidateBoolean, ValidateUUID } from 'src/validation';
|
||||
|
||||
export class TimeBucketDto {
|
||||
@@ -64,6 +64,13 @@ export class TimelineStackResponseDto implements TimelineStack {
|
||||
assetCount!: number;
|
||||
}
|
||||
|
||||
export class TimelineAssetDescriptionDto implements AssetDescription {
|
||||
@ApiProperty()
|
||||
city!: string | null;
|
||||
@ApiProperty()
|
||||
country!: string | null;
|
||||
}
|
||||
|
||||
export class TimeBucketAssetResponseDto implements TimeBucketAssets {
|
||||
@ApiProperty({ type: [String] })
|
||||
id: string[] = [];
|
||||
@@ -154,6 +161,9 @@ export class TimeBucketAssetResponseDto implements TimeBucketAssets {
|
||||
},
|
||||
})
|
||||
livePhotoVideoId: (string | number)[] = [];
|
||||
|
||||
@ApiProperty()
|
||||
description: TimelineAssetDescriptionDto[] = [];
|
||||
}
|
||||
|
||||
export class TimeBucketsResponseDto {
|
||||
|
||||
@@ -701,7 +701,14 @@ export class AssetRepository {
|
||||
'livePhotoVideoId',
|
||||
])
|
||||
.leftJoin('exif', 'assets.id', 'exif.assetId')
|
||||
.select(['exif.exifImageHeight as height', 'exifImageWidth as width', 'exif.orientation', 'exif.projectionType'])
|
||||
.select([
|
||||
'exif.exifImageHeight as height',
|
||||
'exifImageWidth as width',
|
||||
'exif.orientation',
|
||||
'exif.projectionType',
|
||||
'exif.city as city',
|
||||
'exif.country as country',
|
||||
])
|
||||
.$if(!!options.albumId, (qb) =>
|
||||
qb
|
||||
.innerJoin('albums_assets_assets', 'albums_assets_assets.assetsId', 'assets.id')
|
||||
|
||||
@@ -58,6 +58,7 @@ export class TimelineService extends BaseService {
|
||||
duration: [],
|
||||
projectionType: [],
|
||||
livePhotoVideoId: [],
|
||||
description: [],
|
||||
};
|
||||
for (const item of items) {
|
||||
let width = item.width!;
|
||||
@@ -82,6 +83,10 @@ export class TimelineService extends BaseService {
|
||||
bucketAssets.livePhotoVideoId.push(item.livePhotoVideoId || 0);
|
||||
bucketAssets.isImage.push(item.type === AssetType.IMAGE ? 1 : 0);
|
||||
bucketAssets.isVideo.push(item.type === AssetType.VIDEO ? 1 : 0);
|
||||
bucketAssets.description.push({
|
||||
city: item.city,
|
||||
country: item.country,
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -4,6 +4,11 @@ export type TimelineStack = {
|
||||
assetCount: number;
|
||||
};
|
||||
|
||||
export type AssetDescription = {
|
||||
city: string | null;
|
||||
country: string | null;
|
||||
};
|
||||
|
||||
export type TimeBucketAssets = {
|
||||
id: string[];
|
||||
ownerId: string[];
|
||||
@@ -19,4 +24,5 @@ export type TimeBucketAssets = {
|
||||
duration: (string | number)[];
|
||||
projectionType: (string | number)[];
|
||||
livePhotoVideoId: (string | number)[];
|
||||
description: AssetDescription[];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user