This commit is contained in:
Manav Rathi
2024-10-09 13:11:17 +05:30
parent 744707ca5c
commit c297a60c85

View File

@@ -734,6 +734,28 @@ export const addPerson = async (name: string, cluster: FaceCluster) => {
return mlSync();
};
/**
* Add a new cluster to an existing named person.
*
* @param cgroup The existing cgroup underlying the person. This is the (remote)
* user entity that will get updated.
*
* @param cluster The new cluster of faces to associate with this person.
*/
export const addClusterToPerson = async (
cluster: FaceCluster,
cgroup: CGroup,
) => {
const masterKey = await masterKeyFromSession();
const assigned = cgroup.data.assigned.concat([cluster]);
await updateOrCreateUserEntities(
"cgroup",
[{ ...cgroup, data: { ...cgroup.data, assigned } }],
masterKey,
);
return mlSync();
};
/**
* Rename an existing named person.
*