Repository navigation
Expand file tree
/
Copy pathRfidProfile.ts
More file actions
45 lines (41 loc) · 1.74 KB
/
Copy pathRfidProfile.ts
File metadata and controls
45 lines (41 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
export const RFID_PROFILE_SEX_VALUES = ["MALE", "FEMALE"] as const;
export type RfidProfileSex = typeof RFID_PROFILE_SEX_VALUES[number];
export class RfidProfile {
rfidCode: string;
userId: number;
/** The user's name for the cat; null on rows holding only other contributions (e.g. avatar only). */
label: string | null;
version: number;
createdAt: Date;
/** Pet date of birth (date-only, no time component), or null when not set. */
dateOfBirth?: Date | null;
/** Pet sex, or null when not set. */
sex?: RfidProfileSex | null;
/** Timestamp of the last avatar upload; null when the profile has no avatar. */
avatarUpdatedAt?: Date | null;
/**
* Merged view only (RfidService.mergeRfidProfiles): the user whose row
* holds the displayed avatar. Avatar URLs are /rfid-profiles/<avatarUserId>/<rfidCode>/avatar.
*/
avatarUserId?: number | null;
/**
* Merged view only (RfidService.mergeRfidProfiles): ids of the users
* whose rows contributed to this merged profile. Lets a client tell
* whether the requesting user has a row of their own to edit or delete.
*/
contributedUserIds?: number[];
[key: string]: any; // Allow any additional properties
constructor(initObj: Partial<RfidProfile> & Record<string, any>) {
this.rfidCode = initObj.rfidCode!;
this.userId = initObj.userId!;
this.label = initObj.label!;
this.version = initObj.version!;
this.createdAt = initObj.createdAt!;
// Assign other properties from initObj to this instance
for (const key in initObj) {
if (initObj.hasOwnProperty(key) && !this.hasOwnProperty(key)) {
this[key] = initObj[key];
}
}
}
}