@milobedini/shared-types 1.0.59 → 1.0.61

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 (2) hide show
  1. package/dist/types.d.ts +59 -14
  2. package/package.json +1 -1
package/dist/types.d.ts CHANGED
@@ -90,8 +90,7 @@ export type Module = {
90
90
  imageUrl?: string;
91
91
  createdAt: string;
92
92
  updatedAt: string;
93
- enrolled?: string[];
94
- accessPolicy: 'open' | 'enrolled' | 'assigned';
93
+ accessPolicy: 'open' | 'assigned';
95
94
  };
96
95
  export type Choice = {
97
96
  text: string;
@@ -212,7 +211,7 @@ export type ModuleDetailResponse = {
212
211
  scoreBands: ScoreBand[];
213
212
  meta?: {
214
213
  canStart?: boolean;
215
- canStartReason?: 'ok' | 'not_enrolled' | 'requires_assignment' | 'unauthenticated';
214
+ canStartReason?: 'ok' | 'requires_assignment' | 'unauthenticated';
216
215
  activeAssignmentId?: string;
217
216
  };
218
217
  };
@@ -302,7 +301,7 @@ export type CreateModuleInput = {
302
301
  program: string;
303
302
  disclaimer?: string;
304
303
  imageUrl?: string;
305
- accessPolicy?: 'open' | 'enrolled' | 'assigned';
304
+ accessPolicy?: 'open' | 'assigned';
306
305
  };
307
306
  export type CreateQuestionInput = {
308
307
  moduleId: string;
@@ -317,20 +316,12 @@ export type CreateScoreBandInput = {
317
316
  label: string;
318
317
  interpretation: string;
319
318
  };
320
- export type EnrolInput = {
321
- patientId: string;
322
- moduleId: string;
323
- };
324
- export type EnrolResponse = {
325
- success: boolean;
326
- message: string;
327
- };
328
- export type AvailableSourceTag = 'open' | 'enrolled' | 'assigned';
319
+ export type AvailableSourceTag = 'open' | 'assigned';
329
320
  export type AvailableModulesItem = {
330
321
  module: Module;
331
322
  meta: {
332
323
  canStart: boolean | undefined;
333
- canStartReason: 'ok' | 'not_enrolled' | 'requires_assignment' | 'unauthenticated';
324
+ canStartReason: 'ok' | 'requires_assignment' | 'unauthenticated';
334
325
  source: AvailableSourceTag[];
335
326
  activeAssignmentId?: string;
336
327
  assignmentStatus?: 'assigned' | 'in_progress';
@@ -412,3 +403,57 @@ export type AttemptDetailResponse = {
412
403
  success: boolean;
413
404
  attempt: AttemptDetailResponseItem;
414
405
  };
406
+ export type MongoId = string;
407
+ export type TherapistPreview = Pick<User, '_id' | 'username' | 'email' | 'name'>;
408
+ export type UsersSort = `${string}:${'asc' | 'desc'}` | string;
409
+ export type UsersSortMulti = UsersSort | `${UsersSort},${UsersSort}` | `${UsersSort},${UsersSort},${string}`;
410
+ export type GetUsersQuery = {
411
+ page?: number;
412
+ limit?: number;
413
+ q?: string;
414
+ roles?: UserRole[] | string;
415
+ ids?: string[] | string;
416
+ isVerified?: boolean | string;
417
+ isVerifiedTherapist?: boolean | string;
418
+ hasTherapist?: boolean | string;
419
+ therapistId?: string;
420
+ createdFrom?: string;
421
+ createdTo?: string;
422
+ lastLoginFrom?: string;
423
+ lastLoginTo?: string;
424
+ sort?: UsersSortMulti;
425
+ select?: string[] | string;
426
+ };
427
+ export type UsersListItem = {
428
+ _id: MongoId;
429
+ username: string;
430
+ email: string;
431
+ name?: string;
432
+ roles: UserRole[];
433
+ isVerified?: boolean;
434
+ isVerifiedTherapist?: boolean;
435
+ therapist?: MongoId | null;
436
+ therapistInfo?: TherapistPreview | null;
437
+ patients?: MongoId[];
438
+ createdAt: string;
439
+ updatedAt: string;
440
+ lastLogin?: string;
441
+ };
442
+ export type FacetCount<T = string | boolean | null> = {
443
+ _id: T;
444
+ count: number;
445
+ };
446
+ export type UsersFacets = {
447
+ roles: FacetCount<UserRole>[];
448
+ isVerified: FacetCount<boolean>[];
449
+ isVerifiedTherapist: FacetCount<boolean>[];
450
+ hasTherapist: FacetCount<boolean>[];
451
+ };
452
+ export type GetUsersResponse = {
453
+ page: number;
454
+ limit: number;
455
+ total: number;
456
+ totalPages: number;
457
+ items: UsersListItem[];
458
+ facets: UsersFacets;
459
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milobedini/shared-types",
3
- "version": "1.0.59",
3
+ "version": "1.0.61",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [