@studious-lms/server 1.1.26 → 1.2.26

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.
@@ -253,6 +253,7 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
253
253
  folderId: string | null;
254
254
  conversationId: string | null;
255
255
  messageId: string | null;
256
+ announcementId: string | null;
256
257
  schoolDevelopementProgramId: string | null;
257
258
  } | null;
258
259
  thumbnailId: string | null;
@@ -420,6 +421,7 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
420
421
  folderId: string | null;
421
422
  conversationId: string | null;
422
423
  messageId: string | null;
424
+ announcementId: string | null;
423
425
  schoolDevelopementProgramId: string | null;
424
426
  }[];
425
427
  annotations: {
@@ -447,6 +449,7 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
447
449
  folderId: string | null;
448
450
  conversationId: string | null;
449
451
  messageId: string | null;
452
+ announcementId: string | null;
450
453
  schoolDevelopementProgramId: string | null;
451
454
  }[];
452
455
  } & {
@@ -543,6 +546,7 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
543
546
  folderId: string | null;
544
547
  conversationId: string | null;
545
548
  messageId: string | null;
549
+ announcementId: string | null;
546
550
  schoolDevelopementProgramId: string | null;
547
551
  }[];
548
552
  annotations: {
@@ -570,6 +574,7 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
570
574
  folderId: string | null;
571
575
  conversationId: string | null;
572
576
  messageId: string | null;
577
+ announcementId: string | null;
573
578
  schoolDevelopementProgramId: string | null;
574
579
  }[];
575
580
  id: string;
@@ -674,6 +679,7 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
674
679
  folderId: string | null;
675
680
  conversationId: string | null;
676
681
  messageId: string | null;
682
+ announcementId: string | null;
677
683
  schoolDevelopementProgramId: string | null;
678
684
  }[];
679
685
  annotations: {
@@ -701,6 +707,7 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
701
707
  folderId: string | null;
702
708
  conversationId: string | null;
703
709
  messageId: string | null;
710
+ announcementId: string | null;
704
711
  schoolDevelopementProgramId: string | null;
705
712
  }[];
706
713
  id: string;
@@ -801,6 +808,7 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
801
808
  folderId: string | null;
802
809
  conversationId: string | null;
803
810
  messageId: string | null;
811
+ announcementId: string | null;
804
812
  schoolDevelopementProgramId: string | null;
805
813
  }[];
806
814
  } & {
@@ -900,6 +908,7 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
900
908
  folderId: string | null;
901
909
  conversationId: string | null;
902
910
  messageId: string | null;
911
+ announcementId: string | null;
903
912
  schoolDevelopementProgramId: string | null;
904
913
  } | null;
905
914
  } & {
@@ -927,6 +936,7 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
927
936
  folderId: string | null;
928
937
  conversationId: string | null;
929
938
  messageId: string | null;
939
+ announcementId: string | null;
930
940
  schoolDevelopementProgramId: string | null;
931
941
  })[];
932
942
  id: string;
@@ -960,10 +970,10 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
960
970
  }[] | undefined;
961
971
  return?: boolean | undefined;
962
972
  rubricGrades?: {
973
+ comments: string;
963
974
  criteriaId: string;
964
975
  selectedLevelId: string;
965
976
  points: number;
966
- comments: string;
967
977
  }[] | undefined;
968
978
  };
969
979
  output: {
@@ -1040,6 +1050,7 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
1040
1050
  folderId: string | null;
1041
1051
  conversationId: string | null;
1042
1052
  messageId: string | null;
1053
+ announcementId: string | null;
1043
1054
  schoolDevelopementProgramId: string | null;
1044
1055
  }[];
1045
1056
  } & {
@@ -1244,6 +1255,7 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
1244
1255
  folderId: string | null;
1245
1256
  conversationId: string | null;
1246
1257
  messageId: string | null;
1258
+ announcementId: string | null;
1247
1259
  schoolDevelopementProgramId: string | null;
1248
1260
  }[];
