@studious-lms/server 1.4.6 → 1.4.9
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.
- package/.github/workflows/npm.yml +28 -0
- package/dist/models/access.d.ts +112 -0
- package/dist/models/access.d.ts.map +1 -0
- package/dist/models/access.js +49 -0
- package/dist/models/access.js.map +1 -0
- package/dist/models/announcement.d.ts +17 -2
- package/dist/models/announcement.d.ts.map +1 -1
- package/dist/models/announcement.js +21 -4
- package/dist/models/announcement.js.map +1 -1
- package/dist/models/assignment.d.ts +69 -37
- package/dist/models/assignment.d.ts.map +1 -1
- package/dist/models/assignment.js +124 -15
- package/dist/models/assignment.js.map +1 -1
- package/dist/models/attendance.d.ts +1 -1
- package/dist/models/attendance.d.ts.map +1 -1
- package/dist/models/attendance.js +6 -5
- package/dist/models/attendance.js.map +1 -1
- package/dist/models/auth.d.ts +5 -5
- package/dist/models/auth.d.ts.map +1 -1
- package/dist/models/auth.js +7 -11
- package/dist/models/auth.js.map +1 -1
- package/dist/models/class.d.ts +26 -26
- package/dist/models/class.d.ts.map +1 -1
- package/dist/models/class.js +7 -11
- package/dist/models/class.js.map +1 -1
- package/dist/models/comment.d.ts +134 -70
- package/dist/models/comment.d.ts.map +1 -1
- package/dist/models/comment.js +30 -42
- package/dist/models/comment.js.map +1 -1
- package/dist/models/conversation.d.ts +7 -7
- package/dist/models/event.d.ts +52 -3
- package/dist/models/event.d.ts.map +1 -1
- package/dist/models/event.js +56 -6
- package/dist/models/event.js.map +1 -1
- package/dist/models/file.d.ts +178 -103
- package/dist/models/file.d.ts.map +1 -1
- package/dist/models/file.js +54 -14
- package/dist/models/file.js.map +1 -1
- package/dist/models/folder.d.ts +22 -22
- package/dist/models/folder.d.ts.map +1 -1
- package/dist/models/folder.js +5 -4
- package/dist/models/folder.js.map +1 -1
- package/dist/models/labChat.d.ts +20 -20
- package/dist/models/labChat.d.ts.map +1 -1
- package/dist/models/labChat.js +8 -10
- package/dist/models/labChat.js.map +1 -1
- package/dist/models/marketing.d.ts +1 -1
- package/dist/models/message.d.ts +6 -6
- package/dist/models/newtonChat.d.ts +5 -5
- package/dist/models/school.d.ts +361 -0
- package/dist/models/school.d.ts.map +1 -0
- package/dist/models/school.js +314 -0
- package/dist/models/school.js.map +1 -0
- package/dist/models/section.d.ts +1 -1
- package/dist/models/section.d.ts.map +1 -1
- package/dist/models/section.js +5 -4
- package/dist/models/section.js.map +1 -1
- package/dist/models/user.d.ts +4 -4
- package/dist/models/worksheet.d.ts +163 -141
- package/dist/models/worksheet.d.ts.map +1 -1
- package/dist/models/worksheet.js +42 -17
- package/dist/models/worksheet.js.map +1 -1
- package/dist/pipelines/gradeWorksheet.d.ts +2 -2
- package/dist/pipelines/pdfToWorksheet.d.ts +1 -1
- package/dist/routers/_app.d.ts +1271 -327
- package/dist/routers/_app.d.ts.map +1 -1
- package/dist/routers/_app.js +4 -2
- package/dist/routers/_app.js.map +1 -1
- package/dist/routers/announcement.d.ts +5 -5
- package/dist/routers/announcement.d.ts.map +1 -1
- package/dist/routers/announcement.js +25 -5
- package/dist/routers/announcement.js.map +1 -1
- package/dist/routers/assignment.d.ts +79 -44
- package/dist/routers/assignment.d.ts.map +1 -1
- package/dist/routers/assignment.js +32 -12
- package/dist/routers/assignment.js.map +1 -1
- package/dist/routers/class.d.ts +40 -20
- package/dist/routers/class.d.ts.map +1 -1
- package/dist/routers/class.js +3 -2
- package/dist/routers/class.js.map +1 -1
- package/dist/routers/comment.d.ts +5 -5
- package/dist/routers/conversation.d.ts +6 -6
- package/dist/routers/event.d.ts +21 -2
- package/dist/routers/event.d.ts.map +1 -1
- package/dist/routers/file.d.ts +2 -2
- package/dist/routers/folder.d.ts +24 -24
- package/dist/routers/labChat.d.ts +7 -7
- package/dist/routers/school.d.ts +384 -0
- package/dist/routers/school.d.ts.map +1 -0
- package/dist/routers/school.js +79 -0
- package/dist/routers/school.js.map +1 -0
- package/dist/routers/search.d.ts +1 -1
- package/dist/routers/worksheet.d.ts +36 -20
- package/dist/routers/worksheet.d.ts.map +1 -1
- package/dist/routers/worksheet.js +10 -3
- package/dist/routers/worksheet.js.map +1 -1
- package/dist/services/announcement.d.ts.map +1 -1
- package/dist/services/announcement.js +10 -6
- package/dist/services/announcement.js.map +1 -1
- package/dist/services/assignment.d.ts +66 -36
- package/dist/services/assignment.d.ts.map +1 -1
- package/dist/services/assignment.js +37 -3
- package/dist/services/assignment.js.map +1 -1
- package/dist/services/class.d.ts +39 -19
- package/dist/services/class.d.ts.map +1 -1
- package/dist/services/class.js +52 -15
- package/dist/services/class.js.map +1 -1
- package/dist/services/comment.d.ts +5 -5
- package/dist/services/comment.d.ts.map +1 -1
- package/dist/services/comment.js +8 -3
- package/dist/services/comment.js.map +1 -1
- package/dist/services/conversation.d.ts +6 -6
- package/dist/services/event.d.ts +21 -2
- package/dist/services/event.d.ts.map +1 -1
- package/dist/services/event.js +11 -7
- package/dist/services/event.js.map +1 -1
- package/dist/services/file.d.ts +2 -2
- package/dist/services/file.d.ts.map +1 -1
- package/dist/services/file.js +17 -8
- package/dist/services/file.js.map +1 -1
- package/dist/services/folder.d.ts +24 -24
- package/dist/services/labChat.d.ts +7 -7
- package/dist/services/school.d.ts +299 -0
- package/dist/services/school.d.ts.map +1 -0
- package/dist/services/school.js +225 -0
- package/dist/services/school.js.map +1 -0
- package/dist/services/worksheet.d.ts +31 -20
- package/dist/services/worksheet.d.ts.map +1 -1
- package/dist/services/worksheet.js +37 -3
- package/dist/services/worksheet.js.map +1 -1
- package/package.json +1 -1
- package/prisma/migrations/20260504071500_school_memberships/migration.sql +81 -0
- package/prisma/schema.prisma +66 -2
- package/src/models/access.ts +48 -0
- package/src/models/announcement.ts +19 -2
- package/src/models/assignment.ts +149 -13
- package/src/models/attendance.ts +4 -3
- package/src/models/auth.ts +8 -9
- package/src/models/class.ts +8 -9
- package/src/models/comment.ts +29 -40
- package/src/models/event.ts +54 -4
- package/src/models/file.ts +53 -12
- package/src/models/folder.ts +3 -2
- package/src/models/labChat.ts +9 -8
- package/src/models/school.ts +361 -0
- package/src/models/section.ts +3 -2
- package/src/models/worksheet.ts +61 -12
- package/src/routers/_app.ts +2 -0
- package/src/routers/announcement.ts +30 -4
- package/src/routers/assignment.ts +46 -9
- package/src/routers/class.ts +1 -0
- package/src/routers/school.ts +122 -0
- package/src/routers/worksheet.ts +18 -0
- package/src/services/announcement.ts +12 -4
- package/src/services/assignment.ts +47 -1
- package/src/services/class.ts +61 -14
- package/src/services/comment.ts +10 -1
- package/src/services/event.ts +23 -6
- package/src/services/file.ts +20 -6
- package/src/services/school.ts +308 -0
- package/src/services/worksheet.ts +46 -0
- package/dist/lib/notificationHandler.d.ts +0 -25
- package/dist/lib/notificationHandler.d.ts.map +0 -1
- package/dist/lib/notificationHandler.js +0 -32
- package/dist/lib/notificationHandler.js.map +0 -1
- package/dist/server/pipelines/aiLabChat.d.ts +0 -21
- package/dist/server/pipelines/aiLabChat.d.ts.map +0 -1
- package/dist/server/pipelines/aiLabChat.js +0 -456
- package/dist/server/pipelines/aiLabChat.js.map +0 -1
- package/dist/server/pipelines/aiNewtonChat.d.ts +0 -30
- package/dist/server/pipelines/aiNewtonChat.d.ts.map +0 -1
- package/dist/server/pipelines/aiNewtonChat.js +0 -285
- package/dist/server/pipelines/aiNewtonChat.js.map +0 -1
- package/dist/server/pipelines/gradeWorksheet.d.ts +0 -30
- package/dist/server/pipelines/gradeWorksheet.d.ts.map +0 -1
- package/dist/server/pipelines/gradeWorksheet.js +0 -248
- package/dist/server/pipelines/gradeWorksheet.js.map +0 -1
package/dist/models/event.d.ts
CHANGED
|
@@ -9,7 +9,26 @@ export declare function findEventById(id: string): import(".prisma/client").Pris
|
|
|
9
9
|
role: import(".prisma/client").$Enums.UserRole;
|
|
10
10
|
schoolId: string | null;
|
|
11
11
|
} | null;
|
|
12
|
-
class: {
|
|
12
|
+
class: ({
|
|
13
|
+
school: ({
|
|
14
|
+
users: {
|
|
15
|
+
id: string;
|
|
16
|
+
}[];
|
|
17
|
+
memberships: {
|
|
18
|
+
userId: string;
|
|
19
|
+
}[];
|
|
20
|
+
} & {
|
|
21
|
+
name: string;
|
|
22
|
+
id: string;
|
|
23
|
+
logoId: string | null;
|
|
24
|
+
subdomain: string | null;
|
|
25
|
+
createdAt: Date;
|
|
26
|
+
updatedAt: Date;
|
|
27
|
+
}) | null;
|
|
28
|
+
teachers: {
|
|
29
|
+
id: string;
|
|
30
|
+
}[];
|
|
31
|
+
} & {
|
|
13
32
|
name: string;
|
|
14
33
|
id: string;
|
|
15
34
|
schoolId: string | null;
|
|
@@ -17,7 +36,7 @@ export declare function findEventById(id: string): import(".prisma/client").Pris
|
|
|
17
36
|
color: string | null;
|
|
18
37
|
section: string;
|
|
19
38
|
syllabus: string | null;
|
|
20
|
-
} | null;
|
|
39
|
+
}) | null;
|
|
21
40
|
assignmentsAttached: {
|
|
22
41
|
type: import(".prisma/client").$Enums.AssignmentType;
|
|
23
42
|
id: string;
|
|
@@ -58,7 +77,7 @@ export declare function findEventById(id: string): import(".prisma/client").Pris
|
|
|
58
77
|
};
|
|
59
78
|
};
|
|
60
79
|
}>;
|
|
61
|
-
/** @returns Class if user is a teacher. */
|
|
80
|
+
/** @returns Class if user is a teacher or school admin. */
|
|
62
81
|
export declare function findClassWithTeachers(classId: string, teacherId: string): import(".prisma/client").Prisma.Prisma__ClassClient<{
|
|
63
82
|
name: string;
|
|
64
83
|
id: string;
|
|
@@ -152,6 +171,21 @@ export declare function deleteEventById(id: string): import(".prisma/client").Pr
|
|
|
152
171
|
/** @returns Event with class and teachers. */
|
|
153
172
|
export declare function findEventWithClass(eventId: string): import(".prisma/client").Prisma.Prisma__EventClient<({
|
|
154
173
|
class: ({
|
|
174
|
+
school: ({
|
|
175
|
+
users: {
|
|
176
|
+
id: string;
|
|
177
|
+
}[];
|
|
178
|
+
memberships: {
|
|
179
|
+
userId: string;
|
|
180
|
+
}[];
|
|
181
|
+
} & {
|
|
182
|
+
name: string;
|
|
183
|
+
id: string;
|
|
184
|
+
logoId: string | null;
|
|
185
|
+
subdomain: string | null;
|
|
186
|
+
createdAt: Date;
|
|
187
|
+
updatedAt: Date;
|
|
188
|
+
}) | null;
|
|
155
189
|
teachers: {
|
|
156
190
|
id: string;
|
|
157
191
|
}[];
|
|
@@ -184,6 +218,21 @@ export declare function findEventWithClass(eventId: string): import(".prisma/cli
|
|
|
184
218
|
/** @returns Assignment with class and teachers. */
|
|
185
219
|
export declare function findAssignmentWithClass(assignmentId: string): import(".prisma/client").Prisma.Prisma__AssignmentClient<({
|
|
186
220
|
class: {
|
|
221
|
+
school: ({
|
|
222
|
+
users: {
|
|
223
|
+
id: string;
|
|
224
|
+
}[];
|
|
225
|
+
memberships: {
|
|
226
|
+
userId: string;
|
|
227
|
+
}[];
|
|
228
|
+
} & {
|
|
229
|
+
name: string;
|
|
230
|
+
id: string;
|
|
231
|
+
logoId: string | null;
|
|
232
|
+
subdomain: string | null;
|
|
233
|
+
createdAt: Date;
|
|
234
|
+
updatedAt: Date;
|
|
235
|
+
}) | null;
|
|
187
236
|
teachers: {
|
|
188
237
|
id: string;
|
|
189
238
|
}[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.d.ts","sourceRoot":"/","sources":["models/event.ts"],"names":[],"mappings":"
|
|
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,QA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AsD;AACtD,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;KAqB/D"}
|
package/dist/models/event.js
CHANGED
|
@@ -2,10 +2,30 @@
|
|
|
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]="
|
|
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){}}();
|
|
6
6
|
import { prisma } from "../lib/prisma.js";
|
|
7
|
+
import { classTeacherOrSchoolAdminWhere } from "./access.js";
|
|
7
8
|
const eventGetInclude = {
|
|
8
|
-
class:
|
|
9
|
+
class: {
|
|
10
|
+
include: {
|
|
11
|
+
teachers: { select: { id: true } },
|
|
12
|
+
school: {
|
|
13
|
+
include: {
|
|
14
|
+
users: {
|
|
15
|
+
where: { role: "ADMIN" },
|
|
16
|
+
select: { id: true },
|
|
17
|
+
},
|
|
18
|
+
memberships: {
|
|
19
|
+
where: {
|
|
20
|
+
role: "ADMIN",
|
|
21
|
+
status: "ACTIVE",
|
|
22
|
+
},
|
|
23
|
+
select: { userId: true },
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
9
29
|
user: true,
|
|
10
30
|
assignmentsAttached: {
|
|
11
31
|
select: {
|
|
@@ -47,12 +67,12 @@ export function findEventById(id) {
|
|
|
47
67
|
include: eventGetInclude,
|
|
48
68
|
});
|
|
49
69
|
}
|
|
50
|
-
/** @returns Class if user is a teacher. */
|
|
70
|
+
/** @returns Class if user is a teacher or school admin. */
|
|
51
71
|
export function findClassWithTeachers(classId, teacherId) {
|
|
52
|
-
return prisma.class.
|
|
72
|
+
return prisma.class.findFirst({
|
|
53
73
|
where: {
|
|
54
74
|
id: classId,
|
|
55
|
-
|
|
75
|
+
...classTeacherOrSchoolAdminWhere(teacherId),
|
|
56
76
|
},
|
|
57
77
|
});
|
|
58
78
|
}
|
|
@@ -84,6 +104,21 @@ export function findEventWithClass(eventId) {
|
|
|
84
104
|
class: {
|
|
85
105
|
include: {
|
|
86
106
|
teachers: { select: { id: true } },
|
|
107
|
+
school: {
|
|
108
|
+
include: {
|
|
109
|
+
users: {
|
|
110
|
+
where: { role: "ADMIN" },
|
|
111
|
+
select: { id: true },
|
|
112
|
+
},
|
|
113
|
+
memberships: {
|
|
114
|
+
where: {
|
|
115
|
+
role: "ADMIN",
|
|
116
|
+
status: "ACTIVE",
|
|
117
|
+
},
|
|
118
|
+
select: { userId: true },
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
87
122
|
},
|
|
88
123
|
},
|
|
89
124
|
},
|
|
@@ -97,6 +132,21 @@ export function findAssignmentWithClass(assignmentId) {
|
|
|
97
132
|
class: {
|
|
98
133
|
include: {
|
|
99
134
|
teachers: { select: { id: true } },
|
|
135
|
+
school: {
|
|
136
|
+
include: {
|
|
137
|
+
users: {
|
|
138
|
+
where: { role: "ADMIN" },
|
|
139
|
+
select: { id: true },
|
|
140
|
+
},
|
|
141
|
+
memberships: {
|
|
142
|
+
where: {
|
|
143
|
+
role: "ADMIN",
|
|
144
|
+
status: "ACTIVE",
|
|
145
|
+
},
|
|
146
|
+
select: { userId: true },
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
},
|
|
100
150
|
},
|
|
101
151
|
},
|
|
102
152
|
},
|
|
@@ -142,4 +192,4 @@ export function findAvailableAssignmentsForClass(classId) {
|
|
|
142
192
|
});
|
|
143
193
|
}
|
|
144
194
|
//# sourceMappingURL=event.js.map
|
|
145
|
-
//# debugId=
|
|
195
|
+
//# debugId=cf3ed911-c40a-5919-97ae-6a9c13344647
|
package/dist/models/event.js.map
CHANGED
|
@@ -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\";\n\nconst eventGetInclude = {\n class: true,\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. */\nexport function findClassWithTeachers(classId: string, teacherId: string) {\n return prisma.class.findUnique({\n where: {\n id: classId,\n teachers: { some: { id: 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 },\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 },\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;AAE1C,MAAM,eAAe,GAAG;IACtB,KAAK,EAAE,IAAI;IACX,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,I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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":"77f54214-a354-5d29-87fa-c904eb74a338"}
|
|
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,IAA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C;QAC9B,KAAK,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE;QAC3B,IAAI,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"}
|
package/dist/models/file.d.ts
CHANGED
|
@@ -1,8 +1,93 @@
|
|
|
1
1
|
/** @returns File with assignment, submission, annotations, folder, announcement for permission checks. */
|
|
2
2
|
export declare function findFileById(fileId: string): import(".prisma/client").Prisma.Prisma__FileClient<({
|
|
3
|
+
assignment: ({
|
|
4
|
+
class: {
|
|
5
|
+
school: ({
|
|
6
|
+
users: {
|
|
7
|
+
id: string;
|
|
8
|
+
}[];
|
|
9
|
+
memberships: {
|
|
10
|
+
userId: string;
|
|
11
|
+
}[];
|
|
12
|
+
} & {
|
|
13
|
+
name: string;
|
|
14
|
+
id: string;
|
|
15
|
+
logoId: string | null;
|
|
16
|
+
subdomain: string | null;
|
|
17
|
+
createdAt: Date;
|
|
18
|
+
updatedAt: Date;
|
|
19
|
+
}) | null;
|
|
20
|
+
teachers: {
|
|
21
|
+
id: string;
|
|
22
|
+
username: string;
|
|
23
|
+
email: string;
|
|
24
|
+
password: string;
|
|
25
|
+
verified: boolean;
|
|
26
|
+
role: import(".prisma/client").$Enums.UserRole;
|
|
27
|
+
schoolId: string | null;
|
|
28
|
+
}[];
|
|
29
|
+
students: {
|
|
30
|
+
id: string;
|
|
31
|
+
username: string;
|
|
32
|
+
email: string;
|
|
33
|
+
password: string;
|
|
34
|
+
verified: boolean;
|
|
35
|
+
role: import(".prisma/client").$Enums.UserRole;
|
|
36
|
+
schoolId: string | null;
|
|
37
|
+
}[];
|
|
38
|
+
} & {
|
|
39
|
+
name: string;
|
|
40
|
+
id: string;
|
|
41
|
+
schoolId: string | null;
|
|
42
|
+
subject: string;
|
|
43
|
+
color: string | null;
|
|
44
|
+
section: string;
|
|
45
|
+
syllabus: string | null;
|
|
46
|
+
};
|
|
47
|
+
} & {
|
|
48
|
+
type: import(".prisma/client").$Enums.AssignmentType;
|
|
49
|
+
id: string;
|
|
50
|
+
createdAt: Date | null;
|
|
51
|
+
modifiedAt: Date | null;
|
|
52
|
+
classId: string;
|
|
53
|
+
title: string;
|
|
54
|
+
instructions: string;
|
|
55
|
+
dueDate: Date;
|
|
56
|
+
teacherId: string;
|
|
57
|
+
acceptFiles: boolean;
|
|
58
|
+
acceptExtendedResponse: boolean;
|
|
59
|
+
acceptWorksheet: boolean;
|
|
60
|
+
gradeWithAI: boolean;
|
|
61
|
+
aiPolicyLevel: number;
|
|
62
|
+
sectionId: string | null;
|
|
63
|
+
graded: boolean;
|
|
64
|
+
maxGrade: number | null;
|
|
65
|
+
weight: number;
|
|
66
|
+
inProgress: boolean;
|
|
67
|
+
template: boolean;
|
|
68
|
+
eventId: string | null;
|
|
69
|
+
markSchemeId: string | null;
|
|
70
|
+
order: number | null;
|
|
71
|
+
gradingBoundaryId: string | null;
|
|
72
|
+
}) | null;
|
|
3
73
|
submission: ({
|
|
4
74
|
assignment: {
|
|
5
75
|
class: {
|
|
76
|
+
school: ({
|
|
77
|
+
users: {
|
|
78
|
+
id: string;
|
|
79
|
+
}[];
|
|
80
|
+
memberships: {
|
|
81
|
+
userId: string;
|
|
82
|
+
}[];
|
|
83
|
+
} & {
|
|
84
|
+
name: string;
|
|
85
|
+
id: string;
|
|
86
|
+
logoId: string | null;
|
|
87
|
+
subdomain: string | null;
|
|
88
|
+
createdAt: Date;
|
|
89
|
+
updatedAt: Date;
|
|
90
|
+
}) | null;
|
|
6
91
|
teachers: {
|
|
7
92
|
id: string;
|
|
8
93
|
username: string;
|
|
@@ -58,8 +143,8 @@ export declare function findFileById(fileId: string): import(".prisma/client").P
|
|
|
58
143
|
};
|
|
59
144
|
} & {
|
|
60
145
|
id: string;
|
|
61
|
-
assignmentId: string;
|
|
62
146
|
createdAt: Date;
|
|
147
|
+
assignmentId: string;
|
|
63
148
|
modifiedAt: Date;
|
|
64
149
|
studentId: string;
|
|
65
150
|
extendedResponse: string | null;
|
|
@@ -73,101 +158,24 @@ export declare function findFileById(fileId: string): import(".prisma/client").P
|
|
|
73
158
|
submitted: boolean | null;
|
|
74
159
|
returned: boolean | null;
|
|
75
160
|
}) | null;
|
|
76
|
-
assignment: ({
|
|
77
|
-
class: {
|
|
78
|
-
students: {
|
|
79
|
-
id: string;
|
|
80
|
-
username: string;
|
|
81
|
-
email: string;
|
|
82
|
-
password: string;
|
|
83
|
-
verified: boolean;
|
|
84
|
-
role: import(".prisma/client").$Enums.UserRole;
|
|
85
|
-
schoolId: string | null;
|
|
86
|
-
}[];
|
|
87
|
-
teachers: {
|
|
88
|
-
id: string;
|
|
89
|
-
username: string;
|
|
90
|
-
email: string;
|
|
91
|
-
password: string;
|
|
92
|
-
verified: boolean;
|
|
93
|
-
role: import(".prisma/client").$Enums.UserRole;
|
|
94
|
-
schoolId: string | null;
|
|
95
|
-
}[];
|
|
96
|
-
} & {
|
|
97
|
-
name: string;
|
|
98
|
-
id: string;
|
|
99
|
-
schoolId: string | null;
|
|
100
|
-
subject: string;
|
|
101
|
-
color: string | null;
|
|
102
|
-
section: string;
|
|
103
|
-
syllabus: string | null;
|
|
104
|
-
};
|
|
105
|
-
} & {
|
|
106
|
-
type: import(".prisma/client").$Enums.AssignmentType;
|
|
107
|
-
id: string;
|
|
108
|
-
createdAt: Date | null;
|
|
109
|
-
modifiedAt: Date | null;
|
|
110
|
-
classId: string;
|
|
111
|
-
title: string;
|
|
112
|
-
instructions: string;
|
|
113
|
-
dueDate: Date;
|
|
114
|
-
teacherId: string;
|
|
115
|
-
acceptFiles: boolean;
|
|
116
|
-
acceptExtendedResponse: boolean;
|
|
117
|
-
acceptWorksheet: boolean;
|
|
118
|
-
gradeWithAI: boolean;
|
|
119
|
-
aiPolicyLevel: number;
|
|
120
|
-
sectionId: string | null;
|
|
121
|
-
graded: boolean;
|
|
122
|
-
maxGrade: number | null;
|
|
123
|
-
weight: number;
|
|
124
|
-
inProgress: boolean;
|
|
125
|
-
template: boolean;
|
|
126
|
-
eventId: string | null;
|
|
127
|
-
markSchemeId: string | null;
|
|
128
|
-
order: number | null;
|
|
129
|
-
gradingBoundaryId: string | null;
|
|
130
|
-
}) | null;
|
|
131
|
-
announcement: ({
|
|
132
|
-
class: {
|
|
133
|
-
students: {
|
|
134
|
-
id: string;
|
|
135
|
-
username: string;
|
|
136
|
-
email: string;
|
|
137
|
-
password: string;
|
|
138
|
-
verified: boolean;
|
|
139
|
-
role: import(".prisma/client").$Enums.UserRole;
|
|
140
|
-
schoolId: string | null;
|
|
141
|
-
}[];
|
|
142
|
-
teachers: {
|
|
143
|
-
id: string;
|
|
144
|
-
username: string;
|
|
145
|
-
email: string;
|
|
146
|
-
password: string;
|
|
147
|
-
verified: boolean;
|
|
148
|
-
role: import(".prisma/client").$Enums.UserRole;
|
|
149
|
-
schoolId: string | null;
|
|
150
|
-
}[];
|
|
151
|
-
} & {
|
|
152
|
-
name: string;
|
|
153
|
-
id: string;
|
|
154
|
-
schoolId: string | null;
|
|
155
|
-
subject: string;
|
|
156
|
-
color: string | null;
|
|
157
|
-
section: string;
|
|
158
|
-
syllabus: string | null;
|
|
159
|
-
};
|
|
160
|
-
} & {
|
|
161
|
-
id: string;
|
|
162
|
-
createdAt: Date;
|
|
163
|
-
modifiedAt: Date | null;
|
|
164
|
-
classId: string;
|
|
165
|
-
teacherId: string;
|
|
166
|
-
remarks: string;
|
|
167
|
-
}) | null;
|
|
168
161
|
annotations: ({
|
|
169
162
|
assignment: {
|
|
170
163
|
class: {
|
|
164
|
+
school: ({
|
|
165
|
+
users: {
|
|
166
|
+
id: string;
|
|
167
|
+
}[];
|
|
168
|
+
memberships: {
|
|
169
|
+
userId: string;
|
|
170
|
+
}[];
|
|
171
|
+
} & {
|
|
172
|
+
name: string;
|
|
173
|
+
id: string;
|
|
174
|
+
logoId: string | null;
|
|
175
|
+
subdomain: string | null;
|
|
176
|
+
createdAt: Date;
|
|
177
|
+
updatedAt: Date;
|
|
178
|
+
}) | null;
|
|
171
179
|
teachers: {
|
|
172
180
|
id: string;
|
|
173
181
|
username: string;
|
|
@@ -223,8 +231,8 @@ export declare function findFileById(fileId: string): import(".prisma/client").P
|
|
|
223
231
|
};
|
|
224
232
|
} & {
|
|
225
233
|
id: string;
|
|
226
|
-
assignmentId: string;
|
|
227
234
|
createdAt: Date;
|
|
235
|
+
assignmentId: string;
|
|
228
236
|
modifiedAt: Date;
|
|
229
237
|
studentId: string;
|
|
230
238
|
extendedResponse: string | null;
|
|
@@ -240,7 +248,22 @@ export declare function findFileById(fileId: string): import(".prisma/client").P
|
|
|
240
248
|
}) | null;
|
|
241
249
|
folder: ({
|
|
242
250
|
class: ({
|
|
243
|
-
|
|
251
|
+
school: ({
|
|
252
|
+
users: {
|
|
253
|
+
id: string;
|
|
254
|
+
}[];
|
|
255
|
+
memberships: {
|
|
256
|
+
userId: string;
|
|
257
|
+
}[];
|
|
258
|
+
} & {
|
|
259
|
+
name: string;
|
|
260
|
+
id: string;
|
|
261
|
+
logoId: string | null;
|
|
262
|
+
subdomain: string | null;
|
|
263
|
+
createdAt: Date;
|
|
264
|
+
updatedAt: Date;
|
|
265
|
+
}) | null;
|
|
266
|
+
teachers: {
|
|
244
267
|
id: string;
|
|
245
268
|
username: string;
|
|
246
269
|
email: string;
|
|
@@ -249,7 +272,7 @@ export declare function findFileById(fileId: string): import(".prisma/client").P
|
|
|
249
272
|
role: import(".prisma/client").$Enums.UserRole;
|
|
250
273
|
schoolId: string | null;
|
|
251
274
|
}[];
|
|
252
|
-
|
|
275
|
+
students: {
|
|
253
276
|
id: string;
|
|
254
277
|
username: string;
|
|
255
278
|
email: string;
|
|
@@ -274,13 +297,65 @@ export declare function findFileById(fileId: string): import(".prisma/client").P
|
|
|
274
297
|
classId: string | null;
|
|
275
298
|
parentFolderId: string | null;
|
|
276
299
|
}) | null;
|
|
300
|
+
announcement: ({
|
|
301
|
+
class: {
|
|
302
|
+
school: ({
|
|
303
|
+
users: {
|
|
304
|
+
id: string;
|
|
305
|
+
}[];
|
|
306
|
+
memberships: {
|
|
307
|
+
userId: string;
|
|
308
|
+
}[];
|
|
309
|
+
} & {
|
|
310
|
+
name: string;
|
|
311
|
+
id: string;
|
|
312
|
+
logoId: string | null;
|
|
313
|
+
subdomain: string | null;
|
|
314
|
+
createdAt: Date;
|
|
315
|
+
updatedAt: Date;
|
|
316
|
+
}) | null;
|
|
317
|
+
teachers: {
|
|
318
|
+
id: string;
|
|
319
|
+
username: string;
|
|
320
|
+
email: string;
|
|
321
|
+
password: string;
|
|
322
|
+
verified: boolean;
|
|
323
|
+
role: import(".prisma/client").$Enums.UserRole;
|
|
324
|
+
schoolId: string | null;
|
|
325
|
+
}[];
|
|
326
|
+
students: {
|
|
327
|
+
id: string;
|
|
328
|
+
username: string;
|
|
329
|
+
email: string;
|
|
330
|
+
password: string;
|
|
331
|
+
verified: boolean;
|
|
332
|
+
role: import(".prisma/client").$Enums.UserRole;
|
|
333
|
+
schoolId: string | null;
|
|
334
|
+
}[];
|
|
335
|
+
} & {
|
|
336
|
+
name: string;
|
|
337
|
+
id: string;
|
|
338
|
+
schoolId: string | null;
|
|
339
|
+
subject: string;
|
|
340
|
+
color: string | null;
|
|
341
|
+
section: string;
|
|
342
|
+
syllabus: string | null;
|
|
343
|
+
};
|
|
344
|
+
} & {
|
|
345
|
+
id: string;
|
|
346
|
+
createdAt: Date;
|
|
347
|
+
modifiedAt: Date | null;
|
|
348
|
+
classId: string;
|
|
349
|
+
teacherId: string;
|
|
350
|
+
remarks: string;
|
|
351
|
+
}) | null;
|
|
277
352
|
} & {
|
|
278
353
|
path: string;
|
|
279
354
|
type: string;
|
|
280
355
|
name: string;
|
|
281
356
|
id: string;
|
|
282
|
-
size: number | null;
|
|
283
357
|
userId: string | null;
|
|
358
|
+
size: number | null;
|
|
284
359
|
uploadedAt: Date | null;
|
|
285
360
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
286
361
|
uploadUrl: string | null;
|
|
@@ -332,8 +407,8 @@ export declare function findFileWithFolder(fileId: string): import(".prisma/clie
|
|
|
332
407
|
type: string;
|
|
333
408
|
name: string;
|
|
334
409
|
id: string;
|
|
335
|
-
size: number | null;
|
|
336
410
|
userId: string | null;
|
|
411
|
+
size: number | null;
|
|
337
412
|
uploadedAt: Date | null;
|
|
338
413
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
339
414
|
uploadUrl: string | null;
|
|
@@ -368,8 +443,8 @@ export declare function findFileWithFolderAndThumbnail(fileId: string): import("
|
|
|
368
443
|
type: string;
|
|
369
444
|
name: string;
|
|
370
445
|
id: string;
|
|
371
|
-
size: number | null;
|
|
372
446
|
userId: string | null;
|
|
447
|
+
size: number | null;
|
|
373
448
|
uploadedAt: Date | null;
|
|
374
449
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
375
450
|
uploadUrl: string | null;
|
|
@@ -413,8 +488,8 @@ export declare function findFileWithFolderAndThumbnail(fileId: string): import("
|
|
|
413
488
|
type: string;
|
|
414
489
|
name: string;
|
|
415
490
|
id: string;
|
|
416
|
-
size: number | null;
|
|
417
491
|
userId: string | null;
|
|
492
|
+
size: number | null;
|
|
418
493
|
uploadedAt: Date | null;
|
|
419
494
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
420
495
|
uploadUrl: string | null;
|
|
@@ -477,8 +552,8 @@ export declare function updateFileFolder(fileId: string, folderId: string): impo
|
|
|
477
552
|
type: string;
|
|
478
553
|
name: string;
|
|
479
554
|
id: string;
|
|
480
|
-
size: number | null;
|
|
481
555
|
userId: string | null;
|
|
556
|
+
size: number | null;
|
|
482
557
|
uploadedAt: Date | null;
|
|
483
558
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
484
559
|
uploadUrl: string | null;
|
|
@@ -517,8 +592,8 @@ export declare function updateFileName(fileId: string, name: string): import(".p
|
|
|
517
592
|
type: string;
|
|
518
593
|
name: string;
|
|
519
594
|
id: string;
|
|
520
|
-
size: number | null;
|
|
521
595
|
userId: string | null;
|
|
596
|
+
size: number | null;
|
|
522
597
|
uploadedAt: Date | null;
|
|
523
598
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
524
599
|
uploadUrl: string | null;
|
|
@@ -552,8 +627,8 @@ export declare function deleteFileById(fileId: string): import(".prisma/client")
|
|
|
552
627
|
type: string;
|
|
553
628
|
name: string;
|
|
554
629
|
id: string;
|
|
555
|
-
size: number | null;
|
|
556
630
|
userId: string | null;
|
|
631
|
+
size: number | null;
|
|
557
632
|
uploadedAt: Date | null;
|
|
558
633
|
uploadStatus: import(".prisma/client").$Enums.UploadStatus;
|
|
559
634
|
uploadUrl: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"/","sources":["models/file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"/","sources":["models/file.ts"],"names":[],"mappings":"AAyBA,0GAA0G;AAC1G,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqF1C;AAED,2CAA2C;AAC3C,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAOhD;AAED,+CAA+C;AAC/C,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAQ5D;AAED,wCAAwC;AACxC,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;GAK9C;AAED,6BAA6B;AAC7B,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAQhE;A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