updated getBuilder call

This commit is contained in:
mertalev 2023-11-18 00:28:49 -05:00
parent 6ed43b2778
commit 7e65dcabc1
No known key found for this signature in database
GPG key ID: 9181CD92C0A1C5E3

View file

@ -695,7 +695,7 @@ export class AssetRepository implements IAssetRepository {
} }
async getAssetIdByCity( async getAssetIdByCity(
userId: string, ownerId: string,
{ minAssetsPerField, maxFields }: AssetExploreFieldOptions, { minAssetsPerField, maxFields }: AssetExploreFieldOptions,
): Promise<SearchExploreItem<string>> { ): Promise<SearchExploreItem<string>> {
const cte = this.exifRepository const cte = this.exifRepository
@ -706,7 +706,7 @@ export class AssetRepository implements IAssetRepository {
.orderBy('random()') .orderBy('random()')
.limit(maxFields); .limit(maxFields);
const items = await this.getBuilder({ userId, exifInfo: false, assetType: AssetType.IMAGE, isArchived: false }) const items = await this.getBuilder({ userIds: [ownerId], exifInfo: false, assetType: AssetType.IMAGE, isArchived: false })
.select('c.city', 'value') .select('c.city', 'value')
.addSelect('asset.id', 'data') .addSelect('asset.id', 'data')
.distinctOn(['c.city']) .distinctOn(['c.city'])
@ -720,7 +720,7 @@ export class AssetRepository implements IAssetRepository {
} }
async getAssetIdByTag( async getAssetIdByTag(
userId: string, ownerId: string,
{ minAssetsPerField, maxFields }: AssetExploreFieldOptions, { minAssetsPerField, maxFields }: AssetExploreFieldOptions,
): Promise<SearchExploreItem<string>> { ): Promise<SearchExploreItem<string>> {
const cte = this.smartInfoRepository const cte = this.smartInfoRepository
@ -731,7 +731,7 @@ export class AssetRepository implements IAssetRepository {
.orderBy('random()') .orderBy('random()')
.limit(maxFields); .limit(maxFields);
const items = await this.getBuilder({ userId, exifInfo: false, assetType: AssetType.IMAGE, isArchived: false }) const items = await this.getBuilder({ userIds: [ownerId], exifInfo: false, assetType: AssetType.IMAGE, isArchived: false })
.select('unnest(si.tags)', 'value') .select('unnest(si.tags)', 'value')
.addSelect('asset.id', 'data') .addSelect('asset.id', 'data')
.distinctOn(['unnest(si.tags)']) .distinctOn(['unnest(si.tags)'])