From 9ebed3c1b421d2108981159905a83c9728779fba Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 21 Feb 2023 21:51:04 -0600 Subject: [PATCH] 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 --- mobile/openapi/README.md | 2 +- server/apps/immich/src/api-v1/asset/asset-repository.ts | 2 +- .../immich/src/api-v1/server-info/server-info.service.ts | 7 +++---- web/src/api/open-api/api.ts | 2 +- web/src/api/open-api/base.ts | 2 +- web/src/api/open-api/common.ts | 2 +- web/src/api/open-api/configuration.ts | 2 +- web/src/api/open-api/index.ts | 2 +- 8 files changed, 10 insertions(+), 11 deletions(-) diff --git a/mobile/openapi/README.md b/mobile/openapi/README.md index 5801f0d8b6..6aebfa3066 100644 --- a/mobile/openapi/README.md +++ b/mobile/openapi/README.md @@ -3,7 +3,7 @@ Immich API This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 1.47.3 +- API version: 1.48.0 - Build package: org.openapitools.codegen.languages.DartClientCodegen ## Requirements diff --git a/server/apps/immich/src/api-v1/asset/asset-repository.ts b/server/apps/immich/src/api-v1/asset/asset-repository.ts index 815264afb8..9f4ea7da49 100644 --- a/server/apps/immich/src/api-v1/asset/asset-repository.ts +++ b/server/apps/immich/src/api-v1/asset/asset-repository.ts @@ -80,7 +80,7 @@ export class AssetRepository implements IAssetRepository { .createQueryBuilder('asset') .leftJoinAndSelect('asset.smartInfo', 'si') .where('asset.resizePath IS NOT NULL') - .andWhere('si.id IS NULL') + .andWhere('si.assetId IS NULL') .andWhere('asset.isVisible = true') .getMany(); } diff --git a/server/apps/immich/src/api-v1/server-info/server-info.service.ts b/server/apps/immich/src/api-v1/server-info/server-info.service.ts index fbbe806da1..243d880dfe 100644 --- a/server/apps/immich/src/api-v1/server-info/server-info.service.ts +++ b/server/apps/immich/src/api-v1/server-info/server-info.service.ts @@ -39,7 +39,7 @@ export class ServerInfoService { assetType: string; assetCount: string; totalSizeInBytes: string; - userId: string; + ownerId: string; }; const userStatsQueryResponse: UserStatsQueryResponse[] = await this.assetRepository @@ -56,9 +56,8 @@ export class ServerInfoService { const tmpMap = new Map(); const getUsageByUser = (id: string) => tmpMap.get(id) || new UsageByUserDto(id); - userStatsQueryResponse.forEach((r) => { - const usageByUser = getUsageByUser(r.userId); + const usageByUser = getUsageByUser(r.ownerId); usageByUser.photos += r.assetType === 'IMAGE' ? parseInt(r.assetCount) : 0; usageByUser.videos += r.assetType === 'VIDEO' ? parseInt(r.assetCount) : 0; usageByUser.usageRaw += parseInt(r.totalSizeInBytes); @@ -68,7 +67,7 @@ export class ServerInfoService { serverStats.videos += r.assetType === 'VIDEO' ? parseInt(r.assetCount) : 0; serverStats.usageRaw += parseInt(r.totalSizeInBytes); serverStats.usage = asHumanReadable(serverStats.usageRaw); - tmpMap.set(r.userId, usageByUser); + tmpMap.set(r.ownerId, usageByUser); }); serverStats.usageByUser = Array.from(tmpMap.values()); diff --git a/web/src/api/open-api/api.ts b/web/src/api/open-api/api.ts index ad6f206418..dba10a603e 100644 --- a/web/src/api/open-api/api.ts +++ b/web/src/api/open-api/api.ts @@ -4,7 +4,7 @@ * Immich * 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). diff --git a/web/src/api/open-api/base.ts b/web/src/api/open-api/base.ts index 65aa2e2841..2cfb355b1e 100644 --- a/web/src/api/open-api/base.ts +++ b/web/src/api/open-api/base.ts @@ -4,7 +4,7 @@ * Immich * 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). diff --git a/web/src/api/open-api/common.ts b/web/src/api/open-api/common.ts index 8d73891c26..aa11231c0e 100644 --- a/web/src/api/open-api/common.ts +++ b/web/src/api/open-api/common.ts @@ -4,7 +4,7 @@ * Immich * 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). diff --git a/web/src/api/open-api/configuration.ts b/web/src/api/open-api/configuration.ts index 376741d5b8..517da032bb 100644 --- a/web/src/api/open-api/configuration.ts +++ b/web/src/api/open-api/configuration.ts @@ -4,7 +4,7 @@ * Immich * 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). diff --git a/web/src/api/open-api/index.ts b/web/src/api/open-api/index.ts index c05c360ea8..04666208cb 100644 --- a/web/src/api/open-api/index.ts +++ b/web/src/api/open-api/index.ts @@ -4,7 +4,7 @@ * Immich * 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).