@iveri/contracts 0.39.0 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/api/clinic/clinic-appointment-status.enum.d.ts +7 -0
  2. package/dist/api/clinic/clinic-appointment-status.enum.js +8 -0
  3. package/dist/api/clinic/clinic-appointment.type.d.ts +48 -0
  4. package/dist/api/clinic/clinic-appointment.type.js +1 -0
  5. package/dist/api/clinic/clinic-client.type.d.ts +25 -0
  6. package/dist/api/clinic/clinic-client.type.js +1 -0
  7. package/dist/api/clinic/clinic-device.type.d.ts +23 -0
  8. package/dist/api/clinic/clinic-device.type.js +1 -0
  9. package/dist/api/clinic/clinic-location.type.d.ts +36 -0
  10. package/dist/api/clinic/clinic-location.type.js +1 -0
  11. package/dist/api/clinic/clinic-resource-status.enum.d.ts +5 -0
  12. package/dist/api/clinic/clinic-resource-status.enum.js +6 -0
  13. package/dist/api/clinic/clinic-room.type.d.ts +19 -0
  14. package/dist/api/clinic/clinic-room.type.js +1 -0
  15. package/dist/api/clinic/clinic-slot.type.d.ts +9 -0
  16. package/dist/api/clinic/clinic-slot.type.js +1 -0
  17. package/dist/api/clinic/clinic-specialty.type.d.ts +24 -0
  18. package/dist/api/clinic/clinic-specialty.type.js +1 -0
  19. package/dist/api/clinic/clinic-staff.type.d.ts +55 -0
  20. package/dist/api/clinic/clinic-staff.type.js +1 -0
  21. package/dist/api/clinic/clinic-treatment.type.d.ts +64 -0
  22. package/dist/api/clinic/clinic-treatment.type.js +1 -0
  23. package/dist/api/clinic/index.d.ts +12 -0
  24. package/dist/api/clinic/index.js +12 -0
  25. package/dist/api/clinic/localized-text.type.d.ts +7 -0
  26. package/dist/api/clinic/localized-text.type.js +1 -0
  27. package/dist/enum/user-permission.enum.d.ts +13 -1
  28. package/dist/enum/user-permission.enum.js +13 -0
  29. package/package.json +5 -1
