feat(web): use time buckets of person detail page (3) (#3557)

* feat: add personId to time bucket endpoints

* chore: open api

* feat(web): time bucket on person detail page
This commit is contained in:
Jason Rasmussen 2023-08-05 09:58:52 -04:00 committed by GitHub
parent 68b5202730
commit ff32506c5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 402 additions and 316 deletions

View file

@ -1684,6 +1684,15 @@
"type": "string"
}
},
{
"name": "personId",
"required": false,
"in": "query",
"schema": {
"format": "uuid",
"type": "string"
}
},
{
"name": "isArchived",
"required": false,
@ -1787,6 +1796,15 @@
"type": "string"
}
},
{
"name": "personId",
"required": false,
"in": "query",
"schema": {
"format": "uuid",
"type": "string"
}
},
{
"name": "isArchived",
"required": false,

View file

@ -57,6 +57,7 @@ export interface TimeBucketOptions {
isArchived?: boolean;
isFavorite?: boolean;
albumId?: string;
personId?: string;
}
export interface TimeBucketItem {

View file

@ -16,6 +16,9 @@ export class TimeBucketDto {
@ValidateUUID({ optional: true })
albumId?: string;
@ValidateUUID({ optional: true })
personId?: string;
@IsOptional()
@IsBoolean()
@Transform(toBoolean)

View file

@ -386,7 +386,7 @@ export class AssetRepository implements IAssetRepository {
}
private getBuilder(userId: string, options: TimeBucketOptions) {
const { isArchived, isFavorite, albumId } = options;
const { isArchived, isFavorite, albumId, personId } = options;
let builder = this.repository
.createQueryBuilder('asset')
@ -406,6 +406,13 @@ export class AssetRepository implements IAssetRepository {
builder = builder.andWhere('asset.isFavorite = :isFavorite', { isFavorite });
}
if (personId !== undefined) {
builder = builder
.innerJoin('asset.faces', 'faces')
.innerJoin('faces.person', 'person')
.andWhere('person.id = :personId', { personId });
}
return builder;
}
}