@things-factory/learning 0.0.0-stage → 10.1.260

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 (149) hide show
  1. package/dist-client/bootstrap.d.ts +2 -0
  2. package/dist-client/bootstrap.js +4 -0
  3. package/dist-client/bootstrap.js.map +1 -0
  4. package/dist-client/components/learning-assign-form.d.ts +24 -0
  5. package/dist-client/components/learning-assign-form.js +77 -0
  6. package/dist-client/components/learning-assign-form.js.map +1 -0
  7. package/dist-client/components/learning-course-form.d.ts +29 -0
  8. package/dist-client/components/learning-course-form.js +104 -0
  9. package/dist-client/components/learning-course-form.js.map +1 -0
  10. package/dist-client/components/learning-question-form.d.ts +33 -0
  11. package/dist-client/components/learning-question-form.js +142 -0
  12. package/dist-client/components/learning-question-form.js.map +1 -0
  13. package/dist-client/components/learning-todo.d.ts +12 -0
  14. package/dist-client/components/learning-todo.js +43 -0
  15. package/dist-client/components/learning-todo.js.map +1 -0
  16. package/dist-client/components/learning-unit-form.d.ts +41 -0
  17. package/dist-client/components/learning-unit-form.js +143 -0
  18. package/dist-client/components/learning-unit-form.js.map +1 -0
  19. package/dist-client/index.d.ts +2 -0
  20. package/dist-client/index.js +3 -0
  21. package/dist-client/index.js.map +1 -0
  22. package/dist-client/pages/learning-course-editor.d.ts +62 -0
  23. package/dist-client/pages/learning-course-editor.js +463 -0
  24. package/dist-client/pages/learning-course-editor.js.map +1 -0
  25. package/dist-client/pages/learning-course-list.d.ts +37 -0
  26. package/dist-client/pages/learning-course-list.js +88 -0
  27. package/dist-client/pages/learning-course-list.js.map +1 -0
  28. package/dist-client/pages/learning-enrollment-status.d.ts +53 -0
  29. package/dist-client/pages/learning-enrollment-status.js +228 -0
  30. package/dist-client/pages/learning-enrollment-status.js.map +1 -0
  31. package/dist-client/pages/learning-view.d.ts +52 -0
  32. package/dist-client/pages/learning-view.js +371 -0
  33. package/dist-client/pages/learning-view.js.map +1 -0
  34. package/dist-client/pages/my-learning.d.ts +22 -0
  35. package/dist-client/pages/my-learning.js +110 -0
  36. package/dist-client/pages/my-learning.js.map +1 -0
  37. package/dist-client/route.d.ts +1 -0
  38. package/dist-client/route.js +21 -0
  39. package/dist-client/route.js.map +1 -0
  40. package/dist-client/tsconfig.tsbuildinfo +1 -0
  41. package/dist-client/utils/learning-api.d.ts +16 -0
  42. package/dist-client/utils/learning-api.js +36 -0
  43. package/dist-client/utils/learning-api.js.map +1 -0
  44. package/dist-client/utils/learning-words.d.ts +20 -0
  45. package/dist-client/utils/learning-words.js +22 -0
  46. package/dist-client/utils/learning-words.js.map +1 -0
  47. package/dist-server/activities.d.ts +38 -0
  48. package/dist-server/activities.js +42 -0
  49. package/dist-server/activities.js.map +1 -0
  50. package/dist-server/ai-reads.d.ts +9 -0
  51. package/dist-server/ai-reads.js +70 -0
  52. package/dist-server/ai-reads.js.map +1 -0
  53. package/dist-server/attachment-reader.d.ts +1 -0
  54. package/dist-server/attachment-reader.js +23 -0
  55. package/dist-server/attachment-reader.js.map +1 -0
  56. package/dist-server/index.d.ts +4 -0
  57. package/dist-server/index.js +33 -0
  58. package/dist-server/index.js.map +1 -0
  59. package/dist-server/learning-subjects.d.ts +10 -0
  60. package/dist-server/learning-subjects.js +31 -0
  61. package/dist-server/learning-subjects.js.map +1 -0
  62. package/dist-server/role-tasks.d.ts +2 -0
  63. package/dist-server/role-tasks.js +17 -0
  64. package/dist-server/role-tasks.js.map +1 -0
  65. package/dist-server/service/course/course-mutation.d.ts +19 -0
  66. package/dist-server/service/course/course-mutation.js +176 -0
  67. package/dist-server/service/course/course-mutation.js.map +1 -0
  68. package/dist-server/service/course/course-query.d.ts +26 -0
  69. package/dist-server/service/course/course-query.js +172 -0
  70. package/dist-server/service/course/course-query.js.map +1 -0
  71. package/dist-server/service/course/course-question.d.ts +41 -0
  72. package/dist-server/service/course/course-question.js +116 -0
  73. package/dist-server/service/course/course-question.js.map +1 -0
  74. package/dist-server/service/course/course-rules.d.ts +49 -0
  75. package/dist-server/service/course/course-rules.js +89 -0
  76. package/dist-server/service/course/course-rules.js.map +1 -0
  77. package/dist-server/service/course/course-service.d.ts +71 -0
  78. package/dist-server/service/course/course-service.js +402 -0
  79. package/dist-server/service/course/course-service.js.map +1 -0
  80. package/dist-server/service/course/course-type.d.ts +55 -0
  81. package/dist-server/service/course/course-type.js +198 -0
  82. package/dist-server/service/course/course-type.js.map +1 -0
  83. package/dist-server/service/course/course-unit.d.ts +36 -0
  84. package/dist-server/service/course/course-unit.js +123 -0
  85. package/dist-server/service/course/course-unit.js.map +1 -0
  86. package/dist-server/service/course/course-version.d.ts +45 -0
  87. package/dist-server/service/course/course-version.js +151 -0
  88. package/dist-server/service/course/course-version.js.map +1 -0
  89. package/dist-server/service/course/course.d.ts +23 -0
  90. package/dist-server/service/course/course.js +92 -0
  91. package/dist-server/service/course/course.js.map +1 -0
  92. package/dist-server/service/course/index.d.ts +14 -0
  93. package/dist-server/service/course/index.js +24 -0
  94. package/dist-server/service/course/index.js.map +1 -0
  95. package/dist-server/service/enrollment/enrollment-mutation.d.ts +11 -0
  96. package/dist-server/service/enrollment/enrollment-mutation.js +124 -0
  97. package/dist-server/service/enrollment/enrollment-mutation.js.map +1 -0
  98. package/dist-server/service/enrollment/enrollment-query.d.ts +23 -0
  99. package/dist-server/service/enrollment/enrollment-query.js +245 -0
  100. package/dist-server/service/enrollment/enrollment-query.js.map +1 -0
  101. package/dist-server/service/enrollment/enrollment-remind.d.ts +1 -0
  102. package/dist-server/service/enrollment/enrollment-remind.js +45 -0
  103. package/dist-server/service/enrollment/enrollment-remind.js.map +1 -0
  104. package/dist-server/service/enrollment/enrollment-service.d.ts +110 -0
  105. package/dist-server/service/enrollment/enrollment-service.js +417 -0
  106. package/dist-server/service/enrollment/enrollment-service.js.map +1 -0
  107. package/dist-server/service/enrollment/enrollment-status.d.ts +40 -0
  108. package/dist-server/service/enrollment/enrollment-status.js +135 -0
  109. package/dist-server/service/enrollment/enrollment-status.js.map +1 -0
  110. package/dist-server/service/enrollment/enrollment-type.d.ts +95 -0
  111. package/dist-server/service/enrollment/enrollment-type.js +341 -0
  112. package/dist-server/service/enrollment/enrollment-type.js.map +1 -0
  113. package/dist-server/service/enrollment/enrollment.d.ts +52 -0
  114. package/dist-server/service/enrollment/enrollment.js +186 -0
  115. package/dist-server/service/enrollment/enrollment.js.map +1 -0
  116. package/dist-server/service/enrollment/index.d.ts +15 -0
  117. package/dist-server/service/enrollment/index.js +26 -0
  118. package/dist-server/service/enrollment/index.js.map +1 -0
  119. package/dist-server/service/enrollment/learning-ai.d.ts +38 -0
  120. package/dist-server/service/enrollment/learning-ai.js +96 -0
  121. package/dist-server/service/enrollment/learning-ai.js.map +1 -0
  122. package/dist-server/service/enrollment/learning-documents.d.ts +7 -0
  123. package/dist-server/service/enrollment/learning-documents.js +160 -0
  124. package/dist-server/service/enrollment/learning-documents.js.map +1 -0
  125. package/dist-server/service/enrollment/learning-outcome.d.ts +10 -0
  126. package/dist-server/service/enrollment/learning-outcome.js +16 -0
  127. package/dist-server/service/enrollment/learning-outcome.js.map +1 -0
  128. package/dist-server/service/enrollment/progress-rules.d.ts +94 -0
  129. package/dist-server/service/enrollment/progress-rules.js +97 -0
  130. package/dist-server/service/enrollment/progress-rules.js.map +1 -0
  131. package/dist-server/service/enrollment/quiz-attempt.d.ts +34 -0
  132. package/dist-server/service/enrollment/quiz-attempt.js +105 -0
  133. package/dist-server/service/enrollment/quiz-attempt.js.map +1 -0
  134. package/dist-server/service/enrollment/unit-progress.d.ts +30 -0
  135. package/dist-server/service/enrollment/unit-progress.js +114 -0
  136. package/dist-server/service/enrollment/unit-progress.js.map +1 -0
  137. package/dist-server/service/index.d.ts +14 -0
  138. package/dist-server/service/index.js +43 -0
  139. package/dist-server/service/index.js.map +1 -0
  140. package/dist-server/tsconfig.tsbuildinfo +1 -0
  141. package/package.json +56 -4
  142. package/things-factory.config.js +14 -0
  143. package/translations/en.json +255 -0
  144. package/translations/es.json +255 -0
  145. package/translations/ja.json +255 -0
  146. package/translations/ko.json +255 -0
  147. package/translations/ms.json +255 -0
  148. package/translations/zh.json +255 -0
  149. package/README.md +0 -3
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Course = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const typeorm_1 = require("typeorm");
7
+ const auth_base_1 = require("@things-factory/auth-base");
8
+ const shell_1 = require("@things-factory/shell");
9
+ /**
10
+ * 과정 (ADR-0194 decision 2) - what is taught, under one name, category and manager. What it says - units, quiz,
11
+ * minimum time - is in its versions.
12
+ */
13
+ let Course = class Course {
14
+ };
15
+ exports.Course = Course;
16
+ tslib_1.__decorate([
17
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
18
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Course id.' }),
19
+ tslib_1.__metadata("design:type", String)
20
+ ], Course.prototype, "id", void 0);
21
+ tslib_1.__decorate([
22
+ (0, typeorm_1.ManyToOne)(type => shell_1.Domain),
23
+ (0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true, description: 'The domain.' }),
24
+ tslib_1.__metadata("design:type", shell_1.Domain)
25
+ ], Course.prototype, "domain", void 0);
26
+ tslib_1.__decorate([
27
+ (0, typeorm_1.RelationId)((row) => row.domain),
28
+ tslib_1.__metadata("design:type", String)
29
+ ], Course.prototype, "domainId", void 0);
30
+ tslib_1.__decorate([
31
+ (0, typeorm_1.Column)(),
32
+ (0, type_graphql_1.Field)({ description: 'What it is called.' }),
33
+ tslib_1.__metadata("design:type", String)
34
+ ], Course.prototype, "name", void 0);
35
+ tslib_1.__decorate([
36
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
37
+ (0, type_graphql_1.Field)({ nullable: true, description: 'What it is about.' }),
38
+ tslib_1.__metadata("design:type", String)
39
+ ], Course.prototype, "description", void 0);
40
+ tslib_1.__decorate([
41
+ (0, typeorm_1.Column)({ nullable: true }),
42
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Its category - MANDATORY, ONBOARDING, JOB, PRODUCT, RULES or OTHER.' }),
43
+ tslib_1.__metadata("design:type", String)
44
+ ], Course.prototype, "category", void 0);
45
+ tslib_1.__decorate([
46
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
47
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who keeps it.' }),
48
+ tslib_1.__metadata("design:type", auth_base_1.User)
49
+ ], Course.prototype, "manager", void 0);
50
+ tslib_1.__decorate([
51
+ (0, typeorm_1.RelationId)((row) => row.manager),
52
+ tslib_1.__metadata("design:type", String)
53
+ ], Course.prototype, "managerId", void 0);
54
+ tslib_1.__decorate([
55
+ (0, typeorm_1.CreateDateColumn)(),
56
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Creation timestamp.' }),
57
+ tslib_1.__metadata("design:type", Date)
58
+ ], Course.prototype, "createdAt", void 0);
59
+ tslib_1.__decorate([
60
+ (0, typeorm_1.UpdateDateColumn)(),
61
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Last update timestamp.' }),
62
+ tslib_1.__metadata("design:type", Date)
63
+ ], Course.prototype, "updatedAt", void 0);
64
+ tslib_1.__decorate([
65
+ (0, typeorm_1.DeleteDateColumn)(),
66
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Soft delete timestamp.' }),
67
+ tslib_1.__metadata("design:type", Date)
68
+ ], Course.prototype, "deletedAt", void 0);
69
+ tslib_1.__decorate([
70
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
71
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who made it.' }),
72
+ tslib_1.__metadata("design:type", auth_base_1.User)
73
+ ], Course.prototype, "creator", void 0);
74
+ tslib_1.__decorate([
75
+ (0, typeorm_1.RelationId)((row) => row.creator),
76
+ tslib_1.__metadata("design:type", String)
77
+ ], Course.prototype, "creatorId", void 0);
78
+ tslib_1.__decorate([
79
+ (0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
80
+ (0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who changed it last.' }),
81
+ tslib_1.__metadata("design:type", auth_base_1.User)
82
+ ], Course.prototype, "updater", void 0);
83
+ tslib_1.__decorate([
84
+ (0, typeorm_1.RelationId)((row) => row.updater),
85
+ tslib_1.__metadata("design:type", String)
86
+ ], Course.prototype, "updaterId", void 0);
87
+ exports.Course = Course = tslib_1.__decorate([
88
+ (0, typeorm_1.Entity)({ name: 'learning_courses' }),
89
+ (0, typeorm_1.Index)('ix_learning_course_0', (row) => [row.domain, row.name], { unique: true, where: '"deleted_at" IS NULL' }),
90
+ (0, type_graphql_1.ObjectType)({ description: 'A course - its name, category and manager; what it teaches is in its versions.' })
91
+ ], Course);
92
+ //# sourceMappingURL=course.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"course.js","sourceRoot":"","sources":["../../../server/service/course/course.ts"],"names":[],"mappings":";;;;AAAA,+CAAoD;AACpD,qCAAoJ;AAEpJ,yDAAgD;AAChD,iDAA8C;AAE9C;;;GAGG;AAII,IAAM,MAAM,GAAZ,MAAM,MAAM;CAwDlB,CAAA;AAxDY,wBAAM;AAGR;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;;kCAC9B;AAInB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,CAAC;IACzB,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,cAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC;sCAC7D,cAAM;sCAAA;AAGf;IADC,IAAA,oBAAU,EAAC,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,C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C;sCACrD,IAAI;yCAAA;AAIhB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;sCAC3D,gBAAI;uCAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC;;yCACvB;AAIlB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gBAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,sBAAsB,EAAE,CAAC;sCACnE,gBAAI;uCAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,GAAW,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC;;yCACvB;iBAvDP,MAAM;IAHlB,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC;IACpC,IAAA,eAAK,EAAC,sBAAsB,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,sBAAsB,EAAE,CAAC;IACvH,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,gFAAgF,EAAE,CAAC;GACjG,MAAM,CAwDlB","sourcesContent":["import { Field, ID, ObjectType } from 'type-graphql'\nimport { Column, CreateDateColumn, DeleteDateColumn, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId, UpdateDateColumn } from 'typeorm'\n\nimport { User } from '@things-factory/auth-base'\nimport { Domain } from '@things-factory/shell'\n\n/**\n * 과정 (ADR-0194 decision 2) - what is taught, under one name, category and manager. What it says - units, quiz,\n * minimum time - is in its versions.\n */\n@Entity({ name: 'learning_courses' })\n@Index('ix_learning_course_0', (row: Course) => [row.domain, row.name], { unique: true, where: '\"deleted_at\" IS NULL' })\n@ObjectType({ description: 'A course - its name, category and manager; what it teaches is in its versions.' })\nexport class Course {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'Course id.' })\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain, { nullable: true, description: 'The domain.' })\n domain?: Domain\n\n @RelationId((row: Course) => row.domain)\n domainId?: string\n\n @Column()\n @Field({ description: 'What it is called.' })\n name: string\n\n @Column({ type: 'text', nullable: true })\n @Field({ nullable: true, description: 'What it is about.' })\n description?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true, description: 'Its category - MANDATORY, ONBOARDING, JOB, PRODUCT, RULES or OTHER.' })\n category?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'Who keeps it.' })\n manager?: User\n\n @RelationId((row: Course) => row.manager)\n managerId?: string\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'Creation timestamp.' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'Last update timestamp.' })\n updatedAt?: Date\n\n @DeleteDateColumn()\n @Field({ nullable: true, description: 'Soft delete timestamp.' })\n deletedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'Who made it.' })\n creator?: User\n\n @RelationId((row: Course) => row.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true, description: 'Who changed it last.' })\n updater?: User\n\n @RelationId((row: Course) => row.updater)\n updaterId?: string\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import { Course } from './course';
2
+ import { CourseQuestion } from './course-question';
3
+ import { CourseUnit } from './course-unit';
4
+ import { CourseVersion } from './course-version';
5
+ import { CourseMutation } from './course-mutation';
6
+ import { CourseQuery, CourseQuestionFields, CourseUnitFields, CourseVersionFields } from './course-query';
7
+ export * from './course';
8
+ export * from './course-question';
9
+ export * from './course-unit';
10
+ export * from './course-version';
11
+ export { COURSE_UNIT_REF_TYPE, publishedVersionOf, unitsOf, questionsOf, addDraftedQuestions } from './course-service';
12
+ export declare const entities: (typeof Course | typeof CourseVersion | typeof CourseUnit | typeof CourseQuestion)[];
13
+ export declare const resolvers: (typeof CourseMutation | typeof CourseQuery | typeof CourseVersionFields | typeof CourseUnitFields | typeof CourseQuestionFields)[];
14
+ export declare const subscribers: any[];
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.subscribers = exports.resolvers = exports.entities = exports.addDraftedQuestions = exports.questionsOf = exports.unitsOf = exports.publishedVersionOf = exports.COURSE_UNIT_REF_TYPE = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const course_1 = require("./course");
6
+ const course_question_1 = require("./course-question");
7
+ const course_unit_1 = require("./course-unit");
8
+ const course_version_1 = require("./course-version");
9
+ const course_mutation_1 = require("./course-mutation");
10
+ const course_query_1 = require("./course-query");
11
+ tslib_1.__exportStar(require("./course"), exports);
12
+ tslib_1.__exportStar(require("./course-question"), exports);
13
+ tslib_1.__exportStar(require("./course-unit"), exports);
14
+ tslib_1.__exportStar(require("./course-version"), exports);
15
+ var course_service_1 = require("./course-service");
16
+ Object.defineProperty(exports, "COURSE_UNIT_REF_TYPE", { enumerable: true, get: function () { return course_service_1.COURSE_UNIT_REF_TYPE; } });
17
+ Object.defineProperty(exports, "publishedVersionOf", { enumerable: true, get: function () { return course_service_1.publishedVersionOf; } });
18
+ Object.defineProperty(exports, "unitsOf", { enumerable: true, get: function () { return course_service_1.unitsOf; } });
19
+ Object.defineProperty(exports, "questionsOf", { enumerable: true, get: function () { return course_service_1.questionsOf; } });
20
+ Object.defineProperty(exports, "addDraftedQuestions", { enumerable: true, get: function () { return course_service_1.addDraftedQuestions; } });
21
+ exports.entities = [course_1.Course, course_version_1.CourseVersion, course_unit_1.CourseUnit, course_question_1.CourseQuestion];
22
+ exports.resolvers = [course_query_1.CourseQuery, course_query_1.CourseVersionFields, course_query_1.CourseUnitFields, course_query_1.CourseQuestionFields, course_mutation_1.CourseMutation];
23
+ exports.subscribers = [];
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/course/index.ts"],"names":[],"mappings":";;;;AAAA,qCAAiC;AACjC,uDAAkD;AAClD,+CAA0C;AAC1C,qDAAgD;AAChD,uDAAkD;AAClD,iDAAyG;AAEzG,mDAAwB;AACxB,4DAAiC;AACjC,wDAA6B;AAC7B,2DAAgC;AAChC,mDAAsH;AAA7G,sHAAA,oBAAoB,OAAA;AAAE,oHAAA,kBAAkB,OAAA;AAAE,yGAAA,OAAO,OAAA;AAAE,6GAAA,WAAW,OAAA;AAAE,qHAAA,mBAAmB,OAAA;AAE/E,QAAA,QAAQ,GAAG,CAAC,eAAM,EAAE,8BAAa,EAAE,wBAAU,EAAE,gCAAc,CAAC,CAAA;AAC9D,QAAA,SAAS,GAAG,CAAC,0BAAW,EAAE,kCAAmB,EAAE,+BAAgB,EAAE,mCAAoB,EAAE,gCAAc,CAAC,CAAA;AACtG,QAAA,WAAW,GAAG,EAAE,CAAA","sourcesContent":["import { Course } from './course'\nimport { CourseQuestion } from './course-question'\nimport { CourseUnit } from './course-unit'\nimport { CourseVersion } from './course-version'\nimport { CourseMutation } from './course-mutation'\nimport { CourseQuery, CourseQuestionFields, CourseUnitFields, CourseVersionFields } from './course-query'\n\nexport * from './course'\nexport * from './course-question'\nexport * from './course-unit'\nexport * from './course-version'\nexport { COURSE_UNIT_REF_TYPE, publishedVersionOf, unitsOf, questionsOf, addDraftedQuestions } from './course-service'\n\nexport const entities = [Course, CourseVersion, CourseUnit, CourseQuestion]\nexport const resolvers = [CourseQuery, CourseVersionFields, CourseUnitFields, CourseQuestionFields, CourseMutation]\nexport const subscribers = []\n"]}
@@ -0,0 +1,11 @@
1
+ import { Enrollment } from './enrollment';
2
+ import { LearningAudienceInput, LearningTickResult, QuizAttemptView, QuizResultView } from './enrollment-type';
3
+ export declare class EnrollmentMutation {
4
+ recordLearningTick(enrollmentId: string, unitId: string, seconds: number, position: number, context: ResolverContext): Promise<LearningTickResult>;
5
+ acknowledgeEnrollment(id: string, context: ResolverContext): Promise<Enrollment>;
6
+ startQuizAttempt(enrollmentId: string, context: ResolverContext): Promise<QuizAttemptView>;
7
+ submitQuizAttempt(attemptId: string, answers: Record<string, string[]>, context: ResolverContext): Promise<QuizResultView>;
8
+ assignCourse(courseId: string, audiences: LearningAudienceInput[], dueOn: string, context: ResolverContext): Promise<Enrollment[]>;
9
+ cancelEnrollment(id: string, reason: string, context: ResolverContext): Promise<Enrollment>;
10
+ remindEnrollments(ids: string[], context: ResolverContext): Promise<number>;
11
+ }
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnrollmentMutation = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const shell_1 = require("@things-factory/shell");
7
+ const enrollment_1 = require("./enrollment");
8
+ const enrollment_service_1 = require("./enrollment-service");
9
+ const enrollment_remind_1 = require("./enrollment-remind");
10
+ const enrollment_type_1 = require("./enrollment-type");
11
+ /*
12
+ * The writes of enrolments (ADR-0194 decisions 4-8): a learner's ticks, acknowledgement and quiz (`learning` mutation,
13
+ * the task `learning.taking`, on their own enrolments only); a manager's assigning, cancelling and reminding (`course`
14
+ * mutation, `learning.managing`).
15
+ */
16
+ let EnrollmentMutation = class EnrollmentMutation {
17
+ async recordLearningTick(enrollmentId, unitId, seconds, position, context) {
18
+ return await (0, enrollment_service_1.recordTick)(enrollmentId, unitId, seconds, position, context);
19
+ }
20
+ async acknowledgeEnrollment(id, context) {
21
+ return await (0, enrollment_service_1.acknowledgeEnrollment)(id, context);
22
+ }
23
+ async startQuizAttempt(enrollmentId, context) {
24
+ const { attempt, questions } = await (0, enrollment_service_1.startQuizAttempt)(enrollmentId, context);
25
+ return { attemptId: attempt.id, questions };
26
+ }
27
+ async submitQuizAttempt(attemptId, answers, context) {
28
+ return await (0, enrollment_service_1.submitQuizAttempt)(attemptId, answers, context);
29
+ }
30
+ async assignCourse(courseId, audiences, dueOn, context) {
31
+ return await (0, enrollment_service_1.enroll)({ kind: enrollment_service_1.DIRECT_SOURCE_KIND, id: '' }, await (0, enrollment_service_1.learnersOf)(audiences, context), courseId, dueOn, context);
32
+ }
33
+ async cancelEnrollment(id, reason, context) {
34
+ return await (0, enrollment_service_1.cancelEnrollment)(id, reason, context);
35
+ }
36
+ async remindEnrollments(ids, context) {
37
+ return await (0, enrollment_remind_1.remindEnrollments)(ids, context);
38
+ }
39
+ };
40
+ exports.EnrollmentMutation = EnrollmentMutation;
41
+ tslib_1.__decorate([
42
+ (0, type_graphql_1.Directive)('@privilege(category: "learning", privilege: "mutation", domainOwnerGranted: true)'),
43
+ (0, type_graphql_1.Directive)('@transaction'),
44
+ (0, type_graphql_1.Mutation)(returns => enrollment_type_1.LearningTickResult, {
45
+ description: 'To record a tick of a unit looked at - the server counts the time since the last tick (15 seconds at most) and refuses a video position ahead of what was watched.'
46
+ }),
47
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('enrollmentId')),
48
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('unitId')),
49
+ tslib_1.__param(2, (0, type_graphql_1.Arg)('seconds', type => type_graphql_1.Int, { description: 'Seconds looked at since the last tick, as the screen says - it may lower what is counted, never raise it.' })),
50
+ tslib_1.__param(3, (0, type_graphql_1.Arg)('position', type => type_graphql_1.Int, { description: 'Where the video stands, in seconds - 0 for a document.' })),
51
+ tslib_1.__param(4, (0, type_graphql_1.Ctx)()),
52
+ tslib_1.__metadata("design:type", Function),
53
+ tslib_1.__metadata("design:paramtypes", [String, String, Number, Number, Object]),
54
+ tslib_1.__metadata("design:returntype", Promise)
55
+ ], EnrollmentMutation.prototype, "recordLearningTick", null);
56
+ tslib_1.__decorate([
57
+ (0, type_graphql_1.Directive)('@privilege(category: "learning", privilege: "mutation", domainOwnerGranted: true)'),
58
+ (0, type_graphql_1.Directive)('@transaction'),
59
+ (0, type_graphql_1.Mutation)(returns => enrollment_1.Enrollment, { description: "To confirm the course's acknowledgement." }),
60
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
61
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
62
+ tslib_1.__metadata("design:type", Function),
63
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
64
+ tslib_1.__metadata("design:returntype", Promise)
65
+ ], EnrollmentMutation.prototype, "acknowledgeEnrollment", null);
66
+ tslib_1.__decorate([
67
+ (0, type_graphql_1.Directive)('@privilege(category: "learning", privilege: "mutation", domainOwnerGranted: true)'),
68
+ (0, type_graphql_1.Directive)('@transaction'),
69
+ (0, type_graphql_1.Mutation)(returns => enrollment_type_1.QuizAttemptView, { description: 'To start a quiz attempt - the questions and choices drawn and shuffled, never the answers.' }),
70
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('enrollmentId')),
71
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
72
+ tslib_1.__metadata("design:type", Function),
73
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
74
+ tslib_1.__metadata("design:returntype", Promise)
75
+ ], EnrollmentMutation.prototype, "startQuizAttempt", null);
76
+ tslib_1.__decorate([
77
+ (0, type_graphql_1.Directive)('@privilege(category: "learning", privilege: "mutation", domainOwnerGranted: true)'),
78
+ (0, type_graphql_1.Directive)('@transaction'),
79
+ (0, type_graphql_1.Mutation)(returns => enrollment_type_1.QuizResultView, { description: "To send an attempt's answers - scored on the server; the score and whether it passed come back, never the right answers." }),
80
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('attemptId')),
81
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('answers', type => shell_1.ScalarObject, { description: 'The choice ids picked, by question id.' })),
82
+ tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
83
+ tslib_1.__metadata("design:type", Function),
84
+ tslib_1.__metadata("design:paramtypes", [String, Object, Object]),
85
+ tslib_1.__metadata("design:returntype", Promise)
86
+ ], EnrollmentMutation.prototype, "submitQuizAttempt", null);
87
+ tslib_1.__decorate([
88
+ (0, type_graphql_1.Directive)('@privilege(category: "course", privilege: "mutation", domainOwnerGranted: true)'),
89
+ (0, type_graphql_1.Directive)('@transaction'),
90
+ (0, type_graphql_1.Mutation)(returns => [enrollment_1.Enrollment], { description: 'To assign a course to an audience - the people it names now - to be completed by a day; each gets a to-do.' }),
91
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('courseId')),
92
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('audiences', type => [enrollment_type_1.LearningAudienceInput])),
93
+ tslib_1.__param(2, (0, type_graphql_1.Arg)('dueOn', { nullable: true, description: 'YYYY-MM-DD.' })),
94
+ tslib_1.__param(3, (0, type_graphql_1.Ctx)()),
95
+ tslib_1.__metadata("design:type", Function),
96
+ tslib_1.__metadata("design:paramtypes", [String, Array, String, Object]),
97
+ tslib_1.__metadata("design:returntype", Promise)
98
+ ], EnrollmentMutation.prototype, "assignCourse", null);
99
+ tslib_1.__decorate([
100
+ (0, type_graphql_1.Directive)('@privilege(category: "course", privilege: "mutation", domainOwnerGranted: true)'),
101
+ (0, type_graphql_1.Directive)('@transaction'),
102
+ (0, type_graphql_1.Mutation)(returns => enrollment_1.Enrollment, { description: 'To cancel an enrolment, with the reason - a completed one stays on record as cancelled, and whoever asked for it is told.' }),
103
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
104
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('reason')),
105
+ tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
106
+ tslib_1.__metadata("design:type", Function),
107
+ tslib_1.__metadata("design:paramtypes", [String, String, Object]),
108
+ tslib_1.__metadata("design:returntype", Promise)
109
+ ], EnrollmentMutation.prototype, "cancelEnrollment", null);
110
+ tslib_1.__decorate([
111
+ (0, type_graphql_1.Directive)('@privilege(category: "course", privilege: "mutation", domainOwnerGranted: true)'),
112
+ (0, type_graphql_1.Directive)('@transaction'),
113
+ (0, type_graphql_1.Mutation)(returns => type_graphql_1.Int, { description: 'To remind the learners of open enrolments - answers how many were reminded.' }),
114
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('ids', type => [String])),
115
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
116
+ tslib_1.__metadata("design:type", Function),
117
+ tslib_1.__metadata("design:paramtypes", [Array, Object]),
118
+ tslib_1.__metadata("design:returntype", Promise)
119
+ ], EnrollmentMutation.prototype, "remindEnrollments", null);
120
+ exports.EnrollmentMutation = EnrollmentMutation = tslib_1.__decorate([
121
+ (0, type_graphql_1.Resolver)(enrollment_1.Enrollment),
122
+ (0, type_graphql_1.UseMiddleware)(shell_1.SpeakRefusals)
123
+ ], EnrollmentMutation);
124
+ //# sourceMappingURL=enrollment-mutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enrollment-mutation.js","sourceRoot":"","sources":["../../../server/service/enrollment/enrollment-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAA0F;AAE1F,iDAAmE;AAEnE,6CAAyC;AACzC,6DAAuK;AACvK,2DAAuD;AACvD,uDAA8G;AAG9G;;;;GAIG;AAGI,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAMvB,AAAN,KAAK,CAAC,kBAAkB,CACD,YAAoB,EAC1B,MAAc,EAC8H,OAAe,EACjE,QAAgB,EAClH,OAAwB;QAE/B,OAAO,MAAM,IAAA,+BAAU,EAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC3E,CAAC;IAKK,AAAN,KAAK,CAAC,qBAAqB,CAAY,EAAU,EAAS,OAAwB;QAChF,OAAO,MAAM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AAE,WAAW,EAAE,6EAA6E,EAAE,CAAC;IAChG,mBAAA,IAAA,kBAAG,EAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAAiB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;2DAE1E;6BAlEU,kBAAkB;IAF9B,IAAA,uBAAQ,EAAC,uBAAU,CAAC;IACpB,IAAA,4BAAa,EAAC,qBAAa,CAAC;GAChB,kBAAkB,CAmE9B","sourcesContent":["import { Arg, Ctx, Directive, Int, Mutation, Resolver, UseMiddleware } from 'type-graphql'\n\nimport { ScalarObject, SpeakRefusals } from '@things-factory/shell'\n\nimport { Enrollment } from './enrollment'\nimport { acknowledgeEnrollment, cancelEnrollment, DIRECT_SOURCE_KIND, enroll, learnersOf, recordTick, startQuizAttempt, submitQuizAttempt } from './enrollment-service'\nimport { remindEnrollments } from './enrollment-remind'\nimport { LearningAudienceInput, LearningTickResult, QuizAttemptView, QuizResultView } from './enrollment-type'\n\n\n/*\n * The writes of enrolments (ADR-0194 decisions 4-8): a learner's ticks, acknowledgement and quiz (`learning` mutation,\n * the task `learning.taking`, on their own enrolments only); a manager's assigning, cancelling and reminding (`course`\n * mutation, `learning.managing`).\n */\n@Resolver(Enrollment)\n@UseMiddleware(SpeakRefusals)\nexport class EnrollmentMutation {\n @Directive('@privilege(category: \"learning\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => LearningTickResult, {\n description: 'To record a tick of a unit looked at - the server counts the time since the last tick (15 seconds at most) and refuses a video position ahead of what was watched.'\n })\n async recordLearningTick(\n @Arg('enrollmentId') enrollmentId: string,\n @Arg('unitId') unitId: string,\n @Arg('seconds', type => Int, { description: 'Seconds looked at since the last tick, as the screen says - it may lower what is counted, never raise it.' }) seconds: number,\n @Arg('position', type => Int, { description: 'Where the video stands, in seconds - 0 for a document.' }) position: number,\n @Ctx() context: ResolverContext\n ): Promise<LearningTickResult> {\n return await recordTick(enrollmentId, unitId, seconds, position, context)\n }\n\n @Directive('@privilege(category: \"learning\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => Enrollment, { description: \"To confirm the course's acknowledgement.\" })\n async acknowledgeEnrollment(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Enrollment> {\n return await acknowledgeEnrollment(id, context)\n }\n\n @Directive('@privilege(category: \"learning\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => QuizAttemptView, { description: 'To start a quiz attempt - the questions and choices drawn and shuffled, never the answers.' })\n async startQuizAttempt(@Arg('enrollmentId') enrollmentId: string, @Ctx() context: ResolverContext): Promise<QuizAttemptView> {\n const { attempt, questions } = await startQuizAttempt(enrollmentId, context)\n return { attemptId: attempt.id, questions }\n }\n\n @Directive('@privilege(category: \"learning\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => QuizResultView, { description: \"To send an attempt's answers - scored on the server; the score and whether it passed come back, never the right answers.\" })\n async submitQuizAttempt(\n @Arg('attemptId') attemptId: string,\n @Arg('answers', type => ScalarObject, { description: 'The choice ids picked, by question id.' }) answers: Record<string, string[]>,\n @Ctx() context: ResolverContext\n ): Promise<QuizResultView> {\n return await submitQuizAttempt(attemptId, answers, context)\n }\n\n @Directive('@privilege(category: \"course\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => [Enrollment], { description: 'To assign a course to an audience - the people it names now - to be completed by a day; each gets a to-do.' })\n async assignCourse(\n @Arg('courseId') courseId: string,\n @Arg('audiences', type => [LearningAudienceInput]) audiences: LearningAudienceInput[],\n @Arg('dueOn', { nullable: true, description: 'YYYY-MM-DD.' }) dueOn: string,\n @Ctx() context: ResolverContext\n ): Promise<Enrollment[]> {\n return await enroll({ kind: DIRECT_SOURCE_KIND, id: '' }, await learnersOf(audiences, context), courseId, dueOn, context)\n }\n\n @Directive('@privilege(category: \"course\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => Enrollment, { description: 'To cancel an enrolment, with the reason - a completed one stays on record as cancelled, and whoever asked for it is told.' })\n async cancelEnrollment(@Arg('id') id: string, @Arg('reason') reason: string, @Ctx() context: ResolverContext): Promise<Enrollment> {\n return await cancelEnrollment(id, reason, context)\n }\n\n @Directive('@privilege(category: \"course\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Directive('@transaction')\n @Mutation(returns => Int, { description: 'To remind the learners of open enrolments - answers how many were reminded.' })\n async remindEnrollments(@Arg('ids', type => [String]) ids: string[], @Ctx() context: ResolverContext): Promise<number> {\n return await remindEnrollments(ids, context)\n }\n}\n"]}
@@ -0,0 +1,23 @@
1
+ import { User } from '@things-factory/auth-base';
2
+ import { ListParam } from '@things-factory/shell';
3
+ import { Course } from '../course/course';
4
+ import { CourseVersion } from '../course/course-version';
5
+ import { Enrollment } from './enrollment';
6
+ import { EnrollmentStatusFilter, EnrollmentStatusList, EnrollmentStatusRow, LearningContent, LearningEnrollmentList, LearningUnit } from './enrollment-type';
7
+ export declare class EnrollmentQuery {
8
+ myEnrollments(context: ResolverContext): Promise<Enrollment[]>;
9
+ myEnrollment(id: string, context: ResolverContext): Promise<Enrollment>;
10
+ teamEnrollmentStatus(filter: EnrollmentStatusFilter, context: ResolverContext): Promise<EnrollmentStatusList>;
11
+ enrollmentStatus(filter: EnrollmentStatusFilter, context: ResolverContext): Promise<EnrollmentStatusList>;
12
+ completionRegister(courseId: string, context: ResolverContext): Promise<EnrollmentStatusRow[]>;
13
+ learningEnrollments(params: ListParam, context: ResolverContext): Promise<LearningEnrollmentList>;
14
+ learningContent(enrollmentId: string, versionId: string, context: ResolverContext): Promise<LearningContent>;
15
+ course(enrollment: Enrollment): Promise<Course | null>;
16
+ user(enrollment: Enrollment): Promise<User | null>;
17
+ version(enrollment: Enrollment, context: ResolverContext): Promise<CourseVersion | null>;
18
+ state(enrollment: Enrollment, context: ResolverContext): string;
19
+ units(enrollment: Enrollment, context: ResolverContext): Promise<LearningUnit[]>;
20
+ missing(enrollment: Enrollment, context: ResolverContext): Promise<string[]>;
21
+ attemptsLeft(enrollment: Enrollment, context: ResolverContext): Promise<number | null>;
22
+ quizSize(enrollment: Enrollment, context: ResolverContext): Promise<number>;
23
+ }
@@ -0,0 +1,245 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnrollmentQuery = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const type_graphql_1 = require("type-graphql");
6
+ const auth_base_1 = require("@things-factory/auth-base");
7
+ const shell_1 = require("@things-factory/shell");
8
+ const course_1 = require("../course/course");
9
+ const course_question_1 = require("../course/course-question");
10
+ const course_version_1 = require("../course/course-version");
11
+ const course_service_1 = require("../course/course-service");
12
+ const enrollment_1 = require("./enrollment");
13
+ const enrollment_service_1 = require("./enrollment-service");
14
+ const enrollment_status_1 = require("./enrollment-status");
15
+ const enrollment_type_1 = require("./enrollment-type");
16
+ const learning_ai_1 = require("./learning-ai");
17
+ const progress_rules_1 = require("./progress-rules");
18
+ const rowOut = (row) => ({ id: row.enrollment.id, ...row });
19
+ function listOf(rows) {
20
+ const live = rows.filter(one => one.state !== 'CANCELLED');
21
+ return {
22
+ items: rows.map(rowOut),
23
+ summary: {
24
+ total: live.length,
25
+ assigned: live.filter(one => one.enrollment.status === 'ASSIGNED').length,
26
+ inProgress: live.filter(one => one.enrollment.status === 'IN_PROGRESS').length,
27
+ completed: live.filter(one => one.state === 'COMPLETED').length,
28
+ overdue: live.filter(one => one.state === 'OVERDUE').length
29
+ }
30
+ };
31
+ }
32
+ /** Whether the request reads how an enrolment went - its learner or a manager. */
33
+ async function readsInside(enrollment, context) {
34
+ return enrollment.userId === context.state.user.id || (await (0, course_service_1.holds)(context, 'course', 'query'));
35
+ }
36
+ /*
37
+ * The reads of enrolments (ADR-0194 decisions 5-11): one's own (`learning` query, the task `learning.taking`); every
38
+ * enrolment and the completion register for a manager (`course` query); a department head's people, status only.
39
+ */
40
+ let EnrollmentQuery = class EnrollmentQuery {
41
+ async myEnrollments(context) {
42
+ return await (0, enrollment_service_1.myEnrollments)(context);
43
+ }
44
+ async myEnrollment(id, context) {
45
+ return await (0, enrollment_service_1.myEnrollmentOf)(context, id);
46
+ }
47
+ async teamEnrollmentStatus(filter, context) {
48
+ return listOf(await (0, enrollment_status_1.teamEnrollmentStatus)(filter ?? {}, context));
49
+ }
50
+ async enrollmentStatus(filter, context) {
51
+ return listOf(await (0, enrollment_status_1.enrollmentStatus)(filter ?? {}, context));
52
+ }
53
+ async completionRegister(courseId, context) {
54
+ return (await (0, enrollment_status_1.completionRegister)(courseId, context)).map(rowOut);
55
+ }
56
+ async learningEnrollments(params, context) {
57
+ let rows = await (0, learning_ai_1.readableEnrollments)(context);
58
+ for (const filter of params?.filters ?? []) {
59
+ const values = Array.isArray(filter.value) ? filter.value.map(String) : [String(filter.value)];
60
+ if (filter.name === 'state')
61
+ rows = rows.filter(row => values.includes(row.state) !== (filter.operator === 'notin' || filter.operator === 'noteq'));
62
+ }
63
+ const search = String(params?.search ?? params?.filters?.find(one => one.operator === 'search')?.value ?? '').replace(/%/g, '').trim();
64
+ if (search)
65
+ rows = rows.filter(row => `${row.learner} ${row.departmentName ?? ''} ${row.course}`.includes(search));
66
+ const { page = 1, limit = 0 } = (params?.pagination ?? {});
67
+ return { items: limit > 0 ? rows.slice((page - 1) * limit, page * limit) : rows, total: rows.length };
68
+ }
69
+ async learningContent(enrollmentId, versionId, context) {
70
+ return await (0, learning_ai_1.courseContent)({ enrollmentId, versionId }, context);
71
+ }
72
+ /* ---------------------------------------------------------------- fields */
73
+ async course(enrollment) {
74
+ return enrollment.courseId ? await (0, shell_1.getRepository)(course_1.Course).findOneBy({ id: enrollment.courseId }) : null;
75
+ }
76
+ async user(enrollment) {
77
+ return enrollment.userId ? await (0, shell_1.getRepository)(auth_base_1.User).findOneBy({ id: enrollment.userId }) : null;
78
+ }
79
+ async version(enrollment, context) {
80
+ return await (0, enrollment_service_1.shownVersionOf)((0, course_service_1.learningManagerOf)(context), context.state.domain, enrollment);
81
+ }
82
+ state(enrollment, context) {
83
+ return (0, progress_rules_1.overdue)(enrollment, (0, enrollment_service_1.todayIn)(context.state.domain)) ? 'OVERDUE' : enrollment.status;
84
+ }
85
+ async units(enrollment, context) {
86
+ if (!(await readsInside(enrollment, context)))
87
+ return [];
88
+ const tx = (0, course_service_1.learningManagerOf)(context);
89
+ const version = await (0, enrollment_service_1.shownVersionOf)(tx, context.state.domain, enrollment);
90
+ if (!version)
91
+ return [];
92
+ const progress = await (0, enrollment_service_1.progressesOf)(tx, enrollment.id);
93
+ return (await (0, course_service_1.unitsOf)(tx, version.id)).map(unit => ({ unit, progress: progress.find(one => one.unitId === unit.id) ?? null, counts: (0, progress_rules_1.counts)(unit) }));
94
+ }
95
+ async missing(enrollment, context) {
96
+ if (!(await readsInside(enrollment, context)))
97
+ return [];
98
+ return await (0, enrollment_service_1.missingFor)((0, course_service_1.learningManagerOf)(context), context.state.domain, enrollment);
99
+ }
100
+ async attemptsLeft(enrollment, context) {
101
+ if (!(await readsInside(enrollment, context)))
102
+ return null;
103
+ const version = await (0, enrollment_service_1.shownVersionOf)((0, course_service_1.learningManagerOf)(context), context.state.domain, enrollment);
104
+ return version?.attemptLimit != null ? Math.max(0, version.attemptLimit - (enrollment.attempts ?? 0)) : null;
105
+ }
106
+ async quizSize(enrollment, context) {
107
+ const tx = (0, course_service_1.learningManagerOf)(context);
108
+ const version = await (0, enrollment_service_1.shownVersionOf)(tx, context.state.domain, enrollment);
109
+ if (!version || version.passScore == null)
110
+ return 0;
111
+ const all = await tx.getRepository(course_question_1.CourseQuestion).count({ where: { version: { id: version.id } } });
112
+ return version.questionCount ? Math.min(version.questionCount, all) : all;
113
+ }
114
+ };
115
+ exports.EnrollmentQuery = EnrollmentQuery;
116
+ tslib_1.__decorate([
117
+ (0, type_graphql_1.Directive)('@privilege(category: "learning", privilege: "query", domainOwnerGranted: true)'),
118
+ (0, type_graphql_1.Query)(returns => [enrollment_1.Enrollment], { description: "The request's own enrolments - open ones first, the soonest due first, then the completed." }),
119
+ tslib_1.__param(0, (0, type_graphql_1.Ctx)()),
120
+ tslib_1.__metadata("design:type", Function),
121
+ tslib_1.__metadata("design:paramtypes", [Object]),
122
+ tslib_1.__metadata("design:returntype", Promise)
123
+ ], EnrollmentQuery.prototype, "myEnrollments", null);
124
+ tslib_1.__decorate([
125
+ (0, type_graphql_1.Directive)('@privilege(category: "learning", privilege: "query", domainOwnerGranted: true)'),
126
+ (0, type_graphql_1.Query)(returns => enrollment_1.Enrollment, { description: "One of the request's own enrolments." }),
127
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
128
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
129
+ tslib_1.__metadata("design:type", Function),
130
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
131
+ tslib_1.__metadata("design:returntype", Promise)
132
+ ], EnrollmentQuery.prototype, "myEnrollment", null);
133
+ tslib_1.__decorate([
134
+ (0, type_graphql_1.Directive)('@privilege(category: "learning", privilege: "query", domainOwnerGranted: true)'),
135
+ (0, type_graphql_1.Query)(returns => enrollment_type_1.EnrollmentStatusList, { description: "Where the people of the request's departments stand - for a department head, status and days only." }),
136
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('filter', type => enrollment_type_1.EnrollmentStatusFilter, { nullable: true })),
137
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
138
+ tslib_1.__metadata("design:type", Function),
139
+ tslib_1.__metadata("design:paramtypes", [enrollment_type_1.EnrollmentStatusFilter, Object]),
140
+ tslib_1.__metadata("design:returntype", Promise)
141
+ ], EnrollmentQuery.prototype, "teamEnrollmentStatus", null);
142
+ tslib_1.__decorate([
143
+ (0, type_graphql_1.Directive)('@privilege(category: "course", privilege: "query", domainOwnerGranted: true)'),
144
+ (0, type_graphql_1.Query)(returns => enrollment_type_1.EnrollmentStatusList, { description: 'Every enrolment of a course or a source, with its progress and evidence.' }),
145
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('filter', type => enrollment_type_1.EnrollmentStatusFilter, { nullable: true })),
146
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
147
+ tslib_1.__metadata("design:type", Function),
148
+ tslib_1.__metadata("design:paramtypes", [enrollment_type_1.EnrollmentStatusFilter, Object]),
149
+ tslib_1.__metadata("design:returntype", Promise)
150
+ ], EnrollmentQuery.prototype, "enrollmentStatus", null);
151
+ tslib_1.__decorate([
152
+ (0, type_graphql_1.Directive)('@privilege(category: "course", privilege: "query", domainOwnerGranted: true)'),
153
+ (0, type_graphql_1.Query)(returns => [enrollment_type_1.EnrollmentStatusRow], { description: 'The completion register of a course - every completion by its day.' }),
154
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('courseId')),
155
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
156
+ tslib_1.__metadata("design:type", Function),
157
+ tslib_1.__metadata("design:paramtypes", [String, Object]),
158
+ tslib_1.__metadata("design:returntype", Promise)
159
+ ], EnrollmentQuery.prototype, "completionRegister", null);
160
+ tslib_1.__decorate([
161
+ (0, type_graphql_1.Directive)('@privilege(category: "learning", privilege: "query", domainOwnerGranted: true)'),
162
+ (0, type_graphql_1.Query)(returns => enrollment_type_1.LearningEnrollmentList, { description: 'The enrolments the request may read - a manager every one, a department head their people (status only), anyone else their own - for the assistant (ADR-0194 decision 12).' }),
163
+ tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
164
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
165
+ tslib_1.__metadata("design:type", Function),
166
+ tslib_1.__metadata("design:paramtypes", [shell_1.ListParam, Object]),
167
+ tslib_1.__metadata("design:returntype", Promise)
168
+ ], EnrollmentQuery.prototype, "learningEnrollments", null);
169
+ tslib_1.__decorate([
170
+ (0, type_graphql_1.Directive)('@privilege(category: "learning", privilege: "query", domainOwnerGranted: true)'),
171
+ (0, type_graphql_1.Query)(returns => enrollment_type_1.LearningContent, { description: "The units of one course version for the assistant - a learner's own enrolment's (not while a quiz attempt is open), or a version for a manager (ADR-0194 decision 12)." }),
172
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('enrollmentId', { nullable: true })),
173
+ tslib_1.__param(1, (0, type_graphql_1.Arg)('versionId', { nullable: true })),
174
+ tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
175
+ tslib_1.__metadata("design:type", Function),
176
+ tslib_1.__metadata("design:paramtypes", [String, String, Object]),
177
+ tslib_1.__metadata("design:returntype", Promise)
178
+ ], EnrollmentQuery.prototype, "learningContent", null);
179
+ tslib_1.__decorate([
180
+ (0, type_graphql_1.FieldResolver)(type => course_1.Course, { nullable: true, description: 'The course.' }),
181
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
182
+ tslib_1.__metadata("design:type", Function),
183
+ tslib_1.__metadata("design:paramtypes", [enrollment_1.Enrollment]),
184
+ tslib_1.__metadata("design:returntype", Promise)
185
+ ], EnrollmentQuery.prototype, "course", null);
186
+ tslib_1.__decorate([
187
+ (0, type_graphql_1.FieldResolver)(type => auth_base_1.User, { nullable: true, description: 'Who takes it.' }),
188
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
189
+ tslib_1.__metadata("design:type", Function),
190
+ tslib_1.__metadata("design:paramtypes", [enrollment_1.Enrollment]),
191
+ tslib_1.__metadata("design:returntype", Promise)
192
+ ], EnrollmentQuery.prototype, "user", null);
193
+ tslib_1.__decorate([
194
+ (0, type_graphql_1.FieldResolver)(type => course_version_1.CourseVersion, { nullable: true, description: 'The version it shows - its own once started, the published one before.' }),
195
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
196
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
197
+ tslib_1.__metadata("design:type", Function),
198
+ tslib_1.__metadata("design:paramtypes", [enrollment_1.Enrollment, Object]),
199
+ tslib_1.__metadata("design:returntype", Promise)
200
+ ], EnrollmentQuery.prototype, "version", null);
201
+ tslib_1.__decorate([
202
+ (0, type_graphql_1.FieldResolver)(type => String, { description: 'Where it stands today - OVERDUE for an open one past its due day.' }),
203
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
204
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
205
+ tslib_1.__metadata("design:type", Function),
206
+ tslib_1.__metadata("design:paramtypes", [enrollment_1.Enrollment, Object]),
207
+ tslib_1.__metadata("design:returntype", String)
208
+ ], EnrollmentQuery.prototype, "state", null);
209
+ tslib_1.__decorate([
210
+ (0, type_graphql_1.FieldResolver)(type => [enrollment_type_1.LearningUnit], { description: 'Its units with how far the learner went - for its learner and managers.' }),
211
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
212
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
213
+ tslib_1.__metadata("design:type", Function),
214
+ tslib_1.__metadata("design:paramtypes", [enrollment_1.Enrollment, Object]),
215
+ tslib_1.__metadata("design:returntype", Promise)
216
+ ], EnrollmentQuery.prototype, "units", null);
217
+ tslib_1.__decorate([
218
+ (0, type_graphql_1.FieldResolver)(type => [String], { description: 'What still stands before completion - units, time, quiz, acknowledgement.' }),
219
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
220
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
221
+ tslib_1.__metadata("design:type", Function),
222
+ tslib_1.__metadata("design:paramtypes", [enrollment_1.Enrollment, Object]),
223
+ tslib_1.__metadata("design:returntype", Promise)
224
+ ], EnrollmentQuery.prototype, "missing", null);
225
+ tslib_1.__decorate([
226
+ (0, type_graphql_1.FieldResolver)(type => type_graphql_1.Int, { nullable: true, description: 'The quiz attempts left - no limit, or no quiz, when empty.' }),
227
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
228
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
229
+ tslib_1.__metadata("design:type", Function),
230
+ tslib_1.__metadata("design:paramtypes", [enrollment_1.Enrollment, Object]),
231
+ tslib_1.__metadata("design:returntype", Promise)
232
+ ], EnrollmentQuery.prototype, "attemptsLeft", null);
233
+ tslib_1.__decorate([
234
+ (0, type_graphql_1.FieldResolver)(type => type_graphql_1.Int, { description: 'How many questions its quiz draws - 0 when it has none.' }),
235
+ tslib_1.__param(0, (0, type_graphql_1.Root)()),
236
+ tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
237
+ tslib_1.__metadata("design:type", Function),
238
+ tslib_1.__metadata("design:paramtypes", [enrollment_1.Enrollment, Object]),
239
+ tslib_1.__metadata("design:returntype", Promise)
240
+ ], EnrollmentQuery.prototype, "quizSize", null);
241
+ exports.EnrollmentQuery = EnrollmentQuery = tslib_1.__decorate([
242
+ (0, type_graphql_1.Resolver)(enrollment_1.Enrollment),
243
+ (0, type_graphql_1.UseMiddleware)(shell_1.SpeakRefusals)
244
+ ], EnrollmentQuery);
245
+ //# sourceMappingURL=enrollment-query.js.map