@@ -0,0 +1,7 @@
1
+ export declare enum ClinicAppointmentStatus {
2
+ BOOKED = "booked",
3
+ CHECKED_IN = "checked-in",
4
+ COMPLETED = "completed",
5
+ CANCELLED = "cancelled",
6
+ NO_SHOW = "no-show"
7
+ }
@@ -0,0 +1,8 @@
1
+ export var ClinicAppointmentStatus;
2
+ (function (ClinicAppointmentStatus) {
3
+ ClinicAppointmentStatus["BOOKED"] = "booked";
4
+ ClinicAppointmentStatus["CHECKED_IN"] = "checked-in";
5
+ ClinicAppointmentStatus["COMPLETED"] = "completed";
6
+ ClinicAppointmentStatus["CANCELLED"] = "cancelled";
7
+ ClinicAppointmentStatus["NO_SHOW"] = "no-show";
8
+ })(ClinicAppointmentStatus || (ClinicAppointmentStatus = {}));
@@ -0,0 +1,48 @@
1
+ import type { IsoDateTime } from '../../type/iso-date-time.type.js';
2
+ import type { Nullable } from '../../type/nil.type.js';
3
+ import type { UUID } from '../../type/uuid.type.js';
4
+ import type { ClinicAppointmentStatus } from './clinic-appointment-status.enum.js';
5
+ import type { LocalizedText } from './localized-text.type.js';
6
+ /** One option as it was when the appointment was booked. A later price change does not touch it. */
7
+ export interface ClinicAppointmentLine {
8
+ optionId: UUID;
9
+ name: LocalizedText;
10
+ durationMinutes: number;
11
+ priceMinor: number;
12
+ }
13
+ export interface ClinicAppointment {
14
+ id: UUID;
15
+ locationId: UUID;
16
+ staffMemberId: UUID;
17
+ roomId: UUID;
18
+ deviceId: Nullable<UUID>;
19
+ clientId: UUID;
20
+ clientName: string;
21
+ clientPhone: string;
22
+ treatmentId: UUID;
23
+ treatmentName: LocalizedText;
24
+ status: ClinicAppointmentStatus;
25
+ startsAt: IsoDateTime;
26
+ /** When the treatment itself finishes. */
27
+ endsAt: IsoDateTime;
28
+ /** When the specialist, the room and any machine are free again, which includes the buffer. */
29
+ blockedUntil: IsoDateTime;
30
+ currency: string;
31
+ totalMinor: number;
32
+ lines: ClinicAppointmentLine[];
33
+ note: Nullable<string>;
34
+ createdAt: IsoDateTime;
35
+ updatedAt: IsoDateTime;
36
+ }
37
+ export interface CreateClinicAppointmentRequest {
38
+ locationId: UUID;
39
+ treatmentId: UUID;
40
+ optionIds: UUID[];
41
+ staffMemberId: UUID;
42
+ clientId: UUID;
43
+ startsAt: IsoDateTime;
44
+ note?: Nullable<string>;
45
+ }
46
+ export interface ChangeClinicAppointmentStatusRequest {
47
+ status: ClinicAppointmentStatus;
48
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ import type { IsoDateTime } from '../../type/iso-date-time.type.js';
2
+ import type { Nullable } from '../../type/nil.type.js';
3
+ import type { UUID } from '../../type/uuid.type.js';
4
+ /** Somebody the clinic treats. They need no account to be booked by reception. */
5
+ export interface ClinicClient {
6
+ id: UUID;
7
+ firstName: string;
8
+ lastName: string;
9
+ phone: string;
10
+ email: Nullable<string>;
11
+ createdAt: IsoDateTime;
12
+ updatedAt: IsoDateTime;
13
+ }
14
+ export interface CreateClinicClientRequest {
15
+ firstName: string;
16
+ lastName: string;
17
+ phone: string;
18
+ email?: Nullable<string>;
19
+ }
20
+ export interface UpdateClinicClientRequest {
21
+ firstName?: string;
22
+ lastName?: string;
23
+ phone?: string;
24
+ email?: Nullable<string>;
25
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ import type { IsoDateTime } from '../../type/iso-date-time.type.js';
2
+ import type { UUID } from '../../type/uuid.type.js';
3
+ import type { ClinicResourceStatus } from './clinic-resource-status.enum.js';
4
+ export interface ClinicDevice {
5
+ id: UUID;
6
+ locationId: UUID;
7
+ name: string;
8
+ /** A clinic-chosen key such as `co2-laser`, which a treatment names when it needs one. */
9
+ deviceType: string;
10
+ status: ClinicResourceStatus;
11
+ createdAt: IsoDateTime;
12
+ updatedAt: IsoDateTime;
13
+ }
14
+ export interface CreateClinicDeviceRequest {
15
+ locationId: UUID;
16
+ name: string;
17
+ deviceType: string;
18
+ }
19
+ export interface UpdateClinicDeviceRequest {
20
+ name?: string;
21
+ deviceType?: string;
22
+ status?: ClinicResourceStatus;
23
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,36 @@
1
+ import type { IsoDateTime } from '../../type/iso-date-time.type.js';
2
+ import type { Nullable } from '../../type/nil.type.js';
3
+ import type { UUID } from '../../type/uuid.type.js';
4
+ import type { ClinicResourceStatus } from './clinic-resource-status.enum.js';
5
+ import type { LocalizedText } from './localized-text.type.js';
6
+ export interface ClinicLocation {
7
+ id: UUID;
8
+ name: LocalizedText;
9
+ city: LocalizedText;
10
+ address: Nullable<string>;
11
+ phone: Nullable<string>;
12
+ /** An IANA zone such as `Asia/Tbilisi`. Times are stored in UTC and shown in this zone. */
13
+ timeZone: string;
14
+ /** The specialties this branch offers, which clients filter branches by. */
15
+ specialtyIds: UUID[];
16
+ status: ClinicResourceStatus;
17
+ createdAt: IsoDateTime;
18
+ updatedAt: IsoDateTime;
19
+ }
20
+ export interface CreateClinicLocationRequest {
21
+ name: LocalizedText;
22
+ city: LocalizedText;
23
+ address?: Nullable<string>;
24
+ phone?: Nullable<string>;
25
+ timeZone: string;
26
+ specialtyIds?: UUID[];
27
+ }
28
+ export interface UpdateClinicLocationRequest {
29
+ name?: LocalizedText;
30
+ city?: LocalizedText;
31
+ address?: Nullable<string>;
32
+ phone?: Nullable<string>;
33
+ timeZone?: string;
34
+ specialtyIds?: UUID[];
35
+ status?: ClinicResourceStatus;
36
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ /** Whether a location, room, device, treatment or staff member can be booked. */
2
+ export declare enum ClinicResourceStatus {
3
+ ACTIVE = "active",
4
+ INACTIVE = "inactive"
5
+ }
@@ -0,0 +1,6 @@
1
+ /** Whether a location, room, device, treatment or staff member can be booked. */
2
+ export var ClinicResourceStatus;
3
+ (function (ClinicResourceStatus) {
4
+ ClinicResourceStatus["ACTIVE"] = "active";
5
+ ClinicResourceStatus["INACTIVE"] = "inactive";
6
+ })(ClinicResourceStatus || (ClinicResourceStatus = {}));
@@ -0,0 +1,19 @@
1
+ import type { IsoDateTime } from '../../type/iso-date-time.type.js';
2
+ import type { UUID } from '../../type/uuid.type.js';
3
+ import type { ClinicResourceStatus } from './clinic-resource-status.enum.js';
4
+ export interface ClinicRoom {
5
+ id: UUID;
6
+ locationId: UUID;
7
+ name: string;
8
+ status: ClinicResourceStatus;
9
+ createdAt: IsoDateTime;
10
+ updatedAt: IsoDateTime;
11
+ }
12
+ export interface CreateClinicRoomRequest {
13
+ locationId: UUID;
14
+ name: string;
15
+ }
16
+ export interface UpdateClinicRoomRequest {
17
+ name?: string;
18
+ status?: ClinicResourceStatus;
19
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { IsoDateTime } from '../../type/iso-date-time.type.js';
2
+ import type { UUID } from '../../type/uuid.type.js';
3
+ /** A time one specialist can start this treatment, with a room and any machine free for all of it. */
4
+ export interface ClinicSlot {
5
+ staffMemberId: UUID;
6
+ startsAt: IsoDateTime;
7
+ /** When the treatment itself finishes, without the buffer after it. */
8
+ endsAt: IsoDateTime;
9
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,24 @@
1
+ import type { IsoDateTime } from '../../type/iso-date-time.type.js';
2
+ import type { UUID } from '../../type/uuid.type.js';
3
+ import type { ClinicResourceStatus } from './clinic-resource-status.enum.js';
4
+ import type { LocalizedText } from './localized-text.type.js';
5
+ /** A line of work such as cosmetology or laser epilation, which a clinic organises treatments by. */
6
+ export interface ClinicSpecialty {
7
+ id: UUID;
8
+ name: LocalizedText;
9
+ /** Fixed after creation, because a public address names it. */
10
+ slug: string;
11
+ sortOrder: number;
12
+ status: ClinicResourceStatus;
13
+ createdAt: IsoDateTime;
14
+ updatedAt: IsoDateTime;
15
+ }
16
+ export interface CreateClinicSpecialtyRequest {
17
+ name: LocalizedText;
18
+ slug: string;
19
+ }
20
+ export interface UpdateClinicSpecialtyRequest {
21
+ name?: LocalizedText;
22
+ sortOrder?: number;
23
+ status?: ClinicResourceStatus;
24
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,55 @@
1
+ import type { IsoDateTime } from '../../type/iso-date-time.type.js';
2
+ import type { Nullable } from '../../type/nil.type.js';
3
+ import type { UUID } from '../../type/uuid.type.js';
4
+ import type { ClinicResourceStatus } from './clinic-resource-status.enum.js';
5
+ /** One stretch of a weekly schedule, read in the location's own time zone. */
6
+ export interface ClinicWorkingPeriod {
7
+ /** ISO weekday: 1 is Monday and 7 is Sunday. */
8
+ dayOfWeek: number;
9
+ /** 24-hour `HH:mm`. */
10
+ startTime: string;
11
+ /** 24-hour `HH:mm`, later than `startTime`. */
12
+ endTime: string;
13
+ }
14
+ export interface ClinicStaffMember {
15
+ id: UUID;
16
+ /** The identity account this person signs in with. */
17
+ userId: UUID;
18
+ locationId: UUID;
19
+ displayName: string;
20
+ status: ClinicResourceStatus;
21
+ /** The treatments this person may perform. */
22
+ treatmentIds: UUID[];
23
+ workingHours: ClinicWorkingPeriod[];
24
+ createdAt: IsoDateTime;
25
+ updatedAt: IsoDateTime;
26
+ }
27
+ export interface CreateClinicStaffMemberRequest {
28
+ userId: UUID;
29
+ locationId: UUID;
30
+ displayName: string;
31
+ }
32
+ export interface UpdateClinicStaffMemberRequest {
33
+ locationId?: UUID;
34
+ displayName?: string;
35
+ status?: ClinicResourceStatus;
36
+ }
37
+ export interface ReplaceClinicStaffTreatmentsRequest {
38
+ treatmentIds: UUID[];
39
+ }
40
+ export interface ReplaceClinicWorkingHoursRequest {
41
+ periods: ClinicWorkingPeriod[];
42
+ }
43
+ export interface ClinicTimeOff {
44
+ id: UUID;
45
+ staffMemberId: UUID;
46
+ startsAt: IsoDateTime;
47
+ endsAt: IsoDateTime;
48
+ reason: Nullable<string>;
49
+ createdAt: IsoDateTime;
50
+ }
51
+ export interface CreateClinicTimeOffRequest {
52
+ startsAt: IsoDateTime;
53
+ endsAt: IsoDateTime;
54
+ reason?: Nullable<string>;
55
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,64 @@
1
+ import type { IsoDateTime } from '../../type/iso-date-time.type.js';
2
+ import type { Nullable } from '../../type/nil.type.js';
3
+ import type { UUID } from '../../type/uuid.type.js';
4
+ import type { ClinicResourceStatus } from './clinic-resource-status.enum.js';
5
+ import type { LocalizedText } from './localized-text.type.js';
6
+ /** One way of buying a treatment. A laser zone is an option; a treatment that does not vary has one. */
7
+ export interface ClinicTreatmentOption {
8
+ id: UUID;
9
+ name: LocalizedText;
10
+ durationMinutes: number;
11
+ /** Integer minor units of the treatment's currency. */
12
+ priceMinor: number;
13
+ sortOrder: number;
14
+ }
15
+ export interface ClinicTreatment {
16
+ id: UUID;
17
+ specialtyId: UUID;
18
+ name: LocalizedText;
19
+ description: Nullable<LocalizedText>;
20
+ currency: string;
21
+ /** Rest time held after the treatment, for cleaning a room or cooling a device. */
22
+ bufferMinutes: number;
23
+ /** The device type this treatment occupies, or `null` when it needs none. */
24
+ requiredDeviceType: Nullable<string>;
25
+ /** The shortest gap a client may leave between sessions, or `null` when any gap is safe. */
26
+ minDaysBetweenSessions: Nullable<number>;
27
+ isBookableOnline: boolean;
28
+ status: ClinicResourceStatus;
29
+ options: ClinicTreatmentOption[];
30
+ createdAt: IsoDateTime;
31
+ updatedAt: IsoDateTime;
32
+ }
33
+ export interface CreateClinicTreatmentOptionRequest {
34
+ name: LocalizedText;
35
+ durationMinutes: number;
36
+ priceMinor: number;
37
+ }
38
+ export interface UpdateClinicTreatmentOptionRequest {
39
+ name?: LocalizedText;
40
+ durationMinutes?: number;
41
+ priceMinor?: number;
42
+ sortOrder?: number;
43
+ }
44
+ export interface CreateClinicTreatmentRequest {
45
+ specialtyId: UUID;
46
+ name: LocalizedText;
47
+ description?: Nullable<LocalizedText>;
48
+ currency: string;
49
+ bufferMinutes?: number;
50
+ requiredDeviceType?: Nullable<string>;
51
+ minDaysBetweenSessions?: Nullable<number>;
52
+ isBookableOnline?: boolean;
53
+ options: CreateClinicTreatmentOptionRequest[];
54
+ }
55
+ export interface UpdateClinicTreatmentRequest {
56
+ specialtyId?: UUID;
57
+ name?: LocalizedText;
58
+ description?: Nullable<LocalizedText>;
59
+ bufferMinutes?: number;
60
+ requiredDeviceType?: Nullable<string>;
61
+ minDaysBetweenSessions?: Nullable<number>;
62
+ isBookableOnline?: boolean;
63
+ status?: ClinicResourceStatus;
64
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ export * from './clinic-appointment-status.enum.js';
2
+ export * from './clinic-appointment.type.js';
3
+ export * from './clinic-client.type.js';
4
+ export * from './clinic-device.type.js';
5
+ export * from './clinic-location.type.js';
6
+ export * from './clinic-resource-status.enum.js';
7
+ export * from './clinic-room.type.js';
8
+ export * from './clinic-slot.type.js';
9
+ export * from './clinic-specialty.type.js';
10
+ export * from './clinic-staff.type.js';
11
+ export * from './clinic-treatment.type.js';
12
+ export * from './localized-text.type.js';
@@ -0,0 +1,12 @@
1
+ export * from './clinic-appointment-status.enum.js';
2
+ export * from './clinic-appointment.type.js';
3
+ export * from './clinic-client.type.js';
4
+ export * from './clinic-device.type.js';
5
+ export * from './clinic-location.type.js';
6
+ export * from './clinic-resource-status.enum.js';
7
+ export * from './clinic-room.type.js';
8
+ export * from './clinic-slot.type.js';
9
+ export * from './clinic-specialty.type.js';
10
+ export * from './clinic-staff.type.js';
11
+ export * from './clinic-treatment.type.js';
12
+ export * from './localized-text.type.js';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Clinic-written text in each language it has been written in, keyed by locale.
3
+ *
4
+ * This is the clinic's own content, so it lives on the row it describes rather than in the
5
+ * localization service, which holds strings the product's authors wrote.
6
+ */
7
+ export type LocalizedText = Record<string, string>;
@@ -0,0 +1 @@
1
+ export {};
@@ -430,7 +430,19 @@ export declare enum UserPermission {
430
430
  /** Confirm or cancel a delivery job; operator actions on another sender's job require this grant. */
431
431
  DELIVERY_JOB_OPERATE = "delivery:job:operate",
432
432
  /** Read and advance only jobs assigned to the caller's own courier worker. */
433
- DELIVERY_JOB_DELIVER = "delivery:job:deliver"
433
+ DELIVERY_JOB_DELIVER = "delivery:job:deliver",
434
+ /** Read a clinic's specialties, locations, rooms, devices, treatments and staff. */
435
+ CLINIC_SETUP_READ = "clinic:setup:read",
436
+ /** Create and change them, including staff working hours. */
437
+ CLINIC_SETUP_MANAGE = "clinic:setup:manage",
438
+ /** Read the appointment calendar and search for free slots. */
439
+ CLINIC_APPOINTMENT_READ = "clinic:appointment:read",
440
+ /** Book appointments and move them through their statuses. */
441
+ CLINIC_APPOINTMENT_MANAGE = "clinic:appointment:manage",
442
+ /** Read a clinic's clients. */
443
+ CLINIC_CLIENT_READ = "clinic:client:read",
444
+ /** Create and change a clinic's clients. */
445
+ CLINIC_CLIENT_MANAGE = "clinic:client:manage"
434
446
  }
435
447
  /**
436
448
  * Every member, for seeding the owner role and validating custom-role input.
@@ -492,6 +492,19 @@ export var UserPermission;
492
492
  UserPermission["DELIVERY_JOB_OPERATE"] = "delivery:job:operate";
493
493
  /** Read and advance only jobs assigned to the caller's own courier worker. */
494
494
  UserPermission["DELIVERY_JOB_DELIVER"] = "delivery:job:deliver";
495
+ // Clinic
496
+ /** Read a clinic's specialties, locations, rooms, devices, treatments and staff. */
497
+ UserPermission["CLINIC_SETUP_READ"] = "clinic:setup:read";
498
+ /** Create and change them, including staff working hours. */
499
+ UserPermission["CLINIC_SETUP_MANAGE"] = "clinic:setup:manage";
500
+ /** Read the appointment calendar and search for free slots. */
501
+ UserPermission["CLINIC_APPOINTMENT_READ"] = "clinic:appointment:read";
502
+ /** Book appointments and move them through their statuses. */
503
+ UserPermission["CLINIC_APPOINTMENT_MANAGE"] = "clinic:appointment:manage";
504
+ /** Read a clinic's clients. */
505
+ UserPermission["CLINIC_CLIENT_READ"] = "clinic:client:read";
506
+ /** Create and change a clinic's clients. */
507
+ UserPermission["CLINIC_CLIENT_MANAGE"] = "clinic:client:manage";
495
508
  })(UserPermission || (UserPermission = {}));
496
509
  /**
497
510
  * Every member, for seeding the owner role and validating custom-role input.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iveri/contracts",
3
- "version": "0.39.0",
3
+ "version": "0.41.0",
4
4
  "description": "Wire contracts shared by every Iveri backend and frontend. Zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -48,6 +48,10 @@
48
48
  "types": "./dist/api/realtime/index.d.ts",
49
49
  "default": "./dist/api/realtime/index.js"
50
50
  },
51
+ "./clinic": {
52
+ "types": "./dist/api/clinic/index.d.ts",
53
+ "default": "./dist/api/clinic/index.js"
54
+ },
51
55
  "./mobility": {
52
56
  "types": "./dist/api/mobility/index.d.ts",
53
57
  "default": "./dist/api/mobility/index.js"