feat: people management (#31620)

Co-authored-by: Jason Rasmussen <jason@rasm.me>
Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
Daniel Dietzler
2026-09-28 21:29:15 +02:00
committed by GitHub
co-authored by Jason Rasmussen shenlong-tanwen
parent 0f179b9914
commit c12d5e6d35
67 changed files with 4812 additions and 582 deletions
+146 -8
View File
@@ -1216,6 +1216,27 @@ export type ExifResponseDto = {
/** Time zone */
timeZone?: string | null;
};
export type PersonOtherResponseDto = {
birthDate: string | null;
name: string;
role: PersonUserRole;
sharedById: string;
};
export type PeopleUserResponseDto = {
avatarColor: UserAvatarColor;
/** User email */
email: string;
/** User ID */
id: string;
/** User name */
name: string;
/** Profile change date */
profileChangedAt: string;
/** Profile image path */
profileImagePath: string;
/** Access role */
role: PersonUserRole;
};
export type PersonResponseDto = {
/** Person date of birth */
birthDate: string | null;
@@ -1229,6 +1250,11 @@ export type PersonResponseDto = {
isHidden: boolean;
/** Person name */
name: string;
otherPeople: PersonOtherResponseDto[];
/** Users that gave the current user access to this person */
sharedBy: PeopleUserResponseDto[];
/** Users the current user gave access to this person */
sharedWith: PeopleUserResponseDto[];
/** Thumbnail path */
thumbnailPath: string;
/** Last update date */
@@ -1700,6 +1726,8 @@ export type AssetFaceCreateDto = {
imageWidth: number;
/** Person ID */
personId: string;
/** User ID */
userId?: string;
/** Face bounding box width */
width: number;
/** Face bounding box X coordinate */
@@ -1964,6 +1992,11 @@ export type PartnerUpdateDto = {
/** Show partner assets in timeline */
inTimeline: boolean;
};
export type PeopleDeleteDto = {
/** IDs to process */
ids: string[];
userId?: string;
};
export type PeopleResponseDto = {
/** Whether there are more pages */
hasNextPage?: boolean;
@@ -2000,6 +2033,8 @@ export type PeopleUpdateItem = {
isHidden?: boolean;
/** Person name */
name?: string;
/** User ID */
userId?: string;
};
export type PeopleUpdateDto = {
/** People to update */
@@ -2009,6 +2044,39 @@ export type MergePersonDto = {
/** Person IDs to merge */
ids: string[];
};
export type PersonUsersDeleteDto = {
/** Person ID */
personId: string;
/** User ID of the user that gave access to the person */
sharedById?: string;
/** User ID of the user that was given access to the person */
sharedWithId: string;
}[];
export type PersonUsersResponseDto = {
/** Person ID */
personId: string;
/** Access role */
role: PersonUserRole;
/** The user that gave access to this person */
sharedBy: UserResponseDto;
/** User ID of the user that gave access to this person */
sharedById: string;
/** The user that was given access to this person */
sharedWith: UserResponseDto;
/** User ID of the user that was given access to this person */
sharedWithId: string;
}[];
export type PersonUsersCreateDto = {
/** Person IDs */
personIds: string[];
/** Role that should be applied */
role: PersonUserRole;
/** User IDs that should be given access to the person */
sharedWithIds: string[];
};
export type PersonDeleteDto = {
userId?: string;
};
export type PersonUpdateDto = {
/** Person date of birth */
birthDate?: string | null;
@@ -2022,12 +2090,16 @@ export type PersonUpdateDto = {
isHidden?: boolean;
/** Person name */
name?: string;
/** User ID */
userId?: string;
};
export type AssetFaceUpdateItem = {
/** Asset ID */
assetId: string;
/** Person ID */
personId: string;
/** User ID */
userId?: string;
};
export type AssetFaceUpdateDto = {
/** Face update items */
@@ -6010,22 +6082,26 @@ export function updatePartner({ id, partnerUpdateDto }: {
/**
* Delete people
*/
export function deletePeople({ bulkIdsDto }: {
bulkIdsDto: BulkIdsDto;
export function deletePeople({ peopleDeleteDto }: {
peopleDeleteDto: PeopleDeleteDto;
}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchText("/people", oazapfts.json({
...opts,
method: "DELETE",
body: bulkIdsDto
body: peopleDeleteDto
})));
}
/**
* Get all people
*/
export function getAllPeople({ closestAssetId, closestPersonId, page, size, withHidden }: {
export function getAllPeople({ closestAssetId, closestPersonId, isFavorite, isHidden, page, sharedById, sharedWithId, size, withHidden }: {
closestAssetId?: string;
closestPersonId?: string;
isFavorite?: boolean;
isHidden?: boolean;
page?: number;
sharedById?: string;
sharedWithId?: string;
size?: number;
withHidden?: boolean;
}, opts?: Oazapfts.RequestOpts) {
@@ -6035,7 +6111,11 @@ export function getAllPeople({ closestAssetId, closestPersonId, page, size, with
}>(`/people${QS.query(QS.explode({
closestAssetId,
closestPersonId,
isFavorite,
isHidden,
page,
sharedById,
sharedWithId,
size,
withHidden
}))}`, {
@@ -6087,16 +6167,65 @@ export function mergePeople({ mergePersonDto }: {
body: mergePersonDto
})));
}
/**
* Remove users from people
*/
export function removeUsersFromPeople({ personUsersDeleteDto }: {
personUsersDeleteDto: PersonUsersDeleteDto;
}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchText("/people/users", oazapfts.json({
...opts,
method: "DELETE",
body: personUsersDeleteDto
})));
}
/**
* Get people access
*/
export function getUsersForPeople({ direction, personId, role, sharedById, sharedWithId }: {
direction?: SharingDirection;
personId?: string;
role?: PersonUserRole;
sharedById?: string;
sharedWithId?: string;
}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{
status: 200;
data: PersonUsersResponseDto;
}>(`/people/users${QS.query(QS.explode({
direction,
personId,
role,
sharedById,
sharedWithId
}))}`, {
...opts
}));
}
/**
* Give users access to people
*/
export function addUsersToPeople({ personUsersCreateDto }: {
personUsersCreateDto: PersonUsersCreateDto;
}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchText("/people/users", oazapfts.json({
...opts,
method: "PUT",
body: personUsersCreateDto
})));
}
/**
* Delete person
*/
export function deletePerson({ id }: {
export function deletePerson({ id, personDeleteDto }: {
id: string;
personDeleteDto: PersonDeleteDto;
}, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchText(`/people/${encodeURIComponent(id)}`, {
return oazapfts.ok(oazapfts.fetchText(`/people/${encodeURIComponent(id)}`, oazapfts.json({
...opts,
method: "DELETE"
}));
method: "DELETE",
body: personDeleteDto
})));
}
/**
* Get a person
@@ -8145,6 +8274,11 @@ export enum AssetJobName {
RegenerateThumbnail = "regenerate-thumbnail",
TranscodeVideo = "transcode-video"
}
export enum PersonUserRole {
Read = "read",
Write = "write",
Admin = "admin"
}
export enum AssetTypeEnum {
Image = "IMAGE",
Video = "VIDEO",
@@ -8229,6 +8363,10 @@ export enum PartnerDirection {
SharedBy = "shared-by",
SharedWith = "shared-with"
}
export enum SharingDirection {
SharedBy = "shared-by",
SharedWith = "shared-with"
}
export enum WorkflowType {
AssetV1 = "AssetV1"
}