@unaffi/schema 1.0.0 → 1.1.1

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.
package/README.md CHANGED
@@ -1,4 +1,46 @@
1
- # UNAFFI Schema defined in Typescript
1
+ # UNAFFI Schema
2
+
3
+ This reflects what the API returns, **not** what the DB Schema looks like in MongoDB.
2
4
 
3
- This reflects what the API returns, and not what the DB Schema looks like in MongoDB.
4
5
  Can be imported into any repo and be used by both TS and JS (JSDocs) code.
6
+
7
+ ## Installation
8
+ ```bash
9
+ npm i --save-dev @unaffi/schema
10
+ ```
11
+
12
+ ## Usage
13
+ Example:
14
+ ```js
15
+ /** @type {import('@unaffi/schema').Profile} */
16
+ const profile = await getProfile();
17
+ ```
18
+
19
+ or define it at the top of the page to use the type throughout the file:
20
+ ```js
21
+ /** @typedef {import('@unaffi/schema').Profile} Profile */
22
+
23
+ /** @type {Profile} */
24
+ const profile = await getProfile();
25
+ ```
26
+
27
+ ## Updating the Schema
28
+ 1. **Bump the version** in the `package.json`:
29
+ ```jsonc
30
+ {
31
+ // …
32
+ "version": "1.0.0", // to "1.0.1" | Always update 3rd number, unless it is a large update (such as an extra table added). Never update 1st number unless we restart unaffi's schema entirely.
33
+ // …
34
+ }
35
+ ```
36
+ 2. Update **Github**:
37
+ ```bash
38
+ git add .
39
+ git commit -m "Your commit message"
40
+ git push
41
+ ```
42
+ 3. Update **npm**:
43
+ ```bash
44
+ npm login
45
+ npm publish --access public
46
+ ```
package/base.schema.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export interface Base {
2
- archived?: boolean;
3
- readonly createdAt?: string;
4
- readonly updatedAt?: string;
2
+ archived?: boolean;
3
+ readonly createdAt?: string;
4
+ readonly updatedAt?: string;
5
5
  }
@@ -1,24 +1,32 @@
1
- import type { Base } from '../base.schema';
2
- import type * as DB from '../index';
1
+ import type { Base } from "../base.schema";
2
+ import type * as DB from "../index";
3
3
 
4
4
  export interface Action extends Base {
5
- readonly action_id: string;
5
+ readonly action_id: string;
6
6
 
7
- action_template?: string;
7
+ action_template?: string;
8
8
 
9
- data?: {
10
- [x: string]: any;
11
- };
9
+ data?: {
10
+ [x: string]: any;
11
+ };
12
12
 
13
- org_id?: DB.Org['org_id'];
14
- org?: DB.Org;
13
+ profile_attributes?: {
14
+ is_system?: boolean;
15
+ is_collaborator?: boolean;
16
+ is_instance_seat?: boolean;
17
+ is_order_profile?: boolean;
18
+ is_order_seat?: boolean;
19
+ };
15
20
 
16
- order_id?: DB.Order['order_id'];
17
- order?: DB.Order;
21
+ org_id?: DB.Org["org_id"];
22
+ org?: DB.Org;
18
23
 
19
- instance_id?: DB.Instance['instance_id'];
20
- instance?: DB.Instance;
24
+ order_id?: DB.Order["order_id"];
25
+ order?: DB.Order;
21
26
 
22
- profile_id?: DB.Profile['profile_id'];
23
- profile?: DB.Profile;
27
+ instance_id?: DB.Instance["instance_id"];
28
+ instance?: DB.Instance;
29
+
30
+ profile_id?: DB.Profile["profile_id"];
31
+ profile?: DB.Profile;
24
32
  }
@@ -1,14 +1,14 @@
1
- import type { Base } from '../base.schema';
2
- import type * as DB from '../index';
1
+ import type { Base } from "../base.schema";
2
+ import type * as DB from "../index";
3
3
 
