@studious-lms/server 1.0.8 → 1.1.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.
@@ -79,6 +79,11 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
79
79
  };
80
80
  output: {
81
81
  class: {
82
+ sections: {
83
+ id: string;
84
+ name: string;
85
+ classId: string;
86
+ }[];
82
87
  assignments: {
83
88
  late: boolean;
84
89
  submitted: boolean;
@@ -113,11 +118,6 @@ export declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
113
118
  structured: string;
114
119
  } | null;
115
120
  }[];
116
- sections: {
117
- id: string;
118
- name: string;
119
- classId: string;
120
- }[];
121
121
  announcements: {
122
122
  id: string;
123
123
  remarks: string;
@@ -3169,6 +3169,11 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
3169
3169
  };
3170
3170
  output: {
3171
3171
  class: {
3172
+ sections: {
3173
+ id: string;
3174
+ name: string;
3175
+ classId: string;
3176
+ }[];
3172
3177
  assignments: {
3173
3178
  late: boolean;
3174
3179
  submitted: boolean;
@@ -3203,11 +3208,6 @@ export declare const createCaller: import("@trpc/server").TRPCRouterCaller<{
3203
3208
  structured: string;
3204
3209
  } | null;
3205
3210
  }[];
3206
- sections: {
3207
- id: string;
3208
- name: string;
3209
- classId: string;
3210
- }[];
3211
3211
  announcements: {
3212
3212
  id: string;
3213
3213
  remarks: string;
@@ -62,6 +62,11 @@ export declare const classRouter: import("@trpc/server").TRPCBuiltRouter<{
62
62
  };
63
63
  output: {
64
64
  class: {
65
+ sections: {
66
+ id: string;
67
+ name: string;
68
+ classId: string;
69
+ }[];
65
70
  assignments: {
66
71
  late: boolean;
67
72
  submitted: boolean;
@@ -96,11 +101,6 @@ export declare const classRouter: import("@trpc/server").TRPCBuiltRouter<{
96
101
  structured: string;
97
102
  } | null;
98
103
  }[];
99
- sections: {
100
- id: string;
101
- name: string;
102
- classId: string;
103
- }[];
104
104
  announcements: {
105
105
  id: string;
106
106
  remarks: string;
@@ -1 +1 @@
1
- {"version":3,"file":"class.d.ts","sourceRoot":"","sources":["../../src/routers/class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAshCtB,CAAC"}
1
+ {"version":3,"file":"class.d.ts","sourceRoot":"","sources":["../../src/routers/class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2hCtB,CAAC"}
@@ -163,23 +163,26 @@ export const classRouter = createTRPCRouter({
163
163
  },
164
164
  },
165
165
  });
166
+ if (!classData) {
167
+ throw new Error('Class not found');
168
+ }
169
+ const formattedClassData = {
170
+ ...classData,
171
+ assignments: classData.assignments.map(assignment => ({
172
+ ...assignment,
173
+ late: assignment.dueDate < new Date(),
174
+ submitted: assignment.submissions.some(submission => submission.studentId === ctx.user?.id),
175
+ returned: assignment.submissions.some(submission => submission.studentId === ctx.user?.id && submission.returned),
176
+ })),
177
+ };
166
178
  const sections = await prisma.section.findMany({
167
179
  where: {
168
180
  classId: classId,
169
181
  },
170
182
  });
171
- if (!classData) {
172
- throw new Error('Class not found');
173
- }
174
183
  return {
175
184
  class: {
176
- ...classData,
177
- assignments: classData.assignments.map(assignment => ({
178
- ...assignment,
179
- late: assignment.dueDate < new Date(),
180
- submitted: assignment.submissions.some(submission => submission.studentId === ctx.user?.id),
181
- returned: assignment.submissions.some(submission => submission.studentId === ctx.user?.id && submission.returned),
182
- })),
185
+ ...formattedClassData,
183
186
  sections,
184
187
  },
185
188
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studious-lms/server",
3
- "version": "1.0.8",
3
+ "version": "1.1.0",
4
4
  "description": "Backend server for Studious application",
5
5
  "main": "dist/exportType.js",
6
6
  "types": "dist/exportType.d.ts",
@@ -168,25 +168,30 @@ export const classRouter = createTRPCRouter({
168
168
  },
169
169
  });
170
170
 
171
+
172
+ if (!classData) {
173
+ throw new Error('Class not found');
174
+ }
175
+
176
+ const formattedClassData = {
177
+ ...classData,
178
+ assignments: classData.assignments.map(assignment => ({
179
+ ...assignment,
180
+ late: assignment.dueDate < new Date(),
181
+ submitted: assignment.submissions.some(submission => submission.studentId === ctx.user?.id),
182
+ returned: assignment.submissions.some(submission => submission.studentId === ctx.user?.id && submission.returned),
183
+ })),
184
+ }
185
+
171
186
  const sections = await prisma.section.findMany({
172
187
  where: {
173
188
  classId: classId,
174
189
  },
175
190
  });
176
191
 
177
- if (!classData) {
178
- throw new Error('Class not found');
179
- }
180
-
181
192
  return {
182
193
  class: {
183
- ...classData,
184
- assignments: classData.assignments.map(assignment => ({
185
- ...assignment,
186
- late: assignment.dueDate < new Date(),
187
- submitted: assignment.submissions.some(submission => submission.studentId === ctx.user?.id),
188
- returned: assignment.submissions.some(submission => submission.studentId === ctx.user?.id && submission.returned),
189
- })),
194
+ ...formattedClassData,
190
195
  sections,
191
196
  },
192
197
  };