View assets detail and download operation (#198)

* Fixed not displaying default user profile picture

* Added buttons to close viewer and micro-interaction for navigating assets left, right

* Add additional buttons to the control bar

* Display EXIF info

* Added map to detail info

* Handle user input keyboard

* Fixed incorrect file name when downloading multiple files

* Implemented download panel
This commit is contained in:
Alex
2022-06-03 11:04:30 -05:00
committed by GitHub
parent 6924aa5eb1
commit 53c3c916a6
19 changed files with 798 additions and 100 deletions

View File

@@ -61,13 +61,17 @@ export class AssetService {
return res;
}
public async getAllAssetsNoPagination(authUser: AuthUserDto) {
public async getAllAssets(authUser: AuthUserDto) {
try {
return await this.assetRepository
.createQueryBuilder('a')
.where('a."userId" = :userId', { userId: authUser.id })
.orderBy('a."createdAt"::date', 'DESC')
.getMany();
return await this.assetRepository.find({
where: {
userId: authUser.id
},
relations: ['exifInfo'],
order: {
createdAt: 'DESC'
}
})
} catch (e) {
Logger.error(e, 'getAllAssets');
}
@@ -100,8 +104,18 @@ export class AssetService {
const asset = await this.findOne(query.did, query.aid);
if (query.isThumb === 'false' || !query.isThumb) {
const { size } = await fileInfo(asset.originalPath);
res.set({
'Content-Type': asset.mimeType,
'Content-Length': size,
});
file = createReadStream(asset.originalPath);
} else {
const { size } = await fileInfo(asset.resizePath);
res.set({
'Content-Type': 'image/jpeg',
'Content-Length': size,
});
file = createReadStream(asset.resizePath);
}