1249
1261
  eventAttached: {
@@ -1334,6 +1346,7 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
1334
1346
  folderId: string | null;
1335
1347
  conversationId: string | null;
1336
1348
  messageId: string | null;
1349
+ announcementId: string | null;
1337
1350
  schoolDevelopementProgramId: string | null;
1338
1351
  }[];
1339
1352
  eventAttached: {
@@ -1425,6 +1438,7 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
1425
1438
  folderId: string | null;
1426
1439
  conversationId: string | null;
1427
1440
  messageId: string | null;
1441
+ announcementId: string | null;
1428
1442
  schoolDevelopementProgramId: string | null;
1429
1443
  }[];
1430
1444
  eventAttached: {
@@ -1515,6 +1529,7 @@ export declare const assignmentRouter: import("@trpc/server").TRPCBuiltRouter<{
1515
1529
  folderId: string | null;
1516
1530
  conversationId: string | null;
1517
1531
  messageId: string | null;
1532
+ announcementId: string | null;
1518
1533
  schoolDevelopementProgramId: string | null;
1519
1534
  }[];
1520
1535
  eventAttached: {
@@ -1 +1 @@
1
- {"version":3,"file":"assignment.d.ts","sourceRoot":"","sources":["../../src/routers/assignment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAA2B,KAAK,gBAAgB,EAAgE,MAAM,sBAAsB,CAAC;AAqKpJ,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0nE3B,CAAC"}
@@ -62,6 +62,7 @@ export declare const fileRouter: import("@trpc/server").TRPCBuiltRouter<{
62
62
  folderId: string | null;
63
63
  conversationId: string | null;
64
64
  messageId: string | null;
65
+ announcementId: string | null;
65
66
  schoolDevelopementProgramId: string | null;
66
67
  };
67
68
  meta: object;
@@ -103,6 +104,7 @@ export declare const fileRouter: import("@trpc/server").TRPCBuiltRouter<{
103
104
  folderId: string | null;
104
105
  conversationId: string | null;
105
106
  messageId: string | null;
107
+ announcementId: string | null;
106
108
  schoolDevelopementProgramId: string | null;
107
109
  };
108
110
  meta: object;
@@ -1 +1 @@
1
- {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/routers/file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyVrB,CAAC"}
1
+ {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/routers/file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyVrB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studious-lms/server",
3
- "version": "1.1.26",
3
+ "version": "1.2.26",
4
4
  "description": "Backend server for Studious application",
5
5
  "main": "dist/exportType.js",
6
6
  "types": "dist/exportType.d.ts",
@@ -0,0 +1,30 @@
1
+ -- AlterTable
2
+ ALTER TABLE "public"."Announcement" ADD COLUMN "modifiedAt" TIMESTAMP(3);
3
+
4
+ -- AlterTable
5
+ ALTER TABLE "public"."File" ADD COLUMN "announcementId" TEXT;
6
+
7
+ -- CreateTable
8
+ CREATE TABLE "public"."AnnouncementComment" (
9
+ "id" TEXT NOT NULL,
10
+ "content" TEXT NOT NULL,
11
+ "authorId" TEXT NOT NULL,
12
+ "announcementId" TEXT NOT NULL,
13
+ "parentCommentId" TEXT,
14
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
15
+ "modifiedAt" TIMESTAMP(3),
16
+
17
+ CONSTRAINT "AnnouncementComment_pkey" PRIMARY KEY ("id")
18
+ );
19
+
20
+ -- AddForeignKey
21
+ ALTER TABLE "public"."File" ADD CONSTRAINT "File_announcementId_fkey" FOREIGN KEY ("announcementId") REFERENCES "public"."Announcement"("id") ON DELETE CASCADE ON UPDATE CASCADE;
22
+
23
+ -- AddForeignKey
24
+ ALTER TABLE "public"."AnnouncementComment" ADD CONSTRAINT "AnnouncementComment_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "public"."User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
25
+
26
+ -- AddForeignKey
27
+ ALTER TABLE "public"."AnnouncementComment" ADD CONSTRAINT "AnnouncementComment_announcementId_fkey" FOREIGN KEY ("announcementId") REFERENCES "public"."Announcement"("id") ON DELETE CASCADE ON UPDATE CASCADE;
28
+
29
+ -- AddForeignKey
30
+ ALTER TABLE "public"."AnnouncementComment" ADD CONSTRAINT "AnnouncementComment_parentCommentId_fkey" FOREIGN KEY ("parentCommentId") REFERENCES "public"."AnnouncementComment"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -0,0 +1,35 @@
1
+ -- CreateEnum
2
+ CREATE TYPE "public"."ReactionType" AS ENUM ('THUMBSUP', 'CELEBRATE', 'CARE', 'HEART', 'IDEA', 'HAPPY');
3
+
4
+ -- CreateTable
5
+ CREATE TABLE "public"."Reaction" (
6
+ "id" TEXT NOT NULL,
7
+ "type" "public"."ReactionType" NOT NULL,
8
+ "userId" TEXT NOT NULL,
9
+ "announcementId" TEXT,
10
+ "commentId" TEXT,
11
+ "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
12
+
13
+ CONSTRAINT "Reaction_pkey" PRIMARY KEY ("id")
14
+ );
15
+
16
+ -- CreateIndex
17
+ CREATE INDEX "Reaction_announcementId_idx" ON "public"."Reaction"("announcementId");
18
+
19
+ -- CreateIndex
20
+ CREATE INDEX "Reaction_commentId_idx" ON "public"."Reaction"("commentId");
21
+
22
+ -- CreateIndex
23
+ CREATE UNIQUE INDEX "Reaction_userId_announcementId_key" ON "public"."Reaction"("userId", "announcementId");
24
+
25
+ -- CreateIndex
26
+ CREATE UNIQUE INDEX "Reaction_userId_commentId_key" ON "public"."Reaction"("userId", "commentId");
27
+
28
+ -- AddForeignKey
29
+ ALTER TABLE "public"."Reaction" ADD CONSTRAINT "Reaction_userId_fkey" FOREIGN KEY ("userId") REFERENCES "public"."User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
30
+
31
+ -- AddForeignKey
32
+ ALTER TABLE "public"."Reaction" ADD CONSTRAINT "Reaction_announcementId_fkey" FOREIGN KEY ("announcementId") REFERENCES "public"."Announcement"("id") ON DELETE CASCADE ON UPDATE CASCADE;
33
+
34
+ -- AddForeignKey
35
+ ALTER TABLE "public"."Reaction" ADD CONSTRAINT "Reaction_commentId_fkey" FOREIGN KEY ("commentId") REFERENCES "public"."AnnouncementComment"("id") ON DELETE CASCADE ON UPDATE CASCADE;
@@ -42,6 +42,15 @@ enum UploadStatus {
42
42
  CANCELLED
43
43
  }
44
44
 
45
+ enum ReactionType {
46
+ THUMBSUP
47
+ CELEBRATE
48
+ CARE
49
+ HEART
50
+ IDEA
51
+ HAPPY
52
+ }
53
+
45
54
  model School {
46
55
  id String @id @default(uuid())
47
56
  name String
@@ -89,6 +98,8 @@ model User {
89
98
  sentMessages Message[] @relation("SentMessages")
90
99
  mentions Mention[] @relation("UserMentions")
91
100
  createdLabChats LabChat[] @relation("CreatedLabChats")
101
+ announcementComments AnnouncementComment[]
102
+ reactions Reaction[]
92
103
 
93
104
  }
94
105
 
@@ -207,6 +218,9 @@ model File {
207
218
  messageId String?
208
219
  message Message? @relation("MessageAttachments", fields: [messageId], references: [id], onDelete: Cascade)
209
220
 
221
+ announcement Announcement? @relation("AnnouncementAttachments", fields: [announcementId], references: [id], onDelete: Cascade)
222
+ announcementId String?
223
+
210
224
  schools School[]
211
225
 
212
226
  schoolDevelopementProgram SchoolDevelopementProgram? @relation("SchoolDevelopementProgramSupportingDocumentation", fields: [schoolDevelopementProgramId], references: [id], onDelete: Cascade)
@@ -251,8 +265,44 @@ model Announcement {
251
265
  teacher User @relation(fields: [teacherId], references: [id])
252
266
  teacherId String
253
267
  createdAt DateTime @default(now())
268
+ modifiedAt DateTime? @updatedAt
254
269
  class Class @relation(fields: [classId], references: [id], onDelete: Cascade)
255
270
  classId String
271
+ attachments File[] @relation("AnnouncementAttachments")
272
+ comments AnnouncementComment[]
273
+ reactions Reaction[]
274
+ }
275
+
276
+ model AnnouncementComment {
277
+ id String @id @default(uuid())
278
+ content String
279
+ author User @relation(fields: [authorId], references: [id], onDelete: Cascade)
280
+ authorId String
281
+ announcement Announcement @relation(fields: [announcementId], references: [id], onDelete: Cascade)
282
+ announcementId String
283
+ parentComment AnnouncementComment? @relation("CommentReplies", fields: [parentCommentId], references: [id], onDelete: Cascade)
284
+ parentCommentId String?
285
+ replies AnnouncementComment[] @relation("CommentReplies")
286
+ reactions Reaction[]
287
+ createdAt DateTime @default(now())
288
+ modifiedAt DateTime? @updatedAt
289
+ }
290
+
291
+ model Reaction {
292
+ id String @id @default(uuid())
293
+ type ReactionType
294
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
295
+ userId String
296
+ announcement Announcement? @relation(fields: [announcementId], references: [id], onDelete: Cascade)
297
+ announcementId String?
298
+ comment AnnouncementComment? @relation(fields: [commentId], references: [id], onDelete: Cascade)
299
+ commentId String?
300
+ createdAt DateTime @default(now())
301
+
302
+ @@unique([userId, announcementId])
303
+ @@unique([userId, commentId])
304
+ @@index([announcementId])
305
+ @@index([commentId])
256
306
  }
257
307
 
258
308
  model Submission {
@@ -102,7 +102,8 @@ export async function createDirectUploadFile(
102
102
  userId: string,
103
103
  directory?: string,
104
104
  assignmentId?: string,
105
- submissionId?: string
105
+ submissionId?: string,
106
+ announcementId?: string
106
107
  ): Promise<DirectUploadFile> {
107
108
  try {
108
109
  // Validate file extension matches MIME type
@@ -167,6 +168,11 @@ export async function createDirectUploadFile(
167
168
  submission: {
168
169
  connect: { id: submissionId }
169
170
  }
171
+ }),
172
+ ...(announcementId && {
173
+ announcement: {
174
+ connect: { id: announcementId }
175
+ }
170
176
  })
171
177
  },
172
178
  });
@@ -323,11 +329,12 @@ export async function createDirectUploadFiles(
323
329
  userId: string,
324
330
  directory?: string,
325
331
  assignmentId?: string,
326
- submissionId?: string
332
+ submissionId?: string,
333
+ announcementId?: string
327
334
  ): Promise<DirectUploadFile[]> {
328
335
  try {
329
336
  const uploadPromises = files.map(file =>
330
- createDirectUploadFile(file, userId, directory, assignmentId, submissionId)
337
+ createDirectUploadFile(file, userId, directory, assignmentId, submissionId, announcementId)
331
338
  );
332
339
  return await Promise.all(uploadPromises);
333
340
  } catch (error) {