1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-04 02:46:47 +01:00

fix(server): Object detection query and get server stats (#1823)

* fix(server): Object detection query has incorrect value

* fix: get stats for user using the wrong property id from response

* chore: update openapi version
This commit is contained in:
Alex 2023-02-21 21:51:04 -06:00 committed by GitHub
parent 24d672a0ff
commit 9ebed3c1b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 9 additions and 10 deletions

BIN
mobile/openapi/README.md generated

Binary file not shown.

View file

@ -80,7 +80,7 @@ export class AssetRepository implements IAssetRepository {
.createQueryBuilder('asset') .createQueryBuilder('asset')
.leftJoinAndSelect('asset.smartInfo', 'si') .leftJoinAndSelect('asset.smartInfo', 'si')
.where('asset.resizePath IS NOT NULL') .where('asset.resizePath IS NOT NULL')
.andWhere('si.id IS NULL') .andWhere('si.assetId IS NULL')
.andWhere('asset.isVisible = true') .andWhere('asset.isVisible = true')
.getMany(); .getMany();
} }

View file

@ -39,7 +39,7 @@ export class ServerInfoService {
assetType: string; assetType: string;
assetCount: string; assetCount: string;
totalSizeInBytes: string; totalSizeInBytes: string;
userId: string; ownerId: string;
}; };
const userStatsQueryResponse: UserStatsQueryResponse[] = await this.assetRepository const userStatsQueryResponse: UserStatsQueryResponse[] = await this.assetRepository
@ -56,9 +56,8 @@ export class ServerInfoService {
const tmpMap = new Map<string, UsageByUserDto>(); const tmpMap = new Map<string, UsageByUserDto>();
const getUsageByUser = (id: string) => tmpMap.get(id) || new UsageByUserDto(id); const getUsageByUser = (id: string) => tmpMap.get(id) || new UsageByUserDto(id);
userStatsQueryResponse.forEach((r) => { userStatsQueryResponse.forEach((r) => {
const usageByUser = getUsageByUser(r.userId); const usageByUser = getUsageByUser(r.ownerId);
usageByUser.photos += r.assetType === 'IMAGE' ? parseInt(r.assetCount) : 0; usageByUser.photos += r.assetType === 'IMAGE' ? parseInt(r.assetCount) : 0;
usageByUser.videos += r.assetType === 'VIDEO' ? parseInt(r.assetCount) : 0; usageByUser.videos += r.assetType === 'VIDEO' ? parseInt(r.assetCount) : 0;
usageByUser.usageRaw += parseInt(r.totalSizeInBytes); usageByUser.usageRaw += parseInt(r.totalSizeInBytes);
@ -68,7 +67,7 @@ export class ServerInfoService {
serverStats.videos += r.assetType === 'VIDEO' ? parseInt(r.assetCount) : 0; serverStats.videos += r.assetType === 'VIDEO' ? parseInt(r.assetCount) : 0;
serverStats.usageRaw += parseInt(r.totalSizeInBytes); serverStats.usageRaw += parseInt(r.totalSizeInBytes);
serverStats.usage = asHumanReadable(serverStats.usageRaw); serverStats.usage = asHumanReadable(serverStats.usageRaw);
tmpMap.set(r.userId, usageByUser); tmpMap.set(r.ownerId, usageByUser);
}); });
serverStats.usageByUser = Array.from(tmpMap.values()); serverStats.usageByUser = Array.from(tmpMap.values());

View file

@ -4,7 +4,7 @@
* Immich * Immich
* Immich API * Immich API
* *
* The version of the OpenAPI document: 1.47.3 * The version of the OpenAPI document: 1.48.0
* *
* *
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).

View file

@ -4,7 +4,7 @@
* Immich * Immich
* Immich API * Immich API
* *
* The version of the OpenAPI document: 1.47.3 * The version of the OpenAPI document: 1.48.0
* *
* *
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).

View file

@ -4,7 +4,7 @@
* Immich * Immich
* Immich API * Immich API
* *
* The version of the OpenAPI document: 1.47.3 * The version of the OpenAPI document: 1.48.0
* *
* *
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).

View file

@ -4,7 +4,7 @@
* Immich * Immich
* Immich API * Immich API
* *
* The version of the OpenAPI document: 1.47.3 * The version of the OpenAPI document: 1.48.0
* *
* *
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).

View file

@ -4,7 +4,7 @@
* Immich * Immich
* Immich API * Immich API
* *
* The version of the OpenAPI document: 1.47.3 * The version of the OpenAPI document: 1.48.0
* *
* *
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).