@studious-lms/server 1.7.0 → 1.9.0

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 (212) hide show
  1. package/dist/middleware/security.d.ts.map +1 -1
  2. package/dist/middleware/security.js +3 -3
  3. package/dist/middleware/security.js.map +1 -1
  4. package/dist/models/access.d.ts +21 -66
  5. package/dist/models/access.d.ts.map +1 -1
  6. package/dist/models/access.js +10 -26
  7. package/dist/models/access.js.map +1 -1
  8. package/dist/models/agenda.d.ts +4 -2
  9. package/dist/models/agenda.d.ts.map +1 -1
  10. package/dist/models/announcement.d.ts +4 -3
  11. package/dist/models/announcement.d.ts.map +1 -1
  12. package/dist/models/announcement.js +2 -3
  13. package/dist/models/announcement.js.map +1 -1
  14. package/dist/models/assignment.d.ts +40 -33
  15. package/dist/models/assignment.d.ts.map +1 -1
  16. package/dist/models/auth.d.ts +2 -4
  17. package/dist/models/auth.d.ts.map +1 -1
  18. package/dist/models/auth.js +2 -3
  19. package/dist/models/auth.js.map +1 -1
  20. package/dist/models/class.d.ts +34 -6
  21. package/dist/models/class.d.ts.map +1 -1
  22. package/dist/models/class.js +15 -2
  23. package/dist/models/class.js.map +1 -1
  24. package/dist/models/cloudStorage.d.ts +153 -0
  25. package/dist/models/cloudStorage.d.ts.map +1 -0
  26. package/dist/models/cloudStorage.js +295 -0
  27. package/dist/models/cloudStorage.js.map +1 -0
  28. package/dist/models/comment.d.ts +0 -24
  29. package/dist/models/comment.d.ts.map +1 -1
  30. package/dist/models/comment.js +2 -6
  31. package/dist/models/comment.js.map +1 -1
  32. package/dist/models/conversation.d.ts +22 -22
  33. package/dist/models/department.d.ts +154 -0
  34. package/dist/models/department.d.ts.map +1 -0
  35. package/dist/models/department.js +135 -0
  36. package/dist/models/department.js.map +1 -0
  37. package/dist/models/event.d.ts +10 -4
  38. package/dist/models/event.d.ts.map +1 -1
  39. package/dist/models/event.js +2 -5
  40. package/dist/models/event.js.map +1 -1
  41. package/dist/models/file.d.ts +52 -36
  42. package/dist/models/file.d.ts.map +1 -1
  43. package/dist/models/file.js +4 -42
  44. package/dist/models/file.js.map +1 -1
  45. package/dist/models/folder.d.ts +47 -0
  46. package/dist/models/folder.d.ts.map +1 -1
  47. package/dist/models/labChat.d.ts +11 -9
  48. package/dist/models/labChat.d.ts.map +1 -1
  49. package/dist/models/message.d.ts +46 -12
  50. package/dist/models/message.d.ts.map +1 -1
  51. package/dist/models/message.js +19 -10
  52. package/dist/models/message.js.map +1 -1
  53. package/dist/models/newtonChat.d.ts +2 -1
  54. package/dist/models/newtonChat.d.ts.map +1 -1
  55. package/dist/models/school.d.ts +45 -12
  56. package/dist/models/school.d.ts.map +1 -1
  57. package/dist/models/school.js +19 -2
  58. package/dist/models/school.js.map +1 -1
  59. package/dist/models/section.d.ts +2 -1
  60. package/dist/models/section.d.ts.map +1 -1
  61. package/dist/models/tag.d.ts +117 -0
  62. package/dist/models/tag.d.ts.map +1 -0
  63. package/dist/models/tag.js +113 -0
  64. package/dist/models/tag.js.map +1 -0
  65. package/dist/models/worksheet.d.ts +3 -0
  66. package/dist/models/worksheet.d.ts.map +1 -1
  67. package/dist/pipelines/aiLabChatContract.d.ts +8 -8
  68. package/dist/routers/_app.d.ts +6704 -5222
  69. package/dist/routers/_app.d.ts.map +1 -1
  70. package/dist/routers/_app.js +8 -2
  71. package/dist/routers/_app.js.map +1 -1
  72. package/dist/routers/agenda.d.ts +4 -2
  73. package/dist/routers/agenda.d.ts.map +1 -1
  74. package/dist/routers/announcement.d.ts.map +1 -1
  75. package/dist/routers/announcement.js +3 -5
  76. package/dist/routers/announcement.js.map +1 -1
  77. package/dist/routers/assignment.d.ts +49 -40
  78. package/dist/routers/assignment.d.ts.map +1 -1
  79. package/dist/routers/assignment.js +2 -3
  80. package/dist/routers/assignment.js.map +1 -1
  81. package/dist/routers/class.d.ts +92 -19
  82. package/dist/routers/class.d.ts.map +1 -1
  83. package/dist/routers/class.js +5 -2
  84. package/dist/routers/class.js.map +1 -1
  85. package/dist/routers/conversation.d.ts +5 -5
  86. package/dist/routers/department.d.ts +293 -0
  87. package/dist/routers/department.d.ts.map +1 -0
  88. package/dist/routers/department.js +93 -0
  89. package/dist/routers/department.js.map +1 -0
  90. package/dist/routers/event.d.ts +4 -3
  91. package/dist/routers/event.d.ts.map +1 -1
  92. package/dist/routers/file.d.ts +10 -8
  93. package/dist/routers/file.d.ts.map +1 -1
  94. package/dist/routers/file.js +26 -17
  95. package/dist/routers/file.js.map +1 -1
  96. package/dist/routers/folder.d.ts +163 -186
  97. package/dist/routers/folder.d.ts.map +1 -1
  98. package/dist/routers/folder.js +102 -88
  99. package/dist/routers/folder.js.map +1 -1
  100. package/dist/routers/labChat.d.ts +13 -4
  101. package/dist/routers/labChat.d.ts.map +1 -1
  102. package/dist/routers/message.d.ts +20 -2
  103. package/dist/routers/message.d.ts.map +1 -1
  104. package/dist/routers/newtonChat.d.ts +10 -1
  105. package/dist/routers/newtonChat.d.ts.map +1 -1
  106. package/dist/routers/permissions.d.ts +120 -0
  107. package/dist/routers/permissions.d.ts.map +1 -0
  108. package/dist/routers/permissions.js +50 -0
  109. package/dist/routers/permissions.js.map +1 -0
  110. package/dist/routers/school.d.ts +160 -17
  111. package/dist/routers/school.d.ts.map +1 -1
  112. package/dist/routers/school.js +46 -3
  113. package/dist/routers/school.js.map +1 -1
  114. package/dist/routers/tag.d.ts +119 -0
  115. package/dist/routers/tag.d.ts.map +1 -0
  116. package/dist/routers/tag.js +52 -0
  117. package/dist/routers/tag.js.map +1 -0
  118. package/dist/routers/worksheet.d.ts +1 -0
  119. package/dist/routers/worksheet.d.ts.map +1 -1
  120. package/dist/seedDatabase.d.ts +0 -1
  121. package/dist/seedDatabase.d.ts.map +1 -1
  122. package/dist/services/agenda.d.ts +4 -2
  123. package/dist/services/agenda.d.ts.map +1 -1
  124. package/dist/services/assignment.d.ts +49 -40
  125. package/dist/services/assignment.d.ts.map +1 -1
  126. package/dist/services/class.d.ts +92 -19
  127. package/dist/services/class.d.ts.map +1 -1
  128. package/dist/services/class.js +92 -5
  129. package/dist/services/class.js.map +1 -1
  130. package/dist/services/conversation.d.ts +5 -5
  131. package/dist/services/department.d.ts +200 -0
  132. package/dist/services/department.d.ts.map +1 -0
  133. package/dist/services/department.js +368 -0
  134. package/dist/services/department.js.map +1 -0
  135. package/dist/services/event.d.ts +4 -3
  136. package/dist/services/event.d.ts.map +1 -1
  137. package/dist/services/file.d.ts +105 -3
  138. package/dist/services/file.d.ts.map +1 -1
  139. package/dist/services/file.js +167 -41
  140. package/dist/services/file.js.map +1 -1
  141. package/dist/services/folder.d.ts +220 -149
  142. package/dist/services/folder.d.ts.map +1 -1
  143. package/dist/services/folder.js +326 -196
  144. package/dist/services/folder.js.map +1 -1
  145. package/dist/services/labChat.d.ts +13 -4
  146. package/dist/services/labChat.d.ts.map +1 -1
  147. package/dist/services/labChat.js +4 -3
  148. package/dist/services/labChat.js.map +1 -1
  149. package/dist/services/message.d.ts +20 -2
  150. package/dist/services/message.d.ts.map +1 -1
  151. package/dist/services/message.js +7 -23
  152. package/dist/services/message.js.map +1 -1
  153. package/dist/services/newtonChat.d.ts +9 -0
  154. package/dist/services/newtonChat.d.ts.map +1 -1
  155. package/dist/services/newtonChat.js +4 -3
  156. package/dist/services/newtonChat.js.map +1 -1
  157. package/dist/services/permissions.d.ts +188 -0
  158. package/dist/services/permissions.d.ts.map +1 -0
  159. package/dist/services/permissions.js +661 -0
  160. package/dist/services/permissions.js.map +1 -0
  161. package/dist/services/school.d.ts +142 -15
  162. package/dist/services/school.d.ts.map +1 -1
  163. package/dist/services/school.js +308 -54
  164. package/dist/services/school.js.map +1 -1
  165. package/dist/services/tag.d.ts +71 -0
  166. package/dist/services/tag.d.ts.map +1 -0
  167. package/dist/services/tag.js +178 -0
  168. package/dist/services/tag.js.map +1 -0
  169. package/dist/services/worksheet.d.ts +1 -0
  170. package/dist/services/worksheet.d.ts.map +1 -1
  171. package/dist/utils/aiUser.d.ts.map +1 -1
  172. package/dist/utils/aiUser.js +2 -3
  173. package/dist/utils/aiUser.js.map +1 -1
  174. package/package.json +1 -1
  175. package/prisma/migrations/20260509220000_institution_overhaul/migration.sql +184 -0
  176. package/prisma/migrations/20260510170000_add_folder_permissions/migration.sql +93 -0
  177. package/prisma/schema.prisma +193 -35
  178. package/src/middleware/security.ts +1 -1
  179. package/src/models/access.ts +8 -24
  180. package/src/models/announcement.ts +0 -1
  181. package/src/models/auth.ts +0 -1
  182. package/src/models/class.ts +13 -0
  183. package/src/models/cloudStorage.ts +327 -0
  184. package/src/models/comment.ts +0 -4
  185. package/src/models/department.ts +159 -0
  186. package/src/models/event.ts +0 -3
  187. package/src/models/file.ts +2 -40
  188. package/src/models/message.ts +19 -5
  189. package/src/models/school.ts +26 -0
  190. package/src/models/tag.ts +140 -0
  191. package/src/routers/_app.ts +6 -0
  192. package/src/routers/announcement.ts +1 -3
  193. package/src/routers/assignment.ts +0 -1
  194. package/src/routers/class.ts +3 -0
  195. package/src/routers/department.ts +174 -0
  196. package/src/routers/file.ts +29 -26
  197. package/src/routers/folder.ts +127 -118
  198. package/src/routers/permissions.ts +71 -0
  199. package/src/routers/school.ts +83 -0
  200. package/src/routers/tag.ts +78 -0
  201. package/src/services/class.ts +109 -4
  202. package/src/services/department.ts +478 -0
  203. package/src/services/file.ts +172 -43
  204. package/src/services/folder.ts +399 -237
  205. package/src/services/labChat.ts +2 -1
  206. package/src/services/message.ts +5 -21
  207. package/src/services/newtonChat.ts +2 -1
  208. package/src/services/permissions.ts +778 -0
  209. package/src/services/school.ts +369 -57
  210. package/src/services/tag.ts +229 -0
  211. package/src/utils/aiUser.ts +0 -1
  212. package/tests/unit/services/permissions.test.ts +463 -0
