feat: manual stack assets (#4198)

This commit is contained in:
shenlong
2023-10-22 02:38:07 +00:00
committed by GitHub
parent 5ead4af2dc
commit cf08ac7538
59 changed files with 2190 additions and 138 deletions

View File

@@ -109,6 +109,7 @@ export class AssetRepository implements IAssetRepository {
faces: {
person: true,
},
stack: true,
},
// We are specifically asking for this asset. Return it even if it is soft deleted
withDeleted: true,
@@ -131,6 +132,7 @@ export class AssetRepository implements IAssetRepository {
relations: {
exifInfo: true,
tags: true,
stack: true,
},
skip: dto.skip || 0,
order: {

View File

@@ -196,7 +196,7 @@ export class AssetService {
const includeMetadata = this.getExifPermission(authUser);
const asset = await this._assetRepository.getById(assetId);
if (includeMetadata) {
const data = mapAsset(asset);
const data = mapAsset(asset, { withStack: true });
if (data.ownerId !== authUser.id) {
data.people = [];
@@ -208,7 +208,7 @@ export class AssetService {
return data;
} else {
return mapAsset(asset, true);
return mapAsset(asset, { stripMetadata: true, withStack: true });
}
}

View File

@@ -21,6 +21,7 @@ import {
TimeBucketResponseDto,
TrashAction,
UpdateAssetDto as UpdateDto,
UpdateStackParentDto,
} from '@app/domain';
import {
Body,
@@ -137,6 +138,12 @@ export class AssetController {
return this.service.handleTrashAction(authUser, TrashAction.RESTORE_ALL);
}
@Put('stack/parent')
@HttpCode(HttpStatus.OK)
updateStackParent(@AuthUser() authUser: AuthUserDto, @Body() dto: UpdateStackParentDto): Promise<void> {
return this.service.updateStackParent(authUser, dto);
}
@Put(':id')
updateAsset(
@AuthUser() authUser: AuthUserDto,