4
4
  export interface Collaborator extends Base {
5
- readonly collaborator_id: string;
5
+ readonly collaborator_id: string;
6
6
 
7
- role?: 'owner' | 'admin';
7
+ role?: "owner" | "admin";
8
8
 
9
- org_id?: DB.Org['org_id'];
10
- org?: DB.Org;
9
+ org_id?: DB.Org["org_id"];
10
+ org?: DB.Org;
11
11
 
12
- profile_id?: DB.Profile['profile_id'];
13
- profile?: DB.Profile;
12
+ profile_id?: DB.Profile["profile_id"];
13
+ profile?: DB.Profile;
14
14
  }
@@ -1,20 +1,21 @@
1
- import type { Base } from '../base.schema';
2
- import type { Org } from './org.schema';
3
- import type { Profile } from './profile.schema';
1
+ import type { Base } from "../base.schema";
2
+ import type { Org } from "./org.schema";
3
+ import type { Profile } from "./profile.schema";
4
4
 
5
5
  export interface Contactpoint extends Base {
6
- readonly contactpoint_id: string;
6
+ readonly contactpoint_id: string;
7
7
 
8
- type?: string;
9
- point?: string;
10
- details: {
11
- descname?: string;
12
- description?: string;
13
- };
8
+ type?: "email_address" | "mobile_number" | "telephone_number";
9
+ point?: string;
10
+ details: {
11
+ descname?: string;
12
+ description?: string;
13
+ full_name?: string;
14
+ };
14
15
 
15
- org_id?: Org['org_id'];
16
- org?: Org;
16
+ org_id?: Org["org_id"];
17
+ org?: Org;
17
18
 
18
- profile_id?: Profile['profile_id'];
19
- profile?: Profile;
19
+ profile_id?: Profile["profile_id"];
20
+ profile?: Profile;
20
21
  }
@@ -1,26 +1,22 @@
1
- import type { Base } from '../base.schema';
2
- import type * as DB from '../index';
3
- import type { GeoLocation } from '../common';
1
+ import type { Base } from "../base.schema";
2
+ import type * as DB from "../index";
3
+ import type { GeoLocation } from "../common";
4
4
 
5
5
  export interface Facility extends Base {
6
- readonly facility_id: string;
6
+ readonly facility_id: string;
7
7
 
8
- linked_facility_ids: DB.Facility['facility_id'][];
9
- linked_facilities: DB.Facility;
8
+ linked_facility_ids: DB.Facility["facility_id"][];
9
+ linked_facilities: DB.Facility;
10
10
 
11
- details: {
12
- descname?: string;
13
- description?: string;
14
- geo_location?: GeoLocation;
15
- };
16
- config: {
17
- hidden: boolean;
18
- disabled: boolean;
19
- };
11
+ details: {
12
+ descname?: string;
13
+ description?: string;
14
+ geo_location?: GeoLocation;
15
+ };
20
16
 
21
- org_id?: DB.Org['org_id'];
22
- org?: DB.Org;
17
+ org_id?: DB.Org["org_id"];
18
+ org?: DB.Org;
23
19
 
24
- location_id?: DB.Location['location_id'];
25
- location?: DB.Location;
20
+ location_id?: DB.Location["location_id"];
21
+ location?: DB.Location;
26
22
  }
@@ -1,25 +1,29 @@
1
- import type { Base } from '../base.schema';
2
- import type * as DB from '../index';
1
+ import type { Base } from "../base.schema";
2
+ import type * as DB from "../index";
3
3
 
4
4
  export interface File extends Base {
5
- readonly file_id: string;
5
+ readonly file_id: string;
6
6
 
7
- details: {
8
- descname?: string;
9
- description?: string;
10
- };
7
+ details?: {
8
+ descname?: string;
9
+ description?: string;
10
+ };
11
11
 
12
- readonly upload_info?: {
13
- [x: string]: any;
14
- };
15
- readonly storage_details?: {
16
- [x: string]: any;
17
- };
18
- readonly access_url?: string;
12
+ readonly upload_info?: {
13
+ [x: string]: any;
14
+ };
15
+ readonly storage_details?: {
16
+ [x: string]: any;
17
+ };
18
+ readonly access_url?: string;
19
19
 
20
- org_id?: DB.Org['org_id'];
21
- org?: DB.Org;
20
+ uploaded_by?: {
21
+ profile_id: string;
22
+ };
22
23
 
23
- profile_id?: DB.Profile['profile_id'];
24
- profile?: DB.Profile;
24
+ org_id?: DB.Org["org_id"];
25
+ org?: DB.Org;
26
+
27
+ profile_id?: DB.Profile["profile_id"];
28
+ profile?: DB.Profile;
25
29
  }
