Skip to main content

videre_api/
types.rs

1use serde::Serialize;
2
3/// One labeled person: their confirmed faces plus a representative face id
4/// (the primary, or lowest id) used as the card thumbnail.
5#[derive(Serialize, Clone)]
6pub struct PersonData {
7    /// Identity: normalized, what URLs and actions use.
8    pub label: String,
9    /// What a reader sees. Falls back to `label` for a person whose row
10    /// predates the people table.
11    pub full_name: String,
12    pub face_ids: Vec<i64>,
13    pub representative_id: i64,
14    pub hashes: Vec<String>,
15}
16
17/// One unassigned cluster (green section in the labeling UI).
18#[derive(Serialize, Clone)]
19pub struct ClusterData {
20    pub cluster_id: i64,
21    pub face_ids: Vec<i64>,
22    pub hashes: Vec<String>,
23}
24
25/// One unclustered, unassigned face (orange section).
26#[derive(Serialize, Clone)]
27pub struct SingletonData {
28    pub face_id: i64,
29    pub hash: String,
30}
31
32/// Top-level payload for the labeling page.
33#[derive(Serialize, Clone)]
34pub struct FacesData {
35    pub people: Vec<PersonData>,
36    pub clusters: Vec<ClusterData>,
37    pub singletons: Vec<SingletonData>,
38}
39
40/// One face row on a cluster detail page.
41#[derive(Serialize, Clone)]
42pub struct ClusterFaceData {
43    pub face_id: i64,
44    pub hash: String,
45    pub path: String,
46}
47
48/// Cluster detail: every face in one unassigned cluster.
49#[derive(Serialize, Clone)]
50pub struct ClusterDetail {
51    pub cluster_id: i64,
52    pub faces: Vec<ClusterFaceData>,
53}
54
55/// One face row on a person detail page. `is_primary` marks the current
56/// default photo (the person's thumbnail on the labeling page).
57#[derive(Serialize, Clone)]
58pub struct PersonFaceData {
59    pub face_id: i64,
60    pub hash: String,
61    pub path: String,
62    pub is_primary: bool,
63}
64
65/// Person detail: every confirmed face for one person.
66#[derive(Serialize, Clone)]
67pub struct PersonDetail {
68    /// Identity: what the URL and every face row use.
69    pub label: String,
70    /// What a reader sees, and what the page lets them edit.
71    pub full_name: String,
72    pub faces: Vec<PersonFaceData>,
73}