@milobedini/shared-types 1.0.43 → 1.0.45

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 +54 -1
  2. package/package.json +1 -1
package/dist/types.d.ts CHANGED
@@ -52,6 +52,7 @@ export type ProfileResponse = {
52
52
  _id: string;
53
53
  username: string;
54
54
  email: string;
55
+ name?: string;
55
56
  roles: UserRole[];
56
57
  isVerifiedTherapist: boolean;
57
58
  patients: string[];
@@ -82,6 +83,7 @@ export type Module = {
82
83
  createdAt: string;
83
84
  updatedAt: string;
84
85
  enrolled?: string[];
86
+ accessPolicy: 'open' | 'enrolled' | 'assigned';
85
87
  };
86
88
  export type Choice = {
87
89
  text: string;
@@ -190,6 +192,11 @@ export type ModuleDetailResponse = {
190
192
  module: Module;
191
193
  questions: Question[];
192
194
  scoreBands: ScoreBand[];
195
+ meta?: {
196
+ canStart?: boolean;
197
+ canStartReason?: 'ok' | 'not_enrolled' | 'requires_assignment' | 'unauthenticated';
198
+ activeAssignmentId?: string;
199
+ };
193
200
  };
194
201
  export type StartAttemptResponse = {
195
202
  success: boolean;
@@ -218,13 +225,14 @@ export type MyAttemptsQuery = {
218
225
  moduleId?: string;
219
226
  limit?: number;
220
227
  cursor?: Cursor;
228
+ status?: 'submitted' | 'active';
221
229
  };
222
230
  export type MyAttemptsResponse = {
223
231
  success: boolean;
224
232
  attempts: AttemptListItem[];
225
233
  nextCursor: string | null;
226
234
  };
227
- export type TherapistUserPreview = Pick<AuthUser, '_id' | 'username' | 'email'>;
235
+ export type TherapistUserPreview = Pick<AuthUser, '_id' | 'username' | 'email' | 'name'>;
228
236
  export type TherapistModulePreview = Pick<Module, '_id' | 'title'>;
229
237
  export type TherapistLatestRow = {
230
238
  user: TherapistUserPreview;
@@ -272,6 +280,7 @@ export type CreateModuleInput = {
272
280
  program: string;
273
281
  disclaimer?: string;
274
282
  imageUrl?: string;
283
+ accessPolicy?: 'open' | 'enrolled' | 'assigned';
275
284
  };
276
285
  export type CreateQuestionInput = {
277
286
  moduleId: string;
@@ -294,3 +303,47 @@ export type EnrolResponse = {
294
303
  success: boolean;
295
304
  message: string;
296
305
  };
306
+ export type AvailableSourceTag = 'open' | 'enrolled' | 'assigned';
307
+ export type AvailableModulesItem = {
308
+ module: Module;
309
+ meta: {
310
+ canStart: boolean;
311
+ canStartReason: 'ok' | 'not_enrolled' | 'requires_assignment';
312
+ source: AvailableSourceTag[];
313
+ activeAssignmentId?: string;
314
+ assignmentStatus?: 'assigned' | 'in_progress';
315
+ dueAt?: string;
316
+ };
317
+ };
318
+ export type AvailableModulesResponse = {
319
+ success: boolean;
320
+ items: AvailableModulesItem[];
321
+ };
322
+ export type AssignmentLatestAttemptPreview = {
323
+ _id: string;
324
+ completedAt?: string;
325
+ totalScore?: number;
326
+ scoreBandLabel?: string;
327
+ };
328
+ export type ModulePreviewForAssignment = Pick<Module, '_id' | 'title' | 'type' | 'accessPolicy'> & {
329
+ program?: never;
330
+ };
331
+ export type ProgramPreviewForAssignment = Pick<Program, '_id' | 'title'>;
332
+ export type MyAssignmentView = {
333
+ _id: string;
334
+ user: string;
335
+ therapist: string;
336
+ status: AssignmentStatus;
337
+ dueAt?: string;
338
+ recurrence?: AssignmentRecurrence;
339
+ notes?: string;
340
+ module: ModulePreviewForAssignment;
341
+ program: ProgramPreviewForAssignment;
342
+ latestAttempt?: AssignmentLatestAttemptPreview;
343
+ createdAt: string;
344
+ updatedAt: string;
345
+ };
346
+ export type MyAssignmentsResponse = {
347
+ success: boolean;
348
+ assignments: MyAssignmentView[];
349
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milobedini/shared-types",
3
- "version": "1.0.43",
3
+ "version": "1.0.45",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [