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:
parent
24d672a0ff
commit
9ebed3c1b4
8 changed files with 9 additions and 10 deletions
BIN
mobile/openapi/README.md
generated
BIN
mobile/openapi/README.md
generated
Binary file not shown.
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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());
|
||||||
|
|
2
web/src/api/open-api/api.ts
generated
2
web/src/api/open-api/api.ts
generated
|
@ -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).
|
||||||
|
|
2
web/src/api/open-api/base.ts
generated
2
web/src/api/open-api/base.ts
generated
|
@ -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).
|
||||||
|
|
2
web/src/api/open-api/common.ts
generated
2
web/src/api/open-api/common.ts
generated
|
@ -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).
|
||||||
|
|
2
web/src/api/open-api/configuration.ts
generated
2
web/src/api/open-api/configuration.ts
generated
|
@ -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).
|
||||||
|
|
2
web/src/api/open-api/index.ts
generated
2
web/src/api/open-api/index.ts
generated
|
@ -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).
|
||||||
|
|
Loading…
Reference in a new issue