mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
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:
parent
68b5202730
commit
ff32506c5e
19 changed files with 402 additions and 316 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ export interface TimeBucketOptions {
|
|||
isArchived?: boolean;
|
||||
isFavorite?: boolean;
|
||||
albumId?: string;
|
||||
personId?: string;
|
||||
}
|
||||
|
||||
export interface TimeBucketItem {
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ export class TimeBucketDto {
|
|||
@ValidateUUID({ optional: true })
|
||||
albumId?: string;
|
||||
|
||||
@ValidateUUID({ optional: true })
|
||||
personId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
@Transform(toBoolean)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue