This commit is contained in:
Manav Rathi
2024-08-14 11:21:04 +05:30
parent ad156bc33a
commit 81885d6814
2 changed files with 14 additions and 14 deletions

View File

@@ -65,6 +65,13 @@ export interface Person {
* hidden.
*/
name: string | undefined;
/**
* An unordered set of ids of the clusters that belong to this person.
*
* For ergonomics of transportation and persistence this is an array, but it
* should conceptually be thought of as a set.
*/
clusterIDs: string[];
/**
* True if this person should be hidden.
*
@@ -75,13 +82,6 @@ export interface Person {
* showing this cluster).
*/
isHidden: boolean;
/**
* An unordered set of ids of the clusters that belong to this person.
*
* For ergonomics of transportation and persistence this is an array, but it
* should conceptually be thought of as a set.
*/
clusterIDs: string[];
/**
* The ID of the face that should be used as the cover photo for this person
* (if the user has set one).

View File

@@ -16,8 +16,8 @@ import { applyPersonDiff } from "./ml/db";
export type EntityType =
| "person"
/**
* A new version of the Person entity where the data is gzipped before
* encryption.
* The latest iteration of the Person entity format, where the data is
* gzipped before encryption.
*/
| "person_v2";
@@ -171,7 +171,9 @@ export const syncPersons = async (entityKeyB64: string) => {
id,
name: rp.name,
clusterIDs: rp.assigned.map(({ id }) => id),
avatarFaceID: undefined,
isHidden: rp.isHidden,
avatarFaceID: rp.avatarFaceID,
displayFaceID: undefined,
};
};
@@ -191,9 +193,7 @@ export const syncPersons = async (entityKeyB64: string) => {
}
};
/**
* Zod schema for the "person" entity (the {@link RemotePerson} type).
*/
/** Zod schema for the {@link RemotePerson} type. */
const RemotePerson = z.object({
name: z.string().nullish().transform(nullToUndefined),
assigned: z.array(
@@ -208,7 +208,7 @@ const RemotePerson = z.object({
});
/**
* A "person" entity as synced via remote.
* A "person_v2" entity as synced via remote.
*/
type RemotePerson = z.infer<typeof RemotePerson>;