@@ -0,0 +1,154 @@
1
+ export declare function listDepartmentsForSchool(schoolId: string): import(".prisma/client").Prisma.PrismaPromise<{
2
+ name: string;
3
+ id: string;
4
+ description: string | null;
5
+ createdAt: Date;
6
+ updatedAt: Date;
7
+ schoolId: string;
8
+ color: string | null;
9
+ _count: {
10
+ tags: number;
11
+ classes: number;
12
+ members: number;
13
+ rubricTemplates: number;
14
+ boundaryTemplates: number;
15
+ };
16
+ }[]>;
17
+ export declare function listDepartmentsForUser(userId: string, schoolId: string): import(".prisma/client").Prisma.PrismaPromise<{
18
+ name: string;
19
+ id: string;
20
+ description: string | null;
21
+ createdAt: Date;
22
+ updatedAt: Date;
23
+ schoolId: string;
24
+ color: string | null;
25
+ }[]>;
26
+ export declare function getDepartment(departmentId: string): import(".prisma/client").Prisma.Prisma__DepartmentClient<{
27
+ name: string;
28
+ id: string;
29
+ description: string | null;
30
+ createdAt: Date;
31
+ updatedAt: Date;
32
+ schoolId: string;
33
+ color: string | null;
34
+ tags: {
35
+ name: string;
36
+ id: string;
37
+ color: string;
38
+ }[];
39
+ classes: {
40
+ name: string;
41
+ id: string;
42
+ subject: string;
43
+ color: string | null;
44
+ section: string;
45
+ }[];
46
+ members: {
47
+ id: string;
48
+ username: string;
49
+ email: string;
50
+ profile: {
51
+ displayName: string | null;
52
+ profilePicture: string | null;
53
+ profilePictureThumbnail: string | null;
54
+ } | null;
55
+ }[];
56
+ rubricTemplates: {
57
+ name: string | null;
58
+ id: string;
59
+ structured: string;
60
+ }[];
61
+ boundaryTemplates: {
62
+ name: string | null;
63
+ id: string;
64
+ structured: string;
65
+ }[];
66
+ } | null, null, import("@prisma/client/runtime/library.js").DefaultArgs, {
67
+ datasources: {
68
+ db: {
69
+ url: string;
70
+ };
71
+ };
72
+ }>;
73
+ export declare function createDepartment(data: {
74
+ schoolId: string;
75
+ name: string;
76
+ description?: string;
77
+ color?: string;
78
+ }): import(".prisma/client").Prisma.Prisma__DepartmentClient<{
79
+ name: string;
80
+ id: string;
81
+ description: string | null;
82
+ createdAt: Date;
83
+ updatedAt: Date;
84
+ schoolId: string;
85
+ color: string | null;
86
+ }, never, import("@prisma/client/runtime/library.js").DefaultArgs, {
87
+ datasources: {
88
+ db: {
89
+ url: string;
90
+ };
91
+ };
92
+ }>;
93
+ export declare function updateDepartment(departmentId: string, data: {
94
+ name?: string;
95
+ description?: string | null;
96
+ color?: string;
97
+ }): import(".prisma/client").Prisma.Prisma__DepartmentClient<{
98
+ name: string;
99
+ id: string;
100
+ description: string | null;
101
+ createdAt: Date;
102
+ updatedAt: Date;
103
+ schoolId: string;
104
+ color: string | null;
105
+ }, never, import("@prisma/client/runtime/library.js").DefaultArgs, {
106
+ datasources: {
107
+ db: {
108
+ url: string;
109
+ };
110
+ };
111
+ }>;
112
+ export declare function deleteDepartment(departmentId: string): import(".prisma/client").Prisma.Prisma__DepartmentClient<{
113
+ name: string;
114
+ id: string;
115
+ description: string | null;
116
+ createdAt: Date;
117
+ updatedAt: Date;
118
+ schoolId: string;
119
+ color: string | null;
120
+ }, never, import("@prisma/client/runtime/library.js").DefaultArgs, {
121
+ datasources: {
122
+ db: {
123
+ url: string;
124
+ };
125
+ };
126
+ }>;
127
+ export declare function addDepartmentMembers(departmentId: string, userIds: string[]): import(".prisma/client").Prisma.Prisma__DepartmentClient<{
128
+ id: string;
129
+ }, never, import("@prisma/client/runtime/library.js").DefaultArgs, {
130
+ datasources: {
131
+ db: {
132
+ url: string;
133
+ };
134
+ };
135
+ }>;
136
+ export declare function removeDepartmentMember(departmentId: string, userId: string): import(".prisma/client").Prisma.Prisma__DepartmentClient<{
137
+ id: string;
138
+ }, never, import("@prisma/client/runtime/library.js").DefaultArgs, {
139
+ datasources: {
140
+ db: {
141
+ url: string;
142
+ };
143
+ };
144
+ }>;
145
+ export declare function findDepartmentMembership(departmentId: string, userId: string): import(".prisma/client").Prisma.Prisma__DepartmentClient<{
146
+ id: string;
147
+ } | null, null, import("@prisma/client/runtime/library.js").DefaultArgs, {
148
+ datasources: {
149
+ db: {
150
+ url: string;
151
+ };
152
+ };
153
+ }>;
154
+ //# sourceMappingURL=department.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"department.d.ts","sourceRoot":"/","sources":["models/department.ts"],"names":[],"mappings":"AAgCA,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM;;;;;;;;;;;;;;;KAiBxD;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;;;;;;;;KAStE;AAED,wBAAgB,aAAa,CAAC,YAAY,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BjD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;;;;;;;;;;;;;;GAUA;AAED,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;GAOrE;AAED,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM;;;;;;;;;;;;;;GAIpD;AAED,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EAAE;;;;;;;;GASlB;AAED,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM;;;;;;;;GASf;AAED,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM;;;;;;;;GAMf"}
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Department model — department CRUD, members, and template artefacts.
3
+ *
4
+ * Departments scope rubric/boundary templates and tags inside an institution.
5
+ * They are an admin-managed taxonomy; teachers/students can be members of
6
+ * many departments.
7
+ */
8
+
9
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5b5ee7e7-d0d6-5846-a279-d6c6dee02dd4")}catch(e){}}();
10
+ import { prisma } from "../lib/prisma.js";
11
+ const departmentSelect = {
12
+ id: true,
13
+ schoolId: true,
14
+ name: true,
15
+ description: true,
16
+ color: true,
17
+ createdAt: true,
18
+ updatedAt: true,
19
+ };
20
+ const memberSelect = {
21
+ id: true,
22
+ username: true,
23
+ email: true,
24
+ profile: {
25
+ select: {
26
+ displayName: true,
27
+ profilePicture: true,
28
+ profilePictureThumbnail: true,
29
+ },
30
+ },
31
+ };
32
+ export function listDepartmentsForSchool(schoolId) {
33
+ return prisma.department.findMany({
34
+ where: { schoolId },
35
+ orderBy: { name: "asc" },
36
+ select: {
37
+ ...departmentSelect,
38
+ _count: {
39
+ select: {
40
+ members: true,
41
+ classes: true,
42
+ tags: true,
43
+ rubricTemplates: true,
44
+ boundaryTemplates: true,
45
+ },
46
+ },
47
+ },
48
+ });
49
+ }
50
+ export function listDepartmentsForUser(userId, schoolId) {
51
+ return prisma.department.findMany({
52
+ where: {
53
+ schoolId,
54
+ members: { some: { id: userId } },
55
+ },
56
+ orderBy: { name: "asc" },
57
+ select: departmentSelect,
58
+ });
59
+ }
60
+ export function getDepartment(departmentId) {
61
+ return prisma.department.findUnique({
62
+ where: { id: departmentId },
63
+ select: {
64
+ ...departmentSelect,
65
+ members: { select: memberSelect },
66
+ tags: {
67
+ select: { id: true, name: true, color: true },
68
+ },
69
+ rubricTemplates: {
70
+ select: { id: true, name: true, structured: true },
71
+ },
72
+ boundaryTemplates: {
73
+ select: { id: true, name: true, structured: true },
74
+ },
75
+ classes: {
76
+ select: {
77
+ id: true,
78
+ name: true,
79
+ subject: true,
80
+ section: true,
81
+ color: true,
82
+ },
83
+ },
84
+ },
85
+ });
86
+ }
87
+ export function createDepartment(data) {
88
+ return prisma.department.create({
89
+ data: {
90
+ schoolId: data.schoolId,
91
+ name: data.name,
92
+ description: data.description,
93
+ color: data.color,
94
+ },
95
+ select: departmentSelect,
96
+ });
97
+ }
98
+ export function updateDepartment(departmentId, data) {
99
+ return prisma.department.update({
100
+ where: { id: departmentId },
101
+ data,
102
+ select: departmentSelect,
103
+ });
104
+ }
105
+ export function deleteDepartment(departmentId) {
106
+ return prisma.department.delete({
107
+ where: { id: departmentId },
108
+ });
109
+ }
110
+ export function addDepartmentMembers(departmentId, userIds) {
111
+ return prisma.department.update({
112
+ where: { id: departmentId },
113
+ data: {
114
+ members: { connect: userIds.map((id) => ({ id })) },
115
+ },
116
+ select: { id: true },
117
+ });
118
+ }
119
+ export function removeDepartmentMember(departmentId, userId) {
120
+ return prisma.department.update({
121
+ where: { id: departmentId },
122
+ data: {
123
+ members: { disconnect: { id: userId } },
124
+ },
125
+ select: { id: true },
126
+ });
127
+ }
128
+ export function findDepartmentMembership(departmentId, userId) {
129
+ return prisma.department.findFirst({
130
+ where: { id: departmentId, members: { some: { id: userId } } },
131
+ select: { id: true },
132
+ });
133
+ }
134
+ //# sourceMappingURL=department.js.map
135
+ //# debugId=5b5ee7e7-d0d6-5846-a279-d6c6dee02dd4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"department.js","sources":["models/department.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Department model — department CRUD, members, and template artefacts.\n *\n * Departments scope rubric/boundary templates and tags inside an institution.\n * They are an admin-managed taxonomy; teachers/students can be members of\n * many departments.\n */\nimport { prisma } from \"../lib/prisma.js\";\n\nconst departmentSelect = {\n id: true,\n schoolId: true,\n name: true,\n description: true,\n color: true,\n createdAt: true,\n updatedAt: true,\n} as const;\n\nconst memberSelect = {\n id: true,\n username: true,\n email: true,\n profile: {\n select: {\n displayName: true,\n profilePicture: true,\n profilePictureThumbnail: true,\n },\n },\n} as const;\n\nexport function listDepartmentsForSchool(schoolId: string) {\n return prisma.department.findMany({\n where: { schoolId },\n orderBy: { name: \"asc\" },\n select: {\n ...departmentSelect,\n _count: {\n select: {\n members: true,\n classes: true,\n tags: true,\n rubricTemplates: true,\n boundaryTemplates: true,\n },\n },\n },\n });\n}\n\nexport function listDepartmentsForUser(userId: string, schoolId: string) {\n return prisma.department.findMany({\n where: {\n schoolId,\n members: { some: { id: userId } },\n },\n orderBy: { name: \"asc\" },\n select: departmentSelect,\n });\n}\n\nexport function getDepartment(departmentId: string) {\n return prisma.department.findUnique({\n where: { id: departmentId },\n select: {\n ...departmentSelect,\n members: { select: memberSelect },\n tags: {\n select: { id: true, name: true, color: true },\n },\n rubricTemplates: {\n select: { id: true, name: true, structured: true },\n },\n boundaryTemplates: {\n select: { id: true, name: true, structured: true },\n },\n classes: {\n select: {\n id: true,\n name: true,\n subject: true,\n section: true,\n color: true,\n },\n },\n },\n });\n}\n\nexport function createDepartment(data: {\n schoolId: string;\n name: string;\n description?: string;\n color?: string;\n}) {\n return prisma.department.create({\n data: {\n schoolId: data.schoolId,\n name: data.name,\n description: data.description,\n color: data.color,\n },\n select: departmentSelect,\n });\n}\n\nexport function updateDepartment(\n departmentId: string,\n data: { name?: string; description?: string | null; color?: string }\n) {\n return prisma.department.update({\n where: { id: departmentId },\n data,\n select: departmentSelect,\n });\n}\n\nexport function deleteDepartment(departmentId: string) {\n return prisma.department.delete({\n where: { id: departmentId },\n });\n}\n\nexport function addDepartmentMembers(\n departmentId: string,\n userIds: string[]\n) {\n return prisma.department.update({\n where: { id: departmentId },\n data: {\n members: { connect: userIds.map((id) => ({ id })) },\n },\n select: { id: true },\n });\n}\n\nexport function removeDepartmentMember(\n departmentId: string,\n userId: string\n) {\n return prisma.department.update({\n where: { id: departmentId },\n data: {\n members: { disconnect: { id: userId } },\n },\n select: { id: true },\n });\n}\n\nexport function findDepartmentMembership(\n departmentId: string,\n userId: string\n) {\n return prisma.department.findFirst({\n where: { id: departmentId, members: { some: { id: userId } } },\n select: { id: true },\n });\n}\n"],"names":[],"mappings":"AAAA;;;;;;GAMG;;;AACH,OAAO,EAAE,MAAM,EAAE,M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d4"}
@@ -6,7 +6,6 @@ export declare function findEventById(id: string): import(".prisma/client").Pris
6
6
  email: string;
