@temboplus/afloat 0.1.38 → 0.1.39

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.
@@ -68,7 +68,7 @@ export class UserManagementRepository extends BaseRepository {
68
68
  /**
69
69
  * Archives (soft deletes) a user account by ID.
70
70
  * @param {string} id - The unique identifier of the user account to archive.
71
- * @returns {Promise<ManagedUser>} A promise that resolves to the archived user account.
71
+ * @returns {Promise<{ isArchived: boolean }>} A promise that resolves to whether isArchived.
72
72
  * @throws {PermissionError} If the user lacks required permissions
73
73
  * @throws {APIError} If the response status code is not 200.
74
74
  */
@@ -82,12 +82,26 @@ export class UserManagementRepository extends BaseRepository {
82
82
  });
83
83
  }
84
84
  const result = await this.client.archiveUser({ params: { id } });
85
- const data = this.handleResponse(result, 200);
86
- const managedUser = ManagedUser.from(data);
87
- if (!managedUser) {
88
- throw new Error("Invalid user data received from server");
85
+ return this.handleResponse(result, 200);
86
+ }
87
+ /**
88
+ * Archives (soft deletes) a user account by ID.
89
+ * @param {string} id - The unique identifier of the user account to archive.
90
+ * @returns {Promise<{ isArchived: boolean }>} A promise that resolves to whether isArchived.
91
+ * @throws {PermissionError} If the user lacks required permissions
92
+ * @throws {APIError} If the response status code is not 200.
93
+ */
94
+ async unArchiveUser(id) {
95
+ const auth = this.getAuthForPermissionCheck();
96
+ const requiredPerm = Permissions.UserManagement.ArchiveUser;
97
+ if (!auth.checkPermission(requiredPerm)) {
98
+ throw new PermissionError({
99
+ message: "You are not authorized to un-archive user accounts.",
100
+ requiredPermissions: [requiredPerm],
101
+ });
89
102
  }
90
- return managedUser;
103
+ const result = await this.client.unarchiveUser({ params: { id } });
104
+ return this.handleResponse(result, 200);
91
105
  }