@@ -18,6 +18,7 @@ export interface Form extends Base {
18
18
 
19
19
  type FormType = 'fields';
20
20
  export type FieldType =
21
+ | 'info'
21
22
  | 'text'
22
23
  | 'textarea'
23
24
  | 'number'
@@ -1,48 +1,55 @@
1
- import type { Base } from '../base.schema';
2
- import type * as DB from '../index';
1
+ import type { Base } from "../base.schema";
2
+ import type * as DB from "../index";
3
3
 
4
4
  export interface Instance extends Base {
5
- readonly instance_id: string;
5
+ readonly instance_id: string;
6
6
 
7
- status: InstanceStatuses;
7
+ status: InstanceStatuses;
8
8
 
9
- slots: InstanceSlot[];
10
- settings: Settings;
11
- seats: DB.Seat[];
9
+ slots: InstanceSlot[];
10
+ settings: Settings;
11
+ seats: DB.Seat[];
12
12
 
13
- seat_profiles: (DB.Seat & DB.Profile)[];
13
+ seat_profiles: (DB.Seat & DB.Profile)[];
14
14
 
15
- is_historical: boolean;
15
+ is_historical: boolean;
16
16
 
17
- org_id?: DB.Org['org_id'];
18
- org?: DB.Org;
17
+ org_id?: DB.Org["org_id"];
18
+ org?: DB.Org;
19
19
 
20
- service_id?: DB.Service['service_id'];
21
- service?: DB.Service;
20
+ service_id?: DB.Service["service_id"];
21
+ service?: DB.Service;
22
22
 
23
- profile_id?: DB.Profile['profile_id'];
24
- profile?: DB.Profile;
23
+ profile_id?: DB.Profile["profile_id"];
24
+ profile?: DB.Profile;
25
25
 
26
- service_schedule?: DB.Schedule;
26
+ service_schedule?: DB.Schedule;
27
27
 
28
- actions: DB.Action[];
28
+ actions: DB.Action[];
29
29
  }
30
30
 
31
- type InstanceStatuses = 'signup-pending' | 'payment-pending' | 'confirmed' | 'seats-pending';
31
+ type InstanceStatuses = "signup-pending" | "payment-pending" | "confirmed" | "seats-pending";
32
32
 
33
33
  export type InstanceSlot = {
34
- date: string;
35
- start_time: number;
36
- end_time: number;
37
- start_date: string;
38
- end_date: string;
39
- schedule_id: string;
40
- session_id: string;
41
- order_allowed: boolean;
42
- rates: DB.Rate[];
43
- public_instances: { instance_id: string }[];
34
+ date: string;
35
+ start_time: number;
36
+ end_time: number;
37
+ start_date: string;
38
+ end_date: string;
39
+ schedule_id: string;
40
+ session_id: string;
41
+ order_allowed: boolean;
42
+ rates: DB.Rate[];
43
+ public_instances: { instance_id: string }[];
44
+ };
45
+
46
+ export type RateSummary = {
47
+ applicable_rate?: number;
48
+ standard_rate?: number;
49
+ discount?: number;
50
+ is_eligible?: boolean;
44
51
  };
45
52
 
46
53
  type Settings = {
47
- [x: string]: any;
54
+ [x: string]: any;
48
55
  };
@@ -1,32 +1,38 @@
1
- import type { Base } from '../base.schema';
2
- import type * as DB from '../index';
3
- import type { GeoLocation, Photo } from '../common';
1
+ import type { Base } from "../base.schema";
2
+ import type * as DB from "../index";
3
+ import type { GeoLocation, Photo } from "../common";
4
4
 
5
5
  export interface Location extends Base {
6
- readonly location_id: string;
6
+ readonly location_id: string;
7
7
 
8
- details: {
9
- descname?: string;
10
- description?: string;
11
- address_string?: string;
12
- is_obscured: boolean;
13
- address: {
14
- street?: string;
15
- city?: string;
16
- region?: string;
17
- postal_code?: string;
18
- };
19
- geo_location?: GeoLocation;
20
- card_background_file_id: string;
21
- };
8
+ details: {
9
+ descname?: string;
10
+ description?: string;
11
+ address_string?: string;
12
+ visibility: "public" | "private";
13
+ address: {
14
+ street?: string;
15
+ city?: string;
16
+ region?: string;
17
+ postal_code?: string;
18
+ };
19
+ geo_location?: GeoLocation;
20
+ card_background_file_id: string;
21
+ };
22
22
 
23
- display_contactpoints: DB.Contactpoint[];
24
- cover_files: Photo[];
23
+ display_contactpoints: DB.Contactpoint[];
24
+ cover_files: Photo[];
25
25
 
26
- org_id?: DB.Org['org_id'];
27
- org?: DB.Org;
26
+ org_id?: DB.Org["org_id"];
27
+ org?: DB.Org;
28
28
 
29
- services?: DB.Service[];
29
+ services?: DB.Service[];
30
30
 
31
- card_background_file?: Photo;
31
+ card_background_file?: Photo;
32
+
33
+ config: {
34
+ disable?: boolean;
35
+ hidden?: boolean;
36
+ active_cover_file_ids: Record<string, number>;
37
+ };
32
38
  }
@@ -1,27 +1,27 @@
1
- import type { Base } from '../base.schema';
2
- import type * as DB from '../index';
1
+ import type { Base } from "../base.schema";
2
+ import type * as DB from "../index";
3
3
 
4
4
  export interface Order extends Base {
5
- readonly order_id: string;
5
+ readonly order_id: string;
6
6
 
7
- reference_number?: string;
7
+ reference_number?: string;
8
8
 
9
- status?: string;
9
+ status?: string;
10
10
 
11
- authorized_payment?: Record<string, any>;
12
- fees_summary?: Record<string, any>;
11
+ authorized_payment?: Record<string, any>;
12
+ fees_summary?: Record<string, any>;
13
13
 
14
- seats?: DB.Seat[];
15
- seat_profiles?: DB.Profile[];
14
+ seats?: DB.Seat[];
15
+ seat_profiles?: DB.Profile[];
16
16
 
17
- org_id: string;
18
- org?: DB.Org;
17
+ org_id: string;
18
+ org?: DB.Org;
19
19
 
20
- instance_id: string;
21
- instance?: DB.Instance;
20
+ instance_id: string;
21
+ instance?: DB.Instance;
22
22
 
23
- profile_id: string;
24
- profile?: DB.Profile;
23
+ profile_id: string;
24
+ profile?: DB.Profile;
25
25
 
26
- actions?: DB.Action[];
26
+ actions?: DB.Action[];
27
27
  }
@@ -1,34 +1,37 @@
1
- import type { Base } from '../base.schema';
2
- import type { Photo } from '../common';
3
- import type * as DB from '../index';
1
+ import type { Base } from "../base.schema";
2
+ import type { Photo } from "../common";
3
+ import type * as DB from "../index";
4
4
 
5
5
  export interface Org extends Base {
6
- readonly org_id: string;
6
+ readonly org_id: string;
7
7
 
8
- details: {
9
- descname?: string;
10
- description?: string;
11
- country_code: CountryCodes;
12
- currency_code: CurrencyCodes;
13
- logo_file_id: string;
14
- card_background_file_id: string;
15
- };
8
+ dashboard_id?: string;
9
+ details: {
10
+ descname?: string;
11
+ description?: string;
12
+ country_code: CountryCodes;
13
+ currency_code: CurrencyCodes;
14
+ logo_file_id: string;
15
+ card_background_file_id: string;
16
+ };
16
17
 
17
- display_contactpoints: DB.Contactpoint[];
18
- cover_files: Photo[];
19
- logo_file?: Photo;
20
- card_background_file?: Photo;
21
- locations?: DB.Location[];
22
- services?: DB.Service[];
18
+ display_contactpoints: DB.Contactpoint[];
19
+ cover_files: Photo[];
20
+ logo_file?: Photo;
21
+ card_background_file?: Photo;
22
+ locations?: DB.Location[];
23
+ services?: DB.Service[];
23
24
 
24
- // Keeping config to a minimum for now.
25
- config: {
26
- active_cover_file_ids: Record<string, number>;
27
- };
25
+ // Keeping config to a minimum for now.
26
+ config: {
27
+ disable?: boolean;
28
+ hidden?: boolean;
29
+ active_cover_file_ids: Record<string, number>;
30
+ };
28
31
 
29
- collaborators?: DB.Collaborator[];
30
- facilities?: DB.Facility[];
32
+ collaborators?: DB.Collaborator[];
33
+ facilities?: DB.Facility[];
31
34
  }
32
35
 
33
- type CountryCodes = 'ZAF';
34
- type CurrencyCodes = 'ZAR';
36
+ type CountryCodes = "ZAF";
37
+ type CurrencyCodes = "ZAR";
@@ -1,29 +1,27 @@
1
- import type { Base } from '../base.schema';
2
- import type * as DB from '../index';
1
+ import type { Base } from "../base.schema";
2
+ import type * as DB from "../index";
3
3
 
4
4
  export interface Payment extends Base {
5
- readonly payment_id: string;
5
+ readonly payment_id: string;
6
6
 
7
- status: PaymentStatus;
8
- payment_provider: PaymentProvider;
9
- provider_details: { url: string };
10
- amount?: number;
7
+ status: PaymentStatus;
8
+ payment_provider: PaymentProvider;
9
+ provider_details: { url: string };
10
+ amount?: number;
11
11
 
12
- reason: {
13
- instance_id?: DB.Instance['instance_id'];
14
- };
12
+ reason?: "new_payment_card" | "order";
15
13
 
16
- profile_id?: DB.Profile['profile_id'];
17
- profile?: DB.Profile;
14
+ profile_id?: DB.Profile["profile_id"];
15
+ profile?: DB.Profile;
18
16
 
19
- org_id?: DB.Org['org_id'];
20
- org?: DB.Org;
17
+ org_id?: DB.Org["org_id"];
18
+ org?: DB.Org;
21
19
  }
22
20
 
23
- type PaymentStatus = 'pending' | 'initialized' | 'paid';
21
+ type PaymentStatus = "pending" | "initialized" | "paid";
24
22
  type PaymentProvider = {
25
- name?: 'paystack';
26
- details?: {
27
- [x: string]: any;
28
- };
23
+ name?: "paystack";
24
+ details?: {
25
+ [x: string]: any;
26
+ };
29
27
  };
@@ -12,9 +12,11 @@ export interface Profile extends Base {
12
12
  };
13
13
 
14
14
  details: {
15
- first_name?: string;
16
- last_name?: string;
15
+ names?: string;
16
+ surname?: string;
17
+ preferred_name?: string;
17
18
  mobile_number?: string;
19
+ unaffi_number?: string;
18
20
  email_address?: string;
19
21
  bio?: string;
20
22
 
@@ -1,105 +1,105 @@
1
- import type { Base } from '../base.schema';
2
- import type * as DB from '../index';
1
+ import type { Base } from "../base.schema";
2
+ import type * as DB from "../index";
3
3
 
4
4
  export interface Schedule extends Base {
5
- readonly schedule_id: string;
6
-
7
- details: {
8
- descname?: string;
9
- description?: string;
10
- date?: string;
11
- hide_overlapping_schedules: boolean;
12
- repeat_settings: {
13
- frequency?: 'DAILY' | 'WEEKLY' | 'MONTHLY' | 'YEARLY';
14
- interval?: number;
15
- count?: number;
16
- until?: string;
17
- byweekday?: ('SU' | 'MO' | 'TU' | 'WE' | 'TH' | 'FR' | 'SA')[];
18
- byweekno?: number[];
19
- bymonth?: number[];
20
- bymonthday?: number[];
21
- bysetpos?: number[];
22
- };
23
- instance_settings: {
24
- is_public: boolean;
25
- max_seats?: number;
26
- min_seats: number;
27
- max_slots?: number;
28
- min_slots: number;
29
- max_lead_time?: number;
30
- min_lead_time: number;
31
- rate_application: 'per_slot' | 'per_seat';
32
- approval_required?: boolean;
33
- signup_form?: {
34
- form_id: DB.Form['form_id'];
35
- };
36
- };
37
- };
38
- config: {
39
- hidden: boolean;
40
- disabled: boolean;
41
- };
42
-
43
- parent_schedule?: {
44
- schedule_id: DB.Schedule['schedule_id'];
45
- session_id: Session['session_id'];
46
- };
47
-
48
- sessions: Session[];
49
-
50
- next_scheduled_slot?: DB.InstanceSlot;
51
-
52
- org_id?: DB.Org['org_id'];
53
- org?: DB.Org;
54
-
55
- service_id?: DB.Service['service_id'];
56
- service?: DB.Service;
57
-
58
- facility_ids?: DB.Facility['facility_id'][];
59
- facilities?: DB.Facility;
60
-
61
- instance_id?: DB.Instance['instance_id'];
62
- instance?: DB.Instance;
63
-
64
- signup_form?: DB.Form;
5
+ readonly schedule_id: string;
6
+
7
+ details: {
8
+ descname?: string;
9
+ description?: string;
10
+ date?: string;
11
+ hide_overlapping_schedules: boolean;
12
+ timezone?: string;
13
+ repeat_settings: {
14
+ frequency?: "DAILY" | "WEEKLY" | "MONTHLY" | "YEARLY";
15
+ interval?: number;
16
+ count?: number;
17
+ until?: string;
18
+ byweekday?: ("SU" | "MO" | "TU" | "WE" | "TH" | "FR" | "SA")[];
19
+ byweekno?: number[];
20
+ bymonth?: number[];
21
+ bymonthday?: number[];
22
+ bysetpos?: number[];
23
+ };
24
+ instance_settings: {
25
+ is_public: boolean;
26
+ max_seats?: number;
27
+ min_seats: number;
28
+ max_slots?: number;
29
+ min_slots: number;
30
+ max_lead_time?: number;
31
+ min_lead_time: number;
32
+ rate_application: "per_slot" | "per_seat";
33
+ approval_required?: boolean;
34
+ signup_form?: {
35
+ form_id: DB.Form["form_id"];
36
+ };
37
+ };
38
+ };
39
+ config: {
40
+ hidden: boolean;
41
+ };
42
+
43
+ parent_schedule?: {
44
+ schedule_id: DB.Schedule["schedule_id"];
45
+ session_id: Session["session_id"];
46
+ };
47
+
48
+ sessions: Session[];
49
+
50
+ next_scheduled_slot?: DB.InstanceSlot;
51
+
52
+ org_id?: DB.Org["org_id"];
53
+ org?: DB.Org;
54
+
55
+ service_id?: DB.Service["service_id"];
56
+ service?: DB.Service;
57
+
58
+ facility_ids?: DB.Facility["facility_id"][];
59
+ facilities?: DB.Facility;
60
+
61
+ instance_id?: DB.Instance["instance_id"];
62
+ instance?: DB.Instance;
63
+
64
+ signup_form?: DB.Form;
65
65
  }
66
66
 
67
67
  export interface Session extends Base {
68
- readonly session_id: string;
68
+ readonly session_id: string;
69
69
 
70
- descname?: string;
71
- start_time?: number;
72
- duration?: number;
73
- slot_duration?: number;
74
- max_instances?: number;
75
- rates: Rate[];
70
+ descname?: string;
71
+ start_time?: number;
72
+ duration?: number;
73
+ slot_duration?: number;
74
+ max_instances?: number;
75
+ rates: Rate[];
76
76
 
77
- schedule_id: string; // Fake
77
+ schedule_id: string; // Fake
78
78
  }
79
79
 
80
80
  export interface Rate {
81
- rate: number;
82
- conditions?: Condition[];
81
+ rate: number;
82
+ conditions?: Condition[];
83
83
 
84
- session_id?: string; // Fake
85
- schedule_id?: string; // Fake
84
+ session_id?: string; // Fake
85
+ schedule_id?: string; // Fake
86
86
  }
87
87
 
88
88
  export interface Condition {
89
- type?: ConditionType;
90
- service_id?: DB.Service['service_id'];
89
+ type?: ConditionType;
90
+ service_id?: DB.Service["service_id"];
91
91
  }
92
92
 
93
93
  // This is compiled by the API – does not appear in the Schema
94
94
  export interface Slot {
95
- applicable_rate: number;
96
- schedule_id: string;
97
- session_id: string;
98
- date: string;
99
- start_time: number;
100
- end_time: number;
101
- duration: number;
102
- rate: number;
95
+ applicable_rate: number;
96
+ schedule_id: string;
97
+ session_id: string;
98
+ date: string;
99
+ start_time: number;
100
+ end_time: number;
101
+ duration: number;
102
+ rate: number;
103
103
  }
104
104
 
105
- type ConditionType = 'seat_in_service';
105
+ type ConditionType = "seat_in_service";
@@ -0,0 +1,28 @@
1
+ import { Base } from "../base.schema";
2
+ import { GeoLocation } from "../common";
3
+ import { File } from "./file.schema";
4
+ import { Servicetype } from "./servicetype.schema";
5
+
6
+ export interface Searchentry extends Base {
7
+ readonly searchentry_id: string;
8
+
9
+ details?: {
10
+ descname?: string;
11
+ description?: string;
12
+ url?: string;
13
+ address_string?: string;
14
+ date?: string;
15
+ price?: string;
16
+ geo_location?: GeoLocation;
17
+ card_background_file_id?: string;
18
+ repeat_period?: "daily" | "weekly" | "monthly" | "none";
19
+ org_name?: string;
20
+ };
21
+
22
+ type?: "community" | "facility_hire" | "activity" | "none";
23
+
24
+ card_background_file?: Partial<File>;
25
+
26
+ servicetype_ids: string[];
27
+ servicetypes?: Servicetype[];
28
+ }
@@ -1,19 +1,19 @@
1
- import type { Base } from '../base.schema';
2
- import type * as DB from '../index';
1
+ import type { Base } from "../base.schema";
2
+ import type * as DB from "../index";
3
3
 
4
4
  export interface Seat extends Base {
5
- readonly seat_id: string;
5
+ readonly seat_id: string;
6
6
 
7
- profile_id?: DB.Profile['profile_id'];
8
- profile?: DB.Profile;
7
+ profile_id?: DB.Profile["profile_id"];
8
+ profile?: DB.Profile;
9
9
 
10
- email_address?: string;
11
- amount_due?: number;
10
+ email_address?: string;
11
+ amount_due?: number;
12
12
 
13
- applicable_rate?: number;
14
- standard_rate?: number;
15
- discount?: number;
13
+ applicable_rate?: number;
14
+ standard_rate?: number;
15
+ discount?: number;
16
16
 
17
- instance_id?: DB.Instance['instance_id'];
18
- instance?: DB.Instance;
19
- }
17
+ instance_id?: DB.Instance["instance_id"];
18
+ instance?: DB.Instance;
19
+ }
@@ -1,33 +1,35 @@
1
- import type { Photo } from '../common';
2
- import type { Base } from '../base.schema';
3
- import type * as DB from '../index';
1
+ import type { Photo } from "../common";
2
+ import type { Base } from "../base.schema";
3
+ import type * as DB from "../index";
4
4
 
5
5
  export interface Service extends Base {
6
- readonly service_id: string;
6
+ readonly service_id: string;
7
7
 
8
- details: {
9
- descname?: string;
10
- description?: string;
11
- logo_file_id?: string;
12
- };
13
- config: {
14
- active_cover_file_ids: Record<string, boolean>;
15
- display_contactpoint_ids: Record<string, boolean>;
16
- };
8
+ details: {
9
+ descname?: string;
10
+ description?: string;
11
+ logo_file_id?: string;
12
+ };
17
13
 
18
- cover_files: Photo[];
19
- display_contactpoints: DB.Contactpoint[];
14
+ cover_files: Photo[];
15
+ display_contactpoints: DB.Contactpoint[];
20
16
 
21
- org_id?: DB.Org['org_id'];
22
- org?: DB.Org;
17
+ org_id?: DB.Org["org_id"];
18
+ org?: DB.Org;
23
19
 
24
- servicetype_id?: DB.Servicetype['servicetype_id'];
25
- servicetype?: DB.Servicetype;
20
+ servicetype_id?: DB.Servicetype["servicetype_id"];
21
+ servicetype?: DB.Servicetype;
26
22
 
27
- location_id?: DB.Location['location_id'];
28
- location?: DB.Location;
23
+ location_id?: DB.Location["location_id"];
24
+ location?: DB.Location;
29
25
 
30
- schedules?: DB.Schedule[];
26
+ schedules?: DB.Schedule[];
31
27
 
32
- logo_file?: Photo;
28
+ logo_file?: Photo;
29
+
30
+ config: {
31
+ disable?: boolean;
32
+ hidden?: boolean;
33
+ active_cover_file_ids: Record<string, number>;
34
+ };
33
35
  }
@@ -1,19 +1,17 @@
1
- import type { Base } from '../base.schema';
1
+ import type { Base } from "../base.schema";
2
2
 
3
3
  export interface Servicetype extends Base {
4
- readonly servicetype_id: string;
4
+ readonly servicetype_id: string;
5
5
 
6
- details: {
7
- descname?: string;
8
- description?: string;
9
- servicecategory: ServiceCategories;
10
- icon_class?: string;
11
- sport_icon_class?: string;
12
- };
13
- config: {
14
- hidden: boolean;
15
- disabled: boolean;
16
- };
6
+ details: {
7
+ descname?: string;
8
+ description?: string;
9
+ servicecategory: ServiceCategories;
10
+ icon_class?: string;
11
+ };
12
+ config: {
13
+ hidden: boolean;
14
+ };
17
15
  }
18
16
 
19
- type ServiceCategories = 'membership' | 'facility_hire' | 'activity' | 'event';
17
+ type ServiceCategories = "membership" | "facility_hire" | "activity";
@@ -1,13 +1,13 @@
1
- import type { Base } from '../base.schema';
1
+ import type { Base } from "../base.schema";
2
2
 
3
3
  export interface Token extends Base {
4
- readonly token_id: string;
4
+ readonly token_id: string;
5
5
 
6
- expiry_date?: string;
7
- token_category?: TokenCategory;
8
- payload: {
9
- [x: string]: any;
10
- };
6
+ expiry_date?: string;
7
+ token_category?: TokenCategory;
8
+ payload: {
9
+ [x: string]: any;
10
+ };
11
11
  }
12
12
 
13
- type TokenCategory = 'account_verification' | 'account_recovery' | 'whatsapp_token';
13
+ type TokenCategory = "account_verification" | "account_recovery" | "whatsapp_token";
package/common.d.ts CHANGED
@@ -1,18 +1,18 @@
1
1
  export type Coordinates = { readonly lat: number; readonly lng: number };
2
- export type GeoLocation = { readonly type: 'Point'; coordinates: Readonly<[number, number]> };
2
+ export type GeoLocation = { readonly type: "Point"; coordinates: [number, number] };
3
3
  export type Photo = {
4
- readonly file_id?: string;
5
- readonly access_url?: string;
6
- readonly source?: string;
4
+ readonly file_id?: string;
5
+ readonly access_url?: string;
6
+ readonly source?: string;
7
7
  };
8
8
  export type ContactInfo = {
9
- operating_hours?: string;
10
- mobile_number?: string;
11
- email_address?: string;
9
+ operating_hours?: string;
10
+ mobile_number?: string;
11
+ email_address?: string;
12
12
  };
13
13
 
14
14
  export type ContactMethod = {
15
- whatsapp?: boolean;
16
- email?: boolean;
17
- sms?: boolean;
15
+ whatsapp?: boolean;
16
+ email?: boolean;
17
+ sms?: boolean;
18
18
  };
package/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export * from "./collections/org.schema";
11
11
  export * from "./collections/payment.schema";
12
12
  export * from "./collections/profile.schema";
13
13
  export * from "./collections/schedule.schema";
14
+ export * from "./collections/searchentry.schema";
14
15
  export * from "./collections/seat.schema";
15
16
  export * from "./collections/service.schema";
16
17
  export * from "./collections/servicetype.schema";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unaffi/schema",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "This reflects what the API returns, and not what the DB Schema looks like in MongoDB. Can be imported into any repo and be used by both TS and JS (JSDocs) code.",
5
5
  "types": "index.d.ts",
6
6
  "scripts": {