7
7
  password: string;
8
8
  verified: boolean;
9
- role: import(".prisma/client").$Enums.UserRole;
10
9
  schoolId: string | null;
11
10
  } | null;
12
11
  class: ({
@@ -20,6 +19,7 @@ export declare function findEventById(id: string): import(".prisma/client").Pris
20
19
  } & {
21
20
  name: string;
22
21
  id: string;
22
+ description: string | null;
23
23
  logoId: string | null;
24
24
  subdomain: string | null;
25
25
  createdAt: Date;
@@ -36,6 +36,7 @@ export declare function findEventById(id: string): import(".prisma/client").Pris
36
36
  color: string | null;
37
37
  section: string;
38
38
  syllabus: string | null;
39
+ departmentId: string | null;
39
40
  }) | null;
40
41
  assignmentsAttached: {
41
42
  type: import(".prisma/client").$Enums.AssignmentType;
@@ -86,6 +87,7 @@ export declare function findClassWithTeachers(classId: string, teacherId: string
86
87
  color: string | null;
87
88
  section: string;
88
89
  syllabus: string | null;
90
+ departmentId: string | null;
89
91
  } | null, null, import("@prisma/client/runtime/library.js").DefaultArgs, {
90
92
  datasources: {
91
93
  db: {
@@ -181,6 +183,7 @@ export declare function findEventWithClass(eventId: string): import(".prisma/cli
181
183
  } & {
182
184
  name: string;
183
185
  id: string;
186
+ description: string | null;
184
187
  logoId: string | null;
185
188
  subdomain: string | null;
186
189
  createdAt: Date;
@@ -197,6 +200,7 @@ export declare function findEventWithClass(eventId: string): import(".prisma/cli
197
200
  color: string | null;
198
201
  section: string;
199
202
  syllabus: string | null;
203
+ departmentId: string | null;
200
204
  }) | null;
201
205
  } & {
202
206
  name: string | null;
@@ -228,6 +232,7 @@ export declare function findAssignmentWithClass(assignmentId: string): import(".
228
232
  } & {
229
233
  name: string;
230
234
  id: string;
235
+ description: string | null;
231
236
  logoId: string | null;
232
237
  subdomain: string | null;
233
238
  createdAt: Date;
@@ -244,13 +249,14 @@ export declare function findAssignmentWithClass(assignmentId: string): import(".
244
249
  color: string | null;
245
250
  section: string;
246
251
  syllabus: string | null;
252
+ departmentId: string | null;
247
253
  };
248
254
  } & {
249
255
  type: import(".prisma/client").$Enums.AssignmentType;
250
256
  id: string;
251
257
  createdAt: Date | null;
252
- modifiedAt: Date | null;
253
258
  classId: string;
259
+ modifiedAt: Date | null;
254
260
  title: string;
255
261
  instructions: string;
256
262
  dueDate: Date;
@@ -296,8 +302,8 @@ export declare function attachAssignmentToEvent(assignmentId: string, eventId: s
296
302
  type: import(".prisma/client").$Enums.AssignmentType;
297
303
  id: string;
298
304
  createdAt: Date | null;
299
- modifiedAt: Date | null;
300
305
  classId: string;
306
+ modifiedAt: Date | null;
301
307
  title: string;
302
308
  instructions: string;
303
309
  dueDate: Date;
@@ -343,8 +349,8 @@ export declare function detachAssignmentFromEvent(assignmentId: string): import(
343
349
  type: import(".prisma/client").$Enums.AssignmentType;
344
350
  id: string;
345
351
  createdAt: Date | null;
346
- modifiedAt: Date | null;
347
352
  classId: string;
353
+ modifiedAt: Date | null;
348
354
  title: string;
349
355
  instructions: string;
350
356
  dueDate: Date;
@@ -1 +1 @@
1
- {"version":3,"file":"event.d.ts","sourceRoot":"/","sources":["models/event.ts"],"names":[],"mappings":"AAgEA,mEAAmE;AACnE,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAKvC;AAED,2DAA2D;AAC3D,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;;;;;;;;;;;;;;GAOvE;AAED,+BAA+B;AAC/B,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,IAAI,CAAC;IAChB,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf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AAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyB3D;AAED,qCAAqC;AACrC,wBAAgB,uBAAuB,CACrC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAOhB;AAED,wCAAwC;AACxC,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAM7D;AAED,sDAAsD;AACtD,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;KAqB/D"}
@@ -2,7 +2,7 @@
2
2
  * Event model – calendar events, assignment attachment/detachment.
3
3
  */
4
4
 
5
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="cf3ed911-c40a-5919-97ae-6a9c13344647")}catch(e){}}();
5
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="40b50512-03a6-535f-a397-55717298eee6")}catch(e){}}();
6
6
  import { prisma } from "../lib/prisma.js";
7
7
  import { classTeacherOrSchoolAdminWhere } from "./access.js";
8
8
  const eventGetInclude = {
@@ -12,7 +12,6 @@ const eventGetInclude = {
12
12
  school: {
13
13
  include: {
14
14
  users: {
15
- where: { role: "ADMIN" },
16
15
  select: { id: true },
17
16
  },
18
17
  memberships: {
@@ -107,7 +106,6 @@ export function findEventWithClass(eventId) {
107
106
  school: {
108
107
  include: {
109
108
  users: {
110
- where: { role: "ADMIN" },
111
109
  select: { id: true },
112
110
  },
113
111
  memberships: {
@@ -135,7 +133,6 @@ export function findAssignmentWithClass(assignmentId) {
135
133
  school: {
136
134
  include: {
137
135
  users: {
138
- where: { role: "ADMIN" },
139
136
  select: { id: true },
140
137
  },
141
138
  memberships: {
@@ -192,4 +189,4 @@ export function findAvailableAssignmentsForClass(classId) {
192
189
  });
193
190
  }
194
191
  //# sourceMappingURL=event.js.map
195
- //# debugId=cf3ed911-c40a-5919-97ae-6a9c13344647
192
+ //# debugId=40b50512-03a6-535f-a397-55717298eee6
@@ -1 +1 @@
1
- {"version":3,"file":"event.js","sources":["models/event.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Event model – calendar events, assignment attachment/detachment.\n */\nimport { prisma } from \"../lib/prisma.js\";\nimport { classTeacherOrSchoolAdminWhere } from \"./access.js\";\n\nconst eventGetInclude = {\n class: {\n include: {\n teachers: { select: { id: true } },\n school: {\n include: {\n users: {\n where: { role: \"ADMIN\" as const },\n select: { id: true },\n },\n memberships: {\n where: {\n role: \"ADMIN\" as const,\n status: \"ACTIVE\" as const,\n },\n select: { userId: true },\n },\n },\n },\n },\n },\n user: true,\n assignmentsAttached: {\n select: {\n id: true,\n title: true,\n instructions: true,\n dueDate: true,\n type: true,\n graded: true,\n maxGrade: true,\n weight: true,\n attachments: { select: { id: true, name: true, type: true } },\n section: { select: { id: true, name: true } },\n teacher: { select: { id: true, username: true } },\n },\n },\n};\n\nconst eventCreateSelect = {\n id: true,\n name: true,\n location: true,\n remarks: true,\n startTime: true,\n endTime: true,\n color: true,\n classId: true,\n userId: true,\n class: { select: { id: true, name: true } },\n};\n\nconst assignmentUpdateInclude = {\n attachments: { select: { id: true, name: true, type: true } },\n section: { select: { id: true, name: true } },\n teacher: { select: { id: true, username: true } },\n};\n\n/** @returns Event by ID with class, user, attached assignments. */\nexport function findEventById(id: string) {\n return prisma.event.findUnique({\n where: { id },\n include: eventGetInclude,\n });\n}\n\n/** @returns Class if user is a teacher or school admin. */\nexport function findClassWithTeachers(classId: string, teacherId: string) {\n return prisma.class.findFirst({\n where: {\n id: classId,\n ...classTeacherOrSchoolAdminWhere(teacherId),\n },\n });\n}\n\n/** Create a calendar event. */\nexport function createEvent(data: {\n name?: string;\n location?: string;\n remarks?: string;\n startTime: Date;\n endTime: Date;\n userId: string;\n color?: string;\n classId?: string;\n}) {\n return prisma.event.create({\n data,\n select: eventCreateSelect,\n });\n}\n\n/** Update an event. */\nexport function updateEvent(\n id: string,\n data: {\n name?: string;\n location?: string;\n remarks?: string;\n startTime?: Date;\n endTime?: Date;\n color?: string;\n classId?: string;\n }\n) {\n return prisma.event.update({\n where: { id },\n data,\n });\n}\n\n/** Delete an event. */\nexport function deleteEventById(id: string) {\n return prisma.event.delete({\n where: { id },\n });\n}\n\n/** @returns Event with class and teachers. */\nexport function findEventWithClass(eventId: string) {\n return prisma.event.findUnique({\n where: { id: eventId },\n include: {\n class: {\n include: {\n teachers: { select: { id: true } },\n school: {\n include: {\n users: {\n where: { role: \"ADMIN\" as const },\n select: { id: true },\n },\n memberships: {\n where: {\n role: \"ADMIN\" as const,\n status: \"ACTIVE\" as const,\n },\n select: { userId: true },\n },\n },\n },\n },\n },\n },\n });\n}\n\n/** @returns Assignment with class and teachers. */\nexport function findAssignmentWithClass(assignmentId: string) {\n return prisma.assignment.findUnique({\n where: { id: assignmentId },\n include: {\n class: {\n include: {\n teachers: { select: { id: true } },\n school: {\n include: {\n users: {\n where: { role: \"ADMIN\" as const },\n select: { id: true },\n },\n memberships: {\n where: {\n role: \"ADMIN\" as const,\n status: \"ACTIVE\" as const,\n },\n select: { userId: true },\n },\n },\n },\n },\n },\n },\n });\n}\n\n/** Attach assignment to an event. */\nexport function attachAssignmentToEvent(\n assignmentId: string,\n eventId: string\n) {\n return prisma.assignment.update({\n where: { id: assignmentId },\n data: { eventAttached: { connect: { id: eventId } } },\n include: assignmentUpdateInclude,\n });\n}\n\n/** Detach assignment from its event. */\nexport function detachAssignmentFromEvent(assignmentId: string) {\n return prisma.assignment.update({\n where: { id: assignmentId },\n data: { eventAttached: { disconnect: true } },\n include: assignmentUpdateInclude,\n });\n}\n\n/** @returns Assignments not attached to any event. */\nexport function findAvailableAssignmentsForClass(classId: string) {\n return prisma.assignment.findMany({\n where: {\n classId,\n eventId: null,\n },\n select: {\n id: true,\n title: true,\n instructions: true,\n dueDate: true,\n type: true,\n graded: true,\n maxGrade: true,\n weight: true,\n section: { select: { id: true, name: true } },\n attachments: { select: { id: true, name: true, type: true } },\n teacher: { select: { id: true, username: true } },\n },\n orderBy: { createdAt: \"desc\" },\n });\n}\n"],"names":[],"mappings":"AAAA;;GAEG;;;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAE7D,MAAM,eAAe,GAAG;IACtB,KAAK,EAAE;QACL,OAAO,EAAE;YACP,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;YAClC,MAAM,EAAE;gBACN,OAAO,EAAE;oBACP,KAAK,EAAE;wBACL,KAAK,EAAE,EAAE,IAAI,EAAE,OAAgB,EAAE;wBACjC,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE;qBACrB;oBACD,WAAW,EAAE;wBACX,KAAK,EAAE;4BACL,IAAI,EAAE,OAAgB;4BACtB,MAAM,EAAE,QAAiB;yBAC1B;wBACD,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;qBACzB;iBACF;aACF;SACF;KACF;IACD,IAAI,EAAE,IAAI;IACV,mBAAmB,EAAE;QACnB,MAAM,EAAE;YACN,EAAE,EAAE,IAAI;YACR,KAAK,EAAE,IAAI;YACX,YAAY,EAAE,IAAI;YAClB,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAI;YACZ,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI;YACZ,WAAW,EAAE,EAAE,MAAM,EAAE,EA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,EAAE,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE;QAC7C,OAAO,EAAE,uBAAuB;KACjC,CAAC,CAAC;AACL,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,gCAAgC,CAAC,OAAe;IAC9D,OAAO,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC;QAChC,KAAK,EAAE;YACL,OAAO;YACP,OAAO,EAAE,IAAI;SACd;QACD,MAAM,EAAE;YACN,EAAE,EAAE,IAAI;YACR,KAAK,EAAE,IAAI;YACX,YAAY,EAAE,IAAI;YAClB,OAAO,EAAE,IAAI;YACb,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAI;YACZ,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;YAC7C,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;YAC7D,OAAO,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;SAClD;QACD,OAAO,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE;KAC/B,CAAC,CAAC;AACL,CAAC","debug_id":"cf3ed911-c40a-5919-97ae-6a9c13344647"}
1
+ {"version":3,"file":"event.js","sources":["models/event.ts"],"sourceRoot":"/","sourcesContent":["/**\n * Event model – calendar events, assignment attachment/detachment.\n */\nimport { prisma } from \"../lib/prisma.js\";\nimport { classTeacherOrSchoolAdminWhere } from \"./access.js\";\n\nconst eventGetInclude = {\n class: {\n include: {\n teachers: { select: { id: true } },\n school: {\n include: {\n users: {\n select: { id: true },\n },\n memberships: {\n where: {\n role: \"ADMIN\" as const,\n status: \"ACTIVE\" as const,\n },\n select: { userId: true },\n },\n },\n },\n },\n },\n user: true,\n assignmentsAttached: {\n select: {\n id: true,\n title: true,\n instructions: true,\n dueDate: true,\n type: true,\n graded: true,\n maxGrade: true,\n weight: true,\n attachments: { select: { id: true, name: true, type: true } },\n section: { select: { id: true, name: true } },\n teacher: { select: { id: true, username: true } },\n },\n },\n};\n\nconst eventCreateSelect = {\n id: true,\n name: true,\n location: true,\n remarks: true,\n startTime: true,\n endTime: true,\n color: true,\n classId: true,\n userId: true,\n class: { select: { id: true, name: true } },\n};\n\nconst assignmentUpdateInclude = {\n attachments: { select: { id: true, name: true, type: true } },\n section: { select: { id: true, name: true } },\n teacher: { select: { id: true, username: true } },\n};\n\n/** @returns Event by ID with class, user, attached assignments. */\nexport function findEventById(id: string) {\n return prisma.event.findUnique({\n where: { id },\n include: eventGetInclude,\n });\n}\n\n/** @returns Class if user is a teacher or school admin. */\nexport function findClassWithTeachers(classId: string, teacherId: string) {\n return prisma.class.findFirst({\n where: {\n id: classId,\n ...classTeacherOrSchoolAdminWhere(teacherId),\n },\n });\n}\n\n/** Create a calendar event. */\nexport function createEvent(data: {\n name?: string;\n location?: string;\n remarks?: string;\n startTime: Date;\n endTime: Date;\n userId: string;\n color?: string;\n classId?: string;\n}) {\n return prisma.event.create({\n data,\n select: eventCreateSelect,\n });\n}\n\n/** Update an event. */\nexport function updateEvent(\n id: string,\n data: {\n name?: string;\n location?: string;\n remarks?: string;\n startTime?: Date;\n endTime?: Date;\n color?: string;\n classId?: string;\n }\n) {\n return prisma.event.update({\n where: { id },\n data,\n });\n}\n\n/** Delete an event. */\nexport function deleteEventById(id: string) {\n return prisma.event.delete({\n where: { id },\n });\n}\n\n/** @returns Event with class and teachers. */\nexport function findEventWithClass(eventId: string) {\n return prisma.event.findUnique({\n where: { id: eventId },\n include: {\n class: {\n include: {\n teachers: { select: { id: true } },\n school: {\n include: {\n users: {\n select: { id: true },\n },\n memberships: {\n where: {\n role: \"ADMIN\" as const,\n status: \"ACTIVE\" as const,\n },\n select: { userId: true },\n },\n },\n },\n },\n },\n },\n });\n}\n\n/** @returns Assignment with class and teachers. */\nexport function findAssignmentWithClass(assignmentId: string) {\n return prisma.assignment.findUnique({\n where: { id: assignmentId },\n include: {\n class: {\n include: {\n teachers: { select: { id: true } },\n school: {\n include: {\n users: {\n select: { id: true },\n },\n memberships: {\n where: {\n role: \"ADMIN\" as const,\n status: \"ACTIVE\" as const,\n },\n select: { userId: true },\n },\n },\n },\n },\n },\n },\n });\n}\n\n/** Attach assignment to an event. */\nexport function attachAssignmentToEvent(\n assignmentId: string,\n eventId: string\n) {\n return prisma.assignment.update({\n where: { id: assignmentId },\n data: { eventAttached: { connect: { id: eventId } } },\n include: assignmentUpdateInclude,\n });\n}\n\n/** Detach assignment from its event. */\nexport function detachAssignmentFromEvent(assignmentId: string) {\n return prisma.assignment.update({\n where: { id: assignmentId },\n data: { eventAttached: { disconnect: true } },\n include: assignmentUpdateInclude,\n });\n}\n\n/** @returns Assignments not attached to any event. */\nexport function findAvailableAssignmentsForClass(classId: string) {\n return prisma.assignment.findMany({\n where: {\n classId,\n eventId: null,\n },\n select: {\n id: true,\n title: true,\n instructions: true,\n dueDate: true,\n type: true,\n graded: true,\n maxGrade: true,\n weight: true,\n section: { select: { id: true, name: true } },\n attachments: { select: { id: true, name: true, type: true } },\n teacher: { select: { id: true, username: true } },\n },\n orderBy: { createdAt: \"desc\" },\n });\n}\n"],"names":[],"mappings":"AAAA;;GAEG;;;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAE7D,MAAM,eAAe,GAAG;IACtB,KAAK,EAAE;QACL,OAAO,EAAE;YACP,QAAQ,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE;YAClC,MAAM,EAAE;gBACN,OAAO,EAAE;oBACP,KAAK,EAAE;wBACL,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE;qB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