92
106
  /**
93
107
  * Resets a user's password.
@@ -110,7 +124,7 @@ export class UserManagementRepository extends BaseRepository {
110
124
  params: { id },
111
125
  body: input,
112
126
  });
113
- this.handleResponse(result, 200);
127
+ return this.handleResponse(result, 200);
114
128
  }
115
129
  /**
116
130
  * Retrieves all user accounts.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@temboplus/afloat",
3
- "version": "0.1.38",
3
+ "version": "0.1.39",
4
4
  "description": "A JavaScript/TypeScript package providing common utilities and logic shared across all Temboplus-Afloat Projects",
5
5
  "repository": {
6
6
  "type": "git",
@@ -72,18 +72,18 @@ export declare const userManagementContract: {
72
72
  };
73
73
  }>, "many">;
74
74
  401: z.ZodObject<{
75
- message: z.ZodString;
75
+ message: z.ZodOptional<z.ZodString>;
76
76
  }, "strip", z.ZodTypeAny, {
77
- message: string;
77
+ message?: string | undefined;
78
78
  }, {
79
- message: string;
79
+ message?: string | undefined;
80
80
  }>;
81
81
  403: z.ZodObject<{
82
- message: z.ZodString;
82
+ message: z.ZodOptional<z.ZodString>;
83
83
  }, "strip", z.ZodTypeAny, {
84
- message: string;
84
+ message?: string | undefined;
85
85
  }, {
86
- message: string;
86
+ message?: string | undefined;
87
87
  }>;
88
88
  };
89
89
  };
@@ -166,25 +166,25 @@ export declare const userManagementContract: {
166
166
  };
167
167
  }>;
168
168
  401: z.ZodObject<{
169
- message: z.ZodString;
169
+ message: z.ZodOptional<z.ZodString>;
170
170
  }, "strip", z.ZodTypeAny, {
171
- message: string;
171
+ message?: string | undefined;
172
172
  }, {
173
- message: string;
173
+ message?: string | undefined;
174
174
  }>;
175
175
  403: z.ZodObject<{
176
- message: z.ZodString;
176
+ message: z.ZodOptional<z.ZodString>;
177
177
  }, "strip", z.ZodTypeAny, {
178
- message: string;
178
+ message?: string | undefined;
179
179
  }, {
180
- message: string;
180
+ message?: string | undefined;
181
181
  }>;
182
182
  404: z.ZodObject<{
183
- message: z.ZodString;
183
+ message: z.ZodOptional<z.ZodString>;
184
184
  }, "strip", z.ZodTypeAny, {
185
- message: string;
185
+ message?: string | undefined;
186
186
  }, {
187
- message: string;
187
+ message?: string | undefined;
188
188
  }>;
189
189
  };
190
190
  };
@@ -242,35 +242,35 @@ export declare const userManagementContract: {
242
242
  isActive: boolean;
243
243
  }>;
244
244
  400: z.ZodObject<{
245
- message: z.ZodString;
245
+ message: z.ZodOptional<z.ZodString>;
246
246
  errors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
247
247
  }, "strip", z.ZodTypeAny, {
248
- message: string;
248
+ message?: string | undefined;
249
249
  errors?: string[] | undefined;
250
250
  }, {
251
- message: string;
251
+ message?: string | undefined;
252
252
  errors?: string[] | undefined;
253
253
  }>;
254
254
  401: z.ZodObject<{
255
- message: z.ZodString;
255
+ message: z.ZodOptional<z.ZodString>;
256
256
  }, "strip", z.ZodTypeAny, {
257
- message: string;
257
+ message?: string | undefined;
258
258
  }, {
259
- message: string;
259
+ message?: string | undefined;
260
260
  }>;
261
261
  403: z.ZodObject<{
262
- message: z.ZodString;
262
+ message: z.ZodOptional<z.ZodString>;
263
263
  }, "strip", z.ZodTypeAny, {
264
- message: string;
264
+ message?: string | undefined;
265
265
  }, {
266
- message: string;
266
+ message?: string | undefined;
267
267
  }>;
268
268
  409: z.ZodObject<{
269
- message: z.ZodString;
269
+ message: z.ZodOptional<z.ZodString>;
270
270
  }, "strip", z.ZodTypeAny, {
271
- message: string;
271
+ message?: string | undefined;
272
272
  }, {
273
- message: string;
273
+ message?: string | undefined;
274
274
  }>;
275
275
  };
276
276
  };
@@ -365,35 +365,35 @@ export declare const userManagementContract: {
365
365
  };
366
366
  }>;
367
367
  400: z.ZodObject<{
368
- message: z.ZodString;
368
+ message: z.ZodOptional<z.ZodString>;
369
369
  errors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
370
370
  }, "strip", z.ZodTypeAny, {
371
- message: string;
371
+ message?: string | undefined;
372
372
  errors?: string[] | undefined;
373
373
  }, {
374
- message: string;
374
+ message?: string | undefined;
375
375
  errors?: string[] | undefined;
376
376
  }>;
377
377
  401: z.ZodObject<{
378
- message: z.ZodString;
378
+ message: z.ZodOptional<z.ZodString>;
379
379
  }, "strip", z.ZodTypeAny, {
380
- message: string;
380
+ message?: string | undefined;
381
381
  }, {
382
- message: string;
382
+ message?: string | undefined;
383
383
  }>;
384
384
  403: z.ZodObject<{
385
- message: z.ZodString;
385
+ message: z.ZodOptional<z.ZodString>;
386
386
  }, "strip", z.ZodTypeAny, {
387
- message: string;
387
+ message?: string | undefined;
388
388
  }, {
389
- message: string;
389
+ message?: string | undefined;
390
390
  }>;
391
391
  404: z.ZodObject<{
392
- message: z.ZodString;
392
+ message: z.ZodOptional<z.ZodString>;
393
393
  }, "strip", z.ZodTypeAny, {
394
- message: string;
394
+ message?: string | undefined;
395
395
  }, {
396
- message: string;
396
+ message?: string | undefined;
397
397
  }>;
398
398
  };
399
399
  };
@@ -407,87 +407,81 @@ export declare const userManagementContract: {
407
407
  id: string;
408
408
  }>;
409
409
  summary: "Archive user account";
410
- method: "DELETE";
411
- path: "/login/:id";
410
+ method: "POST";
411
+ body: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
412
+ path: "/login/:id/archive";
412
413
  responses: {
413
414
  200: z.ZodObject<{
414
- id: z.ZodString;
415
- name: z.ZodString;
416
- identity: z.ZodString;
417
- type: z.ZodString;
418
- profileId: z.ZodString;
419
- roleId: z.ZodString;
420
- resetPassword: z.ZodBoolean;
421
- isActive: z.ZodBoolean;
422
- role: z.ZodType<{
423
- id: string;
424
- access: string[];
425
- name: string;
426
- createdAt: string;
427
- updatedAt: string;
428
- description?: string | undefined;
429
- }>;
430
- createdAt: z.ZodString;
431
- updatedAt: z.ZodString;
432
- }, z.UnknownKeysParam, z.ZodTypeAny, {
433
- type: string;
434
- id: string;
435
- resetPassword: boolean;
436
- name: string;
437
- identity: string;
438
- profileId: string;
439
- createdAt: string;
440
- updatedAt: string;
441
- roleId: string;
442
- isActive: boolean;
443
- role: {
444
- id: string;
445
- access: string[];
446
- name: string;
447
- createdAt: string;
448
- updatedAt: string;
449
- description?: string | undefined;
450
- };
415
+ isArchived: z.ZodBoolean;
416
+ }, "strip", z.ZodTypeAny, {
417
+ isArchived: boolean;
451
418
  }, {
452
- type: string;
453
- id: string;
454
- resetPassword: boolean;
455
- name: string;
456
- identity: string;
457
- profileId: string;
458
- createdAt: string;
459
- updatedAt: string;
460
- roleId: string;
461
- isActive: boolean;
462
- role: {
463
- id: string;
464
- access: string[];
465
- name: string;
466
- createdAt: string;
467
- updatedAt: string;
468
- description?: string | undefined;
469
- };
419
+ isArchived: boolean;
420
+ }>;
421
+ 401: z.ZodObject<{
422
+ message: z.ZodOptional<z.ZodString>;
423
+ }, "strip", z.ZodTypeAny, {
424
+ message?: string | undefined;
425
+ }, {
426
+ message?: string | undefined;
427
+ }>;
428
+ 403: z.ZodObject<{
429
+ message: z.ZodOptional<z.ZodString>;
430
+ }, "strip", z.ZodTypeAny, {
431
+ message?: string | undefined;
432
+ }, {
433
+ message?: string | undefined;
434
+ }>;
435
+ 404: z.ZodObject<{
436
+ message: z.ZodOptional<z.ZodString>;
437
+ }, "strip", z.ZodTypeAny, {
438
+ message?: string | undefined;
439
+ }, {
440
+ message?: string | undefined;
441
+ }>;
442
+ };
443
+ };
444
+ unarchiveUser: {
445
+ description: "Un-archive (soft delete) a user account";
446
+ pathParams: z.ZodObject<{
447
+ id: z.ZodString;
448
+ }, "strip", z.ZodTypeAny, {
449
+ id: string;
450
+ }, {
451
+ id: string;
452
+ }>;
453
+ summary: "Un-archive user account";
454
+ method: "POST";
455
+ body: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
456
+ path: "/login/:id/unarchive";
457
+ responses: {
458
+ 200: z.ZodObject<{
459
+ isArchived: z.ZodBoolean;
460
+ }, "strip", z.ZodTypeAny, {
461
+ isArchived: boolean;
462
+ }, {
463
+ isArchived: boolean;
470
464
  }>;
471
465
  401: z.ZodObject<{
472
- message: z.ZodString;
466
+ message: z.ZodOptional<z.ZodString>;
473
467
  }, "strip", z.ZodTypeAny, {
474
- message: string;
468
+ message?: string | undefined;
475
469
  }, {
476
- message: string;
470
+ message?: string | undefined;
477
471
  }>;
478
472
  403: z.ZodObject<{
479
- message: z.ZodString;
473
+ message: z.ZodOptional<z.ZodString>;
480
474
  }, "strip", z.ZodTypeAny, {
481
- message: string;
475
+ message?: string | undefined;
482
476
  }, {
483
- message: string;
477
+ message?: string | undefined;
484
478
  }>;
485
479
  404: z.ZodObject<{
486
- message: z.ZodString;
480
+ message: z.ZodOptional<z.ZodString>;
487
481
  }, "strip", z.ZodTypeAny, {
488
- message: string;
482
+ message?: string | undefined;
489
483
  }, {
490
- message: string;
484
+ message?: string | undefined;
491
485
  }>;
492
486
  };
493
487
  };
@@ -522,32 +516,32 @@ export declare const userManagementContract: {
522
516
  success: boolean;
523
517
  }>;
524
518
  400: z.ZodObject<{
525
- message: z.ZodString;
519
+ message: z.ZodOptional<z.ZodString>;
526
520
  }, "strip", z.ZodTypeAny, {
527
- message: string;
521
+ message?: string | undefined;
528
522
  }, {
529
- message: string;
523
+ message?: string | undefined;
530
524
  }>;
531
525
  401: z.ZodObject<{
532
- message: z.ZodString;
526
+ message: z.ZodOptional<z.ZodString>;
533
527
  }, "strip", z.ZodTypeAny, {
534
- message: string;
528
+ message?: string | undefined;
535
529
  }, {
536
- message: string;
530
+ message?: string | undefined;
537
531
  }>;
538
532
  403: z.ZodObject<{
539
- message: z.ZodString;
533
+ message: z.ZodOptional<z.ZodString>;
540
534
  }, "strip", z.ZodTypeAny, {
541
- message: string;
535
+ message?: string | undefined;
542
536
  }, {
543
- message: string;
537
+ message?: string | undefined;
544
538
  }>;
545
539
  404: z.ZodObject<{
546
- message: z.ZodString;
540
+ message: z.ZodOptional<z.ZodString>;
547
541
  }, "strip", z.ZodTypeAny, {
548
- message: string;
542
+ message?: string | undefined;
549
543
  }, {
550
- message: string;
544
+ message?: string | undefined;
551
545
  }>;
552
546
  };
553
547
  };
@@ -580,18 +574,18 @@ export declare const userManagementContract: {
580
574
  description?: string | undefined;
581
575
  }>, "many">;
582
576
  401: z.ZodObject<{
583
- message: z.ZodString;
577
+ message: z.ZodOptional<z.ZodString>;
584
578
  }, "strip", z.ZodTypeAny, {
585
- message: string;
579
+ message?: string | undefined;
586
580
  }, {
587
- message: string;
581
+ message?: string | undefined;
588
582
  }>;
589
583
  403: z.ZodObject<{
590
- message: z.ZodString;
584
+ message: z.ZodOptional<z.ZodString>;
591
585
  }, "strip", z.ZodTypeAny, {
592
- message: string;
586
+ message?: string | undefined;
593
587
  }, {
594
- message: string;
588
+ message?: string | undefined;
595
589
  }>;
596
590
  };
597
591
  };
@@ -631,25 +625,25 @@ export declare const userManagementContract: {
631
625
  description?: string | undefined;
632
626
  }>;
633
627
  401: z.ZodObject<{
634
- message: z.ZodString;
628
+ message: z.ZodOptional<z.ZodString>;
635
629
  }, "strip", z.ZodTypeAny, {
636
- message: string;
630
+ message?: string | undefined;
637
631
  }, {
638
- message: string;
632
+ message?: string | undefined;
639
633
  }>;
640
634
  403: z.ZodObject<{
641
- message: z.ZodString;
635
+ message: z.ZodOptional<z.ZodString>;
642
636
  }, "strip", z.ZodTypeAny, {
643
- message: string;
637
+ message?: string | undefined;
644
638
  }, {
645
- message: string;
639
+ message?: string | undefined;
646
640
  }>;
647
641
  404: z.ZodObject<{
648
- message: z.ZodString;
642
+ message: z.ZodOptional<z.ZodString>;
649
643
  }, "strip", z.ZodTypeAny, {
650
- message: string;
644
+ message?: string | undefined;
651
645
  }, {
652
- message: string;
646
+ message?: string | undefined;
653
647
  }>;
654
648
  };
655
649
  };
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/src/features/admin/contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiMjC,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,sBAAsB,CAAC"}
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/src/features/admin/contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8NjC,CAAC;AAEH;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,sBAAsB,CAAC"}
@@ -17,10 +17,10 @@ exports.userManagementContract = c.router({
17
17
  responses: {
18
18
  200: zod_1.z.array(schemas_js_1.UserManagementSchemas.managedUser),
19
19
  401: zod_1.z.object({
20
- message: zod_1.z.string(),
20
+ message: zod_1.z.string().optional(),
21
21
  }),
22
22
  403: zod_1.z.object({
23
- message: zod_1.z.string(),
23
+ message: zod_1.z.string().optional(),
24
24
  }),
25
25
  },
26
26
  summary: "List all user accounts",
@@ -39,13 +39,13 @@ exports.userManagementContract = c.router({
39
39
  responses: {
40
40
  200: schemas_js_1.UserManagementSchemas.managedUser,
41
41
  401: zod_1.z.object({
42
- message: zod_1.z.string(),
42
+ message: zod_1.z.string().optional(),
43
43
  }),
44
44
  403: zod_1.z.object({
45
- message: zod_1.z.string(),
45
+ message: zod_1.z.string().optional(),
46
46
  }),
47
47
  404: zod_1.z.object({
48
- message: zod_1.z.string(),
48
+ message: zod_1.z.string().optional(),
49
49
  }),
50
50
  },
51
51
  summary: "Get user account details",
@@ -59,17 +59,17 @@ exports.userManagementContract = c.router({
59
59
  responses: {
60
60
  201: schemas_js_1.UserManagementSchemas.createUserResponse,
61
61
  400: zod_1.z.object({
62
- message: zod_1.z.string(),
62
+ message: zod_1.z.string().optional(),
63
63
  errors: zod_1.z.array(zod_1.z.string()).optional(),
64
64
  }),
65
65
  401: zod_1.z.object({
66
- message: zod_1.z.string(),
66
+ message: zod_1.z.string().optional(),
67
67
  }),
68
68
  403: zod_1.z.object({
69
- message: zod_1.z.string(),
69
+ message: zod_1.z.string().optional(),
70
70
  }),
71
71
  409: zod_1.z.object({
72
- message: zod_1.z.string(),
72
+ message: zod_1.z.string().optional(),
73
73
  }),
74
74
  },
75
75
  summary: "Create new user account",
@@ -86,17 +86,17 @@ exports.userManagementContract = c.router({
86
86
  responses: {
87
87
  200: schemas_js_1.UserManagementSchemas.managedUser,
88
88
  400: zod_1.z.object({
89
- message: zod_1.z.string(),
89
+ message: zod_1.z.string().optional(),
90
90
  errors: zod_1.z.array(zod_1.z.string()).optional(),
91
91
  }),
92
92
  401: zod_1.z.object({
93
- message: zod_1.z.string(),
93
+ message: zod_1.z.string().optional(),
94
94
  }),
95
95
  403: zod_1.z.object({
96
- message: zod_1.z.string(),
96
+ message: zod_1.z.string().optional(),
97
97
  }),
98
98
  404: zod_1.z.object({
99
- message: zod_1.z.string(),
99
+ message: zod_1.z.string().optional(),
100
100
  }),
101
101
  },
102
102
  summary: "Update user account",
@@ -104,26 +104,54 @@ exports.userManagementContract = c.router({
104
104
  },
105
105
  // Archive user (soft delete)
106
106
  archiveUser: {
107
- method: "DELETE",
108
- path: "/login/:id",
107
+ method: "POST",
108
+ path: "/login/:id/archive",
109
109
  pathParams: zod_1.z.object({
110
110
  id: zod_1.z.string(),
111
111
  }),
112
+ body: zod_1.z.object({}),
112
113
  responses: {
113
- 200: schemas_js_1.UserManagementSchemas.managedUser,
114
+ 200: zod_1.z.object({
115
+ isArchived: zod_1.z.boolean(),
116
+ }),
114
117
  401: zod_1.z.object({
115
- message: zod_1.z.string(),
118
+ message: zod_1.z.string().optional(),
116
119
  }),
117
120
  403: zod_1.z.object({
118
- message: zod_1.z.string(),
121
+ message: zod_1.z.string().optional(),
119
122
  }),
120
123
  404: zod_1.z.object({
121
- message: zod_1.z.string(),
124
+ message: zod_1.z.string().optional(),
122
125
  }),
123
126
  },
124
127
  summary: "Archive user account",
125
128
  description: "Archive (soft delete) a user account",
126
129
  },
130
+ // Archive user (soft delete)
131
+ unarchiveUser: {
132
+ method: "POST",
133
+ path: "/login/:id/unarchive",
134
+ pathParams: zod_1.z.object({
135
+ id: zod_1.z.string(),
136
+ }),
137
+ body: zod_1.z.object({}),
138
+ responses: {
139
+ 200: zod_1.z.object({
140
+ isArchived: zod_1.z.boolean(),
141
+ }),
142
+ 401: zod_1.z.object({
143
+ message: zod_1.z.string().optional(),
144
+ }),
145
+ 403: zod_1.z.object({
146
+ message: zod_1.z.string().optional(),
147
+ }),
148
+ 404: zod_1.z.object({
149
+ message: zod_1.z.string().optional(),
150
+ }),
151
+ },
152
+ summary: "Un-archive user account",
153
+ description: "Un-archive (soft delete) a user account",
154
+ },
127
155
  // Reset user password
128
156
  resetPassword: {
129
157
  method: "POST",
@@ -137,16 +165,16 @@ exports.userManagementContract = c.router({
137
165
  success: zod_1.z.boolean(),
138
166
  }),
139
167
  400: zod_1.z.object({
140
- message: zod_1.z.string(),
168
+ message: zod_1.z.string().optional(),
141
169
  }),
142
170
  401: zod_1.z.object({
143
- message: zod_1.z.string(),
171
+ message: zod_1.z.string().optional(),
144
172
  }),
145
173
  403: zod_1.z.object({
146
- message: zod_1.z.string(),
174
+ message: zod_1.z.string().optional(),
147
175
  }),
148
176
  404: zod_1.z.object({
149
- message: zod_1.z.string(),
177
+ message: zod_1.z.string().optional(),
150
178
  }),
151
179
  },
152
180
  summary: "Reset user password",
@@ -159,10 +187,10 @@ exports.userManagementContract = c.router({
159
187
  responses: {
160
188
  200: zod_1.z.array(schemas_js_1.UserManagementSchemas.role),
161
189
  401: zod_1.z.object({
162
- message: zod_1.z.string(),
190
+ message: zod_1.z.string().optional(),
163
191
  }),
164
192
  403: zod_1.z.object({
165
- message: zod_1.z.string(),
193
+ message: zod_1.z.string().optional(),
166
194
  }),
167
195
  },
168
196
  summary: "List all roles",
@@ -178,13 +206,13 @@ exports.userManagementContract = c.router({
178
206
  responses: {
179
207
  200: schemas_js_1.UserManagementSchemas.role,
180
208
  401: zod_1.z.object({
181
- message: zod_1.z.string(),
209
+ message: zod_1.z.string().optional(),
182
210
  }),
183
211
  403: zod_1.z.object({
184
- message: zod_1.z.string(),
212
+ message: zod_1.z.string().optional(),
185
213
  }),
186
214
  404: zod_1.z.object({
187
- message: zod_1.z.string(),
215
+ message: zod_1.z.string().optional(),
188
216
  }),
189
217
  },
190
218
  summary: "Get role details",