@jsm-mit/sultana-core-motoko-package 0.0.2 → 0.0.3
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 +74 -1
- package/declarations/sultana-core-motoko/sultana-core-motoko.did +358 -59
- package/declarations/sultana-core-motoko/sultana-core-motoko.did.d.ts +314 -62
- package/declarations/sultana-core-motoko/sultana-core-motoko.did.js +339 -62
- package/dist/actor-base.d.ts +27 -0
- package/dist/actor-base.d.ts.map +1 -0
- package/dist/actor-base.js +99 -0
- package/dist/actors/admin-actor.d.ts +64 -0
- package/dist/actors/admin-actor.d.ts.map +1 -0
- package/dist/actors/admin-actor.js +88 -0
- package/dist/actors/appointments-actor.d.ts +31 -0
- package/dist/actors/appointments-actor.d.ts.map +1 -0
- package/dist/actors/appointments-actor.js +46 -0
- package/dist/actors/availability-actor.d.ts +109 -0
- package/dist/actors/availability-actor.d.ts.map +1 -0
- package/dist/actors/availability-actor.js +228 -0
- package/dist/actors/bulk-actor.d.ts +72 -0
- package/dist/actors/bulk-actor.d.ts.map +1 -0
- package/dist/actors/bulk-actor.js +84 -0
- package/dist/actors/hr-actor.d.ts +65 -0
- package/dist/actors/hr-actor.d.ts.map +1 -0
- package/dist/actors/hr-actor.js +92 -0
- package/dist/actors/migration-actor.d.ts +113 -0
- package/dist/actors/migration-actor.d.ts.map +1 -0
- package/dist/actors/migration-actor.js +165 -0
- package/dist/actors/salon-services-actor.d.ts +96 -0
- package/dist/actors/salon-services-actor.d.ts.map +1 -0
- package/dist/actors/salon-services-actor.js +143 -0
- package/dist/actors/salons-actor.d.ts +35 -0
- package/dist/actors/salons-actor.d.ts.map +1 -0
- package/dist/actors/salons-actor.js +48 -0
- package/dist/actors/search-actor.d.ts +128 -0
- package/dist/actors/search-actor.d.ts.map +1 -0
- package/dist/actors/search-actor.js +307 -0
- package/dist/actors/service-types-actor.d.ts +32 -0
- package/dist/actors/service-types-actor.d.ts.map +1 -0
- package/dist/actors/service-types-actor.js +39 -0
- package/dist/actors/user-profiles-actor.d.ts +27 -0
- package/dist/actors/user-profiles-actor.d.ts.map +1 -0
- package/dist/actors/user-profiles-actor.js +36 -0
- package/dist/actors/visits-actor.d.ts +80 -0
- package/dist/actors/visits-actor.d.ts.map +1 -0
- package/dist/actors/visits-actor.js +115 -0
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -1
- package/dist/interfaces.d.ts +8 -0
- package/dist/interfaces.d.ts.map +1 -0
- package/dist/interfaces.js +1 -0
- package/dist/mappers.d.ts +4 -0
- package/dist/mappers.d.ts.map +1 -0
- package/dist/mappers.js +8 -0
- package/dist/utils/time-parsing.d.ts +17 -0
- package/dist/utils/time-parsing.d.ts.map +1 -0
- package/dist/utils/time-parsing.js +46 -0
- package/package.json +33 -11
- package/dist/sultana-core-motoko-actor.d.ts +0 -22
- package/dist/sultana-core-motoko-actor.d.ts.map +0 -1
- package/dist/sultana-core-motoko-actor.js +0 -58
package/README.md
CHANGED
|
@@ -1,3 +1,76 @@
|
|
|
1
1
|
# Sultana Core Motoko Package
|
|
2
2
|
|
|
3
|
-
A TypeScript library for interacting with the Sultana Core Motoko actor on the Internet Computer (IC) platform.
|
|
3
|
+
A TypeScript library for interacting with the Sultana Core Motoko actor on the Internet Computer (IC) platform.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
### 1. Create dfx identities
|
|
8
|
+
|
|
9
|
+
Create the required identities:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
dfx identity new superadmin
|
|
13
|
+
dfx identity new owner1
|
|
14
|
+
dfx identity new worker1
|
|
15
|
+
dfx identity new customer1
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### 2. Export PEM values
|
|
19
|
+
|
|
20
|
+
Export the PEM for each identity and copy the output:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
dfx identity export superadmin
|
|
24
|
+
dfx identity export owner1
|
|
25
|
+
dfx identity export worker1
|
|
26
|
+
dfx identity export customer1
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 3. Configure .env
|
|
30
|
+
|
|
31
|
+
Paste each PEM value into the corresponding variable in your `.env` file:
|
|
32
|
+
|
|
33
|
+
```env
|
|
34
|
+
IDENTITY_PEM="-----BEGIN EC PRIVATE KEY-----
|
|
35
|
+
...superadmin PEM here...
|
|
36
|
+
-----END EC PRIVATE KEY-----"
|
|
37
|
+
|
|
38
|
+
OWNER1_PEM="-----BEGIN EC PRIVATE KEY-----
|
|
39
|
+
...owner1 PEM here...
|
|
40
|
+
-----END EC PRIVATE KEY-----"
|
|
41
|
+
|
|
42
|
+
WORKER1_PEM="-----BEGIN EC PRIVATE KEY-----
|
|
43
|
+
...worker1 PEM here...
|
|
44
|
+
-----END EC PRIVATE KEY-----"
|
|
45
|
+
|
|
46
|
+
CUSTOMER1_PEM="-----BEGIN EC PRIVATE KEY-----
|
|
47
|
+
...customer1 PEM here...
|
|
48
|
+
-----END EC PRIVATE KEY-----"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
> Make sure to keep newlines inside the PEM value — wrap the value in double quotes and preserve the line breaks exactly as exported.
|
|
52
|
+
|
|
53
|
+
## Tests
|
|
54
|
+
|
|
55
|
+
Tests are integration tests that run against a dedicated test canister on **mainnet** — no local replica is used.
|
|
56
|
+
|
|
57
|
+
### Prerequisites
|
|
58
|
+
|
|
59
|
+
Complete the [Setup](#setup) section first. Then copy `.env.example` to `.env` and fill in `CANISTER_ID` and all PEM values.
|
|
60
|
+
|
|
61
|
+
### Available test scripts
|
|
62
|
+
|
|
63
|
+
Each script redeploys the test canister before running.
|
|
64
|
+
|
|
65
|
+
| Script | Description |
|
|
66
|
+
|---|---|
|
|
67
|
+
| `npm run test-suite` | Full integration test — covers admin, profiles, service types, salons, HR, availability, booking, search, and visits |
|
|
68
|
+
| `npm run test-tomorrow` | Same as `test-suite` but with `referenceDate` set to tomorrow |
|
|
69
|
+
| `npm run test-access-restrictions` | Role-based access control tests |
|
|
70
|
+
| `npm run test-migration-simple` | Data migration tests |
|
|
71
|
+
|
|
72
|
+
### Notes
|
|
73
|
+
|
|
74
|
+
- Tests require an active internet connection and a valid `CANISTER_ID` in `.env`.
|
|
75
|
+
- After any write (update call), the IC needs a moment to propagate state — tests include a `waitFor(5000)` delay before subsequent reads to avoid non-deterministic results.
|
|
76
|
+
- **If a test fails, the first thing to check is whether state had enough time to propagate.** Rerun the test before investigating logic errors — transient propagation lag is the most common cause of false failures on mainnet.
|
|
@@ -1,8 +1,63 @@
|
|
|
1
|
+
type WorkerRelationship =
|
|
2
|
+
record {
|
|
3
|
+
salonId: SalonId;
|
|
4
|
+
workerIds: vec principal;
|
|
5
|
+
};
|
|
6
|
+
type WorkerId = text;
|
|
7
|
+
type WeeklyTemplate =
|
|
8
|
+
record {
|
|
9
|
+
day: DayOfWeek;
|
|
10
|
+
mask: TimeMask;
|
|
11
|
+
salonId: SalonId;
|
|
12
|
+
workerId: principal;
|
|
13
|
+
};
|
|
14
|
+
type VisitPayment =
|
|
15
|
+
record {
|
|
16
|
+
amount: nat;
|
|
17
|
+
id: nat;
|
|
18
|
+
method: PaymentMethod;
|
|
19
|
+
};
|
|
20
|
+
type VisitItem =
|
|
21
|
+
record {
|
|
22
|
+
id: nat;
|
|
23
|
+
name: text;
|
|
24
|
+
performedById: principal;
|
|
25
|
+
price: nat;
|
|
26
|
+
salonServiceId: opt SalonServiceId;
|
|
27
|
+
};
|
|
28
|
+
type VisitId = text;
|
|
29
|
+
type Visit =
|
|
30
|
+
record {
|
|
31
|
+
appointmentId: opt AppointmentId;
|
|
32
|
+
clientName: text;
|
|
33
|
+
createdAt: nat64;
|
|
34
|
+
createdById: principal;
|
|
35
|
+
currency: text;
|
|
36
|
+
customerId: opt principal;
|
|
37
|
+
id: VisitId;
|
|
38
|
+
items: vec VisitItem;
|
|
39
|
+
notes: text;
|
|
40
|
+
payments: vec VisitPayment;
|
|
41
|
+
salonId: SalonId;
|
|
42
|
+
updatedAt: nat64;
|
|
43
|
+
updatedById: principal;
|
|
44
|
+
version: nat;
|
|
45
|
+
};
|
|
1
46
|
type UserProfile =
|
|
2
47
|
record {
|
|
3
48
|
avatarUrl: opt text;
|
|
4
49
|
id: principal;
|
|
5
50
|
name: text;
|
|
51
|
+
whatsAppNumber: opt text;
|
|
52
|
+
};
|
|
53
|
+
type UpdateVisitArgs =
|
|
54
|
+
record {
|
|
55
|
+
clientName: text;
|
|
56
|
+
customerId: opt principal;
|
|
57
|
+
items: vec CreateVisitItemArgs;
|
|
58
|
+
notes: text;
|
|
59
|
+
payments: vec CreateVisitPaymentArgs;
|
|
60
|
+
visitId: VisitId;
|
|
6
61
|
};
|
|
7
62
|
type UpdateSalonServiceArgs =
|
|
8
63
|
record {
|
|
@@ -10,7 +65,7 @@ type UpdateSalonServiceArgs =
|
|
|
10
65
|
duration: nat;
|
|
11
66
|
name: text;
|
|
12
67
|
price: nat;
|
|
13
|
-
|
|
68
|
+
salonServiceId: SalonServiceId;
|
|
14
69
|
serviceTypeIds: vec ServiceTypeId;
|
|
15
70
|
workerIds: vec principal;
|
|
16
71
|
};
|
|
@@ -18,13 +73,7 @@ type UpdateProfileArgs =
|
|
|
18
73
|
record {
|
|
19
74
|
avatarUrl: opt text;
|
|
20
75
|
name: text;
|
|
21
|
-
|
|
22
|
-
type ToggleWorkerCapabilityArgs =
|
|
23
|
-
record {
|
|
24
|
-
canPerform: bool;
|
|
25
|
-
salonId: SalonId;
|
|
26
|
-
salonServiceId: SalonServiceId;
|
|
27
|
-
workerId: principal;
|
|
76
|
+
whatsAppNumber: opt text;
|
|
28
77
|
};
|
|
29
78
|
type TimeMask = vec nat64;
|
|
30
79
|
type SetWeeklyTemplateArgs =
|
|
@@ -41,6 +90,14 @@ type SetDailyScheduleArgs =
|
|
|
41
90
|
workerId: principal;
|
|
42
91
|
};
|
|
43
92
|
type ServiceTypeId = text;
|
|
93
|
+
type SearchForSalonServicesArgs =
|
|
94
|
+
record {
|
|
95
|
+
geohashes6: vec Geohash;
|
|
96
|
+
serviceTypeId: ServiceTypeId;
|
|
97
|
+
startTimeUTC: nat64;
|
|
98
|
+
targetCount: opt nat8;
|
|
99
|
+
timeOffset: int;
|
|
100
|
+
};
|
|
44
101
|
type SalonServiceId = text;
|
|
45
102
|
type SalonService =
|
|
46
103
|
record {
|
|
@@ -57,6 +114,11 @@ type SalonService =
|
|
|
57
114
|
workerIds: vec principal;
|
|
58
115
|
};
|
|
59
116
|
type SalonId = text;
|
|
117
|
+
type SalonCandidatesEntry =
|
|
118
|
+
record {
|
|
119
|
+
candidateIds: vec principal;
|
|
120
|
+
salonId: SalonId;
|
|
121
|
+
};
|
|
60
122
|
type Salon =
|
|
61
123
|
record {
|
|
62
124
|
active: bool;
|
|
@@ -67,25 +129,31 @@ type Salon =
|
|
|
67
129
|
name: text;
|
|
68
130
|
ownerId: principal;
|
|
69
131
|
};
|
|
132
|
+
type Role =
|
|
133
|
+
variant {
|
|
134
|
+
Customer;
|
|
135
|
+
Owner;
|
|
136
|
+
Worker;
|
|
137
|
+
};
|
|
70
138
|
type Result_9 =
|
|
71
139
|
variant {
|
|
72
140
|
err: Error;
|
|
73
|
-
ok:
|
|
141
|
+
ok: vec ServiceTypeId;
|
|
74
142
|
};
|
|
75
143
|
type Result_8 =
|
|
76
144
|
variant {
|
|
77
145
|
err: Error;
|
|
78
|
-
ok:
|
|
146
|
+
ok: Visit;
|
|
79
147
|
};
|
|
80
148
|
type Result_7 =
|
|
81
149
|
variant {
|
|
82
150
|
err: Error;
|
|
83
|
-
ok: vec
|
|
151
|
+
ok: vec Visit;
|
|
84
152
|
};
|
|
85
153
|
type Result_6 =
|
|
86
154
|
variant {
|
|
87
155
|
err: Error;
|
|
88
|
-
ok: vec
|
|
156
|
+
ok: vec UserProfile;
|
|
89
157
|
};
|
|
90
158
|
type Result_5 =
|
|
91
159
|
variant {
|
|
@@ -95,39 +163,98 @@ type Result_5 =
|
|
|
95
163
|
type Result_4 =
|
|
96
164
|
variant {
|
|
97
165
|
err: Error;
|
|
98
|
-
ok:
|
|
166
|
+
ok: nat;
|
|
99
167
|
};
|
|
100
168
|
type Result_3 =
|
|
101
169
|
variant {
|
|
102
170
|
err: Error;
|
|
103
|
-
ok:
|
|
171
|
+
ok: principal;
|
|
172
|
+
};
|
|
173
|
+
type Result_21 =
|
|
174
|
+
variant {
|
|
175
|
+
err: Error;
|
|
176
|
+
ok: SalonServiceId;
|
|
177
|
+
};
|
|
178
|
+
type Result_20 =
|
|
179
|
+
variant {
|
|
180
|
+
err: Error;
|
|
181
|
+
ok: AppointmentId;
|
|
104
182
|
};
|
|
105
183
|
type Result_2 =
|
|
106
184
|
variant {
|
|
107
185
|
err: Error;
|
|
108
|
-
ok:
|
|
186
|
+
ok: UserProfile;
|
|
187
|
+
};
|
|
188
|
+
type Result_19 =
|
|
189
|
+
variant {
|
|
190
|
+
err: Error;
|
|
191
|
+
ok: vec SalonServiceId;
|
|
192
|
+
};
|
|
193
|
+
type Result_18 =
|
|
194
|
+
variant {
|
|
195
|
+
err: Error;
|
|
196
|
+
ok: vec SalonId;
|
|
197
|
+
};
|
|
198
|
+
type Result_17 =
|
|
199
|
+
variant {
|
|
200
|
+
err: Error;
|
|
201
|
+
ok: SalonId;
|
|
202
|
+
};
|
|
203
|
+
type Result_16 =
|
|
204
|
+
variant {
|
|
205
|
+
err: Error;
|
|
206
|
+
ok: record {
|
|
207
|
+
customer: nat;
|
|
208
|
+
owner: nat;
|
|
209
|
+
worker: nat;
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
type Result_15 =
|
|
213
|
+
variant {
|
|
214
|
+
err: Error;
|
|
215
|
+
ok: vec Appointment;
|
|
216
|
+
};
|
|
217
|
+
type Result_14 =
|
|
218
|
+
variant {
|
|
219
|
+
err: Error;
|
|
220
|
+
ok: vec DailyScheduleEntry;
|
|
221
|
+
};
|
|
222
|
+
type Result_13 =
|
|
223
|
+
variant {
|
|
224
|
+
err: Error;
|
|
225
|
+
ok: vec nat64;
|
|
226
|
+
};
|
|
227
|
+
type Result_12 =
|
|
228
|
+
variant {
|
|
229
|
+
err: Error;
|
|
230
|
+
ok: TimeMask;
|
|
109
231
|
};
|
|
110
232
|
type Result_11 =
|
|
111
233
|
variant {
|
|
112
234
|
err: Error;
|
|
113
|
-
ok:
|
|
235
|
+
ok: MigrationData;
|
|
114
236
|
};
|
|
115
237
|
type Result_10 =
|
|
116
238
|
variant {
|
|
117
239
|
err: Error;
|
|
118
|
-
ok:
|
|
240
|
+
ok: vec Salon;
|
|
119
241
|
};
|
|
120
242
|
type Result_1 =
|
|
121
243
|
variant {
|
|
122
244
|
err: Error;
|
|
123
|
-
ok:
|
|
245
|
+
ok: bool;
|
|
124
246
|
};
|
|
125
247
|
type Result =
|
|
126
248
|
variant {
|
|
127
249
|
err: Error;
|
|
128
|
-
ok;
|
|
250
|
+
ok: VisitId;
|
|
129
251
|
};
|
|
130
252
|
type RequestToJoinArgs = record {salonId: SalonId;};
|
|
253
|
+
type RemoveWorkerFromSalonArgs =
|
|
254
|
+
record {
|
|
255
|
+
salonId: SalonId;
|
|
256
|
+
workerId: principal;
|
|
257
|
+
};
|
|
131
258
|
type RemoveDailyScheduleArgs =
|
|
132
259
|
record {
|
|
133
260
|
date: nat64;
|
|
@@ -138,6 +265,47 @@ type RejectCandidateArgs =
|
|
|
138
265
|
salonId: SalonId;
|
|
139
266
|
workerId: principal;
|
|
140
267
|
};
|
|
268
|
+
type PaymentMethod =
|
|
269
|
+
variant {
|
|
270
|
+
Card;
|
|
271
|
+
Cash;
|
|
272
|
+
Other: text;
|
|
273
|
+
};
|
|
274
|
+
type MigrationQueryArgs =
|
|
275
|
+
record {
|
|
276
|
+
entity: MigrationEntity;
|
|
277
|
+
from: nat;
|
|
278
|
+
to: nat;
|
|
279
|
+
};
|
|
280
|
+
type MigrationEntity =
|
|
281
|
+
variant {
|
|
282
|
+
Appointments;
|
|
283
|
+
SalonCandidates;
|
|
284
|
+
SalonServices;
|
|
285
|
+
Salons;
|
|
286
|
+
UserProfiles;
|
|
287
|
+
Visits;
|
|
288
|
+
WeeklyTemplates;
|
|
289
|
+
WorkerRelationships;
|
|
290
|
+
};
|
|
291
|
+
type MigrationData =
|
|
292
|
+
variant {
|
|
293
|
+
Appointments: vec Appointment;
|
|
294
|
+
SalonCandidates: vec SalonCandidatesEntry;
|
|
295
|
+
SalonServices: vec SalonService;
|
|
296
|
+
Salons: vec Salon;
|
|
297
|
+
UserProfiles: vec UserProfile;
|
|
298
|
+
Visits: vec Visit;
|
|
299
|
+
WeeklyTemplates: vec WeeklyTemplate;
|
|
300
|
+
WorkerRelationships: vec WorkerRelationship;
|
|
301
|
+
};
|
|
302
|
+
type GetEffectiveMaskForSalonArgs =
|
|
303
|
+
record {
|
|
304
|
+
date: nat64;
|
|
305
|
+
salonId: SalonId;
|
|
306
|
+
timeOffset: int;
|
|
307
|
+
workerId: principal;
|
|
308
|
+
};
|
|
141
309
|
type GetDayFromWeeklyTemplateArgs =
|
|
142
310
|
record {
|
|
143
311
|
day: DayOfWeek;
|
|
@@ -150,15 +318,55 @@ type GetDailyScheduleArgs =
|
|
|
150
318
|
workerId: principal;
|
|
151
319
|
};
|
|
152
320
|
type Geohash = text;
|
|
153
|
-
type
|
|
321
|
+
type ErrorDetails =
|
|
154
322
|
variant {
|
|
155
323
|
AlreadyExists;
|
|
324
|
+
InterCanisterConnectionError;
|
|
156
325
|
InvalidData: text;
|
|
157
326
|
NotAuthorized: text;
|
|
158
327
|
NotFound;
|
|
328
|
+
RemoteCanisterError: text;
|
|
159
329
|
ReturnsNull;
|
|
160
330
|
};
|
|
331
|
+
type Error =
|
|
332
|
+
record {
|
|
333
|
+
details: ErrorDetails;
|
|
334
|
+
logsJson: text;
|
|
335
|
+
};
|
|
161
336
|
type DayOfWeek = nat;
|
|
337
|
+
type DailyScheduleRangeArgs =
|
|
338
|
+
record {
|
|
339
|
+
fromDate: nat64;
|
|
340
|
+
toDate: nat64;
|
|
341
|
+
};
|
|
342
|
+
type DailyScheduleEntry =
|
|
343
|
+
record {
|
|
344
|
+
date: nat64;
|
|
345
|
+
mask: TimeMask;
|
|
346
|
+
workerId: principal;
|
|
347
|
+
};
|
|
348
|
+
type CreateVisitPaymentArgs =
|
|
349
|
+
record {
|
|
350
|
+
amount: nat;
|
|
351
|
+
method: PaymentMethod;
|
|
352
|
+
};
|
|
353
|
+
type CreateVisitItemArgs =
|
|
354
|
+
record {
|
|
355
|
+
name: text;
|
|
356
|
+
performedById: principal;
|
|
357
|
+
price: nat;
|
|
358
|
+
salonServiceId: opt SalonServiceId;
|
|
359
|
+
};
|
|
360
|
+
type CreateVisitArgs =
|
|
361
|
+
record {
|
|
362
|
+
appointmentId: opt AppointmentId;
|
|
363
|
+
clientName: opt text;
|
|
364
|
+
customerId: opt principal;
|
|
365
|
+
items: vec CreateVisitItemArgs;
|
|
366
|
+
notes: text;
|
|
367
|
+
payments: vec CreateVisitPaymentArgs;
|
|
368
|
+
salonId: SalonId;
|
|
369
|
+
};
|
|
162
370
|
type CreateSalonArgs =
|
|
163
371
|
record {
|
|
164
372
|
address: text;
|
|
@@ -171,17 +379,66 @@ type Coordinate =
|
|
|
171
379
|
lat: float64;
|
|
172
380
|
lng: float64;
|
|
173
381
|
};
|
|
382
|
+
type BulkSetWeeklyTemplatesArgs =
|
|
383
|
+
record {
|
|
384
|
+
delegatedCaller: principal;
|
|
385
|
+
items: vec SetWeeklyTemplateArgs;
|
|
386
|
+
};
|
|
387
|
+
type BulkRequestToJoinSalonsArgs =
|
|
388
|
+
record {
|
|
389
|
+
delegatedCaller: principal;
|
|
390
|
+
salonIds: vec SalonId;
|
|
391
|
+
};
|
|
392
|
+
type BulkCreateSalonsArgs =
|
|
393
|
+
record {
|
|
394
|
+
delegatedCaller: principal;
|
|
395
|
+
items: vec CreateSalonArgs;
|
|
396
|
+
};
|
|
397
|
+
type BulkAddSalonServicesArgs =
|
|
398
|
+
record {
|
|
399
|
+
delegatedCaller: principal;
|
|
400
|
+
items: vec AddSalonServiceArgs;
|
|
401
|
+
};
|
|
402
|
+
type BulkAcceptWorkersArgs =
|
|
403
|
+
record {
|
|
404
|
+
delegatedCaller: principal;
|
|
405
|
+
items: vec AcceptWorkerArgs;
|
|
406
|
+
};
|
|
174
407
|
type BookAppointmentArgs =
|
|
175
408
|
record {
|
|
176
|
-
|
|
177
|
-
dayOfWeek: DayOfWeek;
|
|
178
|
-
notes: opt text;
|
|
409
|
+
notes: text;
|
|
179
410
|
salonId: SalonId;
|
|
180
411
|
salonServiceId: SalonServiceId;
|
|
181
|
-
|
|
412
|
+
startTimeUTC: nat64;
|
|
413
|
+
timeOffset: int;
|
|
182
414
|
workerId: principal;
|
|
183
415
|
};
|
|
416
|
+
type AppointmentStatus =
|
|
417
|
+
variant {
|
|
418
|
+
Cancelled;
|
|
419
|
+
Completed;
|
|
420
|
+
Confirmed;
|
|
421
|
+
NoShow;
|
|
422
|
+
Pending;
|
|
423
|
+
};
|
|
184
424
|
type AppointmentId = text;
|
|
425
|
+
type Appointment =
|
|
426
|
+
record {
|
|
427
|
+
createdAt: nat64;
|
|
428
|
+
currency: text;
|
|
429
|
+
customerId: principal;
|
|
430
|
+
durationMinutes: nat;
|
|
431
|
+
id: AppointmentId;
|
|
432
|
+
lastUpdatedAt: nat64;
|
|
433
|
+
notes: text;
|
|
434
|
+
priceSnapshot: nat;
|
|
435
|
+
salonId: SalonId;
|
|
436
|
+
salonServiceId: SalonServiceId;
|
|
437
|
+
startTimeUTC: nat64;
|
|
438
|
+
status: AppointmentStatus;
|
|
439
|
+
timeOffset: int;
|
|
440
|
+
workerId: principal;
|
|
441
|
+
};
|
|
185
442
|
type AddSalonServiceArgs =
|
|
186
443
|
record {
|
|
187
444
|
active: bool;
|
|
@@ -192,6 +449,16 @@ type AddSalonServiceArgs =
|
|
|
192
449
|
serviceTypeIds: vec ServiceTypeId;
|
|
193
450
|
workerIds: vec principal;
|
|
194
451
|
};
|
|
452
|
+
type AddOrRemoveWorkerInSalonArgs =
|
|
453
|
+
record {
|
|
454
|
+
salonServiceId: SalonServiceId;
|
|
455
|
+
workerId: WorkerId;
|
|
456
|
+
};
|
|
457
|
+
type AddOrRemoveServiceTypeInSalonArgs =
|
|
458
|
+
record {
|
|
459
|
+
salonServiceId: SalonServiceId;
|
|
460
|
+
serviceTypeId: ServiceTypeId;
|
|
461
|
+
};
|
|
195
462
|
type AcceptWorkerArgs =
|
|
196
463
|
record {
|
|
197
464
|
salonId: SalonId;
|
|
@@ -199,48 +466,80 @@ type AcceptWorkerArgs =
|
|
|
199
466
|
};
|
|
200
467
|
service : {
|
|
201
468
|
/// Owner accepts a candidate into the team
|
|
202
|
-
acceptWorker: (args: AcceptWorkerArgs) -> (
|
|
469
|
+
acceptWorker: (args: AcceptWorkerArgs) -> (Result_1);
|
|
203
470
|
/// Adds a new service to a specific salon
|
|
204
|
-
addSalonService: (args: AddSalonServiceArgs) -> (
|
|
205
|
-
addServiceType: (id: ServiceTypeId) -> (
|
|
206
|
-
|
|
471
|
+
addSalonService: (args: AddSalonServiceArgs) -> (Result_21);
|
|
472
|
+
addServiceType: (id: ServiceTypeId) -> (Result_1);
|
|
473
|
+
addServiceTypeToSalonService: (args: AddOrRemoveServiceTypeInSalonArgs) ->
|
|
474
|
+
(Result_1);
|
|
475
|
+
addWorkerToSalonService: (args: AddOrRemoveWorkerInSalonArgs) -> (Result_1);
|
|
476
|
+
bookAppointment: (args: BookAppointmentArgs) -> (Result_20);
|
|
477
|
+
bulkAcceptWorkers: (args: BulkAcceptWorkersArgs) -> (Result_1);
|
|
478
|
+
bulkAddSalonServices: (args: BulkAddSalonServicesArgs) -> (Result_19);
|
|
479
|
+
bulkAddServiceTypes: (ids: vec ServiceTypeId) -> (Result_9);
|
|
480
|
+
bulkCreateSalons: (args: BulkCreateSalonsArgs) -> (Result_18);
|
|
481
|
+
bulkRequestToJoinSalons: (args: BulkRequestToJoinSalonsArgs) -> (Result_1);
|
|
482
|
+
bulkSetWeeklyTemplates: (args: BulkSetWeeklyTemplatesArgs) -> (Result_1);
|
|
483
|
+
clearLogs: () -> ();
|
|
207
484
|
/// Creates a new salon and links it to the caller
|
|
208
|
-
createSalon: (args: CreateSalonArgs) -> (
|
|
209
|
-
|
|
485
|
+
createSalon: (args: CreateSalonArgs) -> (Result_17);
|
|
486
|
+
createVisit: (args: CreateVisitArgs) -> (Result);
|
|
487
|
+
getActionQuotaLimits: () -> (Result_16) query;
|
|
488
|
+
getAllProfiles: () -> (Result_6) query;
|
|
489
|
+
getAppointmentsForCustomer: (customerId: principal) -> (Result_15) query;
|
|
490
|
+
/// Returns the list of profiles waiting for approval (Owner only)
|
|
491
|
+
getCandidatesBySalonId: (salonId: SalonId) -> (Result_6) query;
|
|
210
492
|
/// Returns a specific daily override if it exists
|
|
211
|
-
getDailySchedule: (args: GetDailyScheduleArgs) -> (
|
|
493
|
+
getDailySchedule: (args: GetDailyScheduleArgs) -> (Result_12) query;
|
|
494
|
+
/// Returns daily schedules with midnight timestamp in [fromDate, toDate] - for data migration to another canister
|
|
495
|
+
getDailySchedulesForMigration: (args: DailyScheduleRangeArgs) ->
|
|
496
|
+
(Result_14) query;
|
|
212
497
|
getDayFromWeeklyTemplate: (args: GetDayFromWeeklyTemplateArgs) ->
|
|
213
|
-
(
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
/// Returns the
|
|
218
|
-
|
|
219
|
-
|
|
498
|
+
(Result_13) query;
|
|
499
|
+
/// Returns the effective availability mask (daily override or weekly template fallback)
|
|
500
|
+
getEffectiveMaskForSalon: (args: GetEffectiveMaskForSalonArgs) ->
|
|
501
|
+
(Result_12) query;
|
|
502
|
+
/// Returns the highest migrationId for the given entity (= total number of records ever created)
|
|
503
|
+
getLastMigrationId: (entity: MigrationEntity) -> (Result_4) query;
|
|
504
|
+
getLogs: () -> (text) query;
|
|
505
|
+
/// Returns a page of migration data for the given entity and id range [from, to]
|
|
506
|
+
getMigrationData: (args: MigrationQueryArgs) -> (Result_11) query;
|
|
507
|
+
getMyProfile: () -> (Result_2) query;
|
|
508
|
+
/// Returns the list of salons owned by the currently logged-in owner (uses the index)
|
|
509
|
+
getMySalons: () -> (Result_10) query;
|
|
510
|
+
/// Returns the list of salon services by salon ID (owner view)
|
|
220
511
|
getSalonServicesBySalonId: (salonId: SalonId) -> (Result_5) query;
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
512
|
+
getSalonsForWorker: () -> (Result_10) query;
|
|
513
|
+
getServiceTypes: () -> (Result_9) query;
|
|
514
|
+
getSystemAdmin: () -> (Result_3) query;
|
|
515
|
+
getVisit: (visitId: VisitId) -> (Result_8) query;
|
|
516
|
+
getVisitHistory: (visitId: VisitId) -> (Result_7) query;
|
|
517
|
+
getVisitsForSalon: (salonId: SalonId) -> (Result_7) query;
|
|
518
|
+
/// Returns the profiles of all workers employed at a given salon
|
|
519
|
+
getWorkersBySalonId: (salonId: SalonId) -> (Result_6) query;
|
|
520
|
+
/// Owner rejects a candidate's request to join the team
|
|
521
|
+
rejectCandidate: (args: RejectCandidateArgs) -> (Result_1);
|
|
522
|
+
removeDailySchedule: (args: RemoveDailyScheduleArgs) -> (Result_1);
|
|
228
523
|
/// Permanently removes a salon service and cleans up search indexes
|
|
229
|
-
|
|
230
|
-
|
|
524
|
+
removeSalonServiceBySalonServiceId: (salonServiceId: SalonServiceId) ->
|
|
525
|
+
(Result_1);
|
|
526
|
+
removeServiceType: (id: ServiceTypeId) -> (Result_1);
|
|
527
|
+
removeServiceTypeFromSalonService: (args:
|
|
528
|
+
AddOrRemoveServiceTypeInSalonArgs) -> (Result_1);
|
|
231
529
|
/// Owner removes a worker from the salon team
|
|
232
|
-
removeWorkerFromSalon: (
|
|
530
|
+
removeWorkerFromSalon: (args: RemoveWorkerFromSalonArgs) -> (Result_1);
|
|
531
|
+
removeWorkerFromSalonService: (args: AddOrRemoveWorkerInSalonArgs) ->
|
|
532
|
+
(Result_1);
|
|
233
533
|
/// Worker sends a request to join a specific salon
|
|
234
|
-
requestToJoinSalon: (args: RequestToJoinArgs) -> (
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
setSystemAdmin: (newAdmin: opt principal) -> (
|
|
240
|
-
setWeeklyTemplate: (args: SetWeeklyTemplateArgs) -> (
|
|
241
|
-
|
|
242
|
-
toggleWorkerCapability: (args: ToggleWorkerCapabilityArgs) -> (Result);
|
|
243
|
-
updateMyProfile: (args: UpdateProfileArgs) -> (Result_1);
|
|
534
|
+
requestToJoinSalon: (args: RequestToJoinArgs) -> (Result_1);
|
|
535
|
+
searchForSalonServices: (args: SearchForSalonServicesArgs) ->
|
|
536
|
+
(Result_5) query;
|
|
537
|
+
setActionQuotaLimit: (role: Role, newLimit: nat) -> (Result_4);
|
|
538
|
+
setDailySchedule: (args: SetDailyScheduleArgs) -> (Result_1);
|
|
539
|
+
setSystemAdmin: (newAdmin: opt principal) -> (Result_3);
|
|
540
|
+
setWeeklyTemplate: (args: SetWeeklyTemplateArgs) -> (Result_1);
|
|
541
|
+
updateMyProfile: (args: UpdateProfileArgs) -> (Result_2);
|
|
244
542
|
/// Updates an existing service with new details and synchronizes the index
|
|
245
|
-
updateSalonService: (args: UpdateSalonServiceArgs) -> (
|
|
543
|
+
updateSalonService: (args: UpdateSalonServiceArgs) -> (Result_1);
|
|
544
|
+
updateVisit: (args: UpdateVisitArgs) -> (Result);
|
|
246
545
|
}
|