@studious-lms/server 1.1.16 → 1.1.18
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/dist/lib/jsonConversion.d.ts.map +1 -1
- package/dist/lib/jsonConversion.js +290 -124
- package/dist/routers/_app.d.ts +190 -0
- package/dist/routers/_app.d.ts.map +1 -1
- package/dist/routers/_app.js +2 -0
- package/dist/routers/assignment.d.ts +15 -0
- package/dist/routers/assignment.d.ts.map +1 -1
- package/dist/routers/file.d.ts +2 -0
- package/dist/routers/file.d.ts.map +1 -1
- package/dist/routers/labChat.js +2 -1
- package/dist/routers/marketing.d.ts +80 -0
- package/dist/routers/marketing.d.ts.map +1 -0
- package/dist/routers/marketing.js +82 -0
- package/dist/seedDatabase.d.ts.map +1 -1
- package/dist/seedDatabase.js +1459 -24
- package/dist/utils/inference.js +2 -2
- package/package.json +2 -1
- package/prisma/schema.prisma +37 -0
- package/src/lib/NotoSans-Bold.ttf +0 -0
- package/src/lib/NotoSans-Italic.ttf +0 -0
- package/src/lib/NotoSans-Regular.ttf +0 -0
- package/src/lib/jsonConversion.ts +346 -135
- package/src/routers/_app.ts +2 -0
- package/src/routers/labChat.ts +4 -1
- package/src/routers/marketing.ts +86 -0
- package/src/seedDatabase.ts +1512 -21
- package/src/utils/inference.ts +2 -2
package/src/routers/_app.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { notificationRouter } from "./notifications.js";
|
|
|
16
16
|
import { conversationRouter } from "./conversation.js";
|
|
17
17
|
import { messageRouter } from "./message.js";
|
|
18
18
|
import { labChatRouter } from "./labChat.js";
|
|
19
|
+
import { marketingRouter } from "./marketing.js";
|
|
19
20
|
|
|
20
21
|
export const appRouter = createTRPCRouter({
|
|
21
22
|
class: classRouter,
|
|
@@ -33,6 +34,7 @@ export const appRouter = createTRPCRouter({
|
|
|
33
34
|
conversation: conversationRouter,
|
|
34
35
|
message: messageRouter,
|
|
35
36
|
labChat: labChatRouter,
|
|
37
|
+
marketing: marketingRouter,
|
|
36
38
|
});
|
|
37
39
|
|
|
38
40
|
// Export type router type definition
|
package/src/routers/labChat.ts
CHANGED
|
@@ -793,7 +793,7 @@ WHEN CREATING COURSE MATERIALS (docs field):
|
|
|
793
793
|
- Colors must be hex strings: "#RGB" or "#RRGGBB".
|
|
794
794
|
- Headings (0-5): content is a single string; you may set metadata.align.
|
|
795
795
|
- Paragraphs (6) and Quotes (12): content is a single string.
|
|
796
|
-
- Bullets (7) and Numbered (8): content is an array of strings (one item per list entry).
|
|
796
|
+
- Bullets (7) and Numbered (8): content is an array of strings (one item per list entry). DO NOT include bullet symbols (*) or numbers (1. 2. 3.) in the content - the format will automatically add these.
|
|
797
797
|
- Code blocks (11): prefer content as an array of lines; preserve indentation via leading tabs/spaces. If using a single string, include \n between lines.
|
|
798
798
|
- Table (9) and Image (10) are not supported by the renderer now; do not emit them.
|
|
799
799
|
- Use metadata sparingly; omit fields you don't need. For code blocks you may set metadata.paddingX, paddingY, background, and font (1 for Courier).
|
|
@@ -901,6 +901,8 @@ WHEN CREATING COURSE MATERIALS (docs field):
|
|
|
901
901
|
// Generate PDFs if docs are provided
|
|
902
902
|
if (jsonData.docs && Array.isArray(jsonData.docs)) {
|
|
903
903
|
|
|
904
|
+
|
|
905
|
+
console.log('Generating PDFs', { labChatId, docs: JSON.stringify(jsonData.docs, null, 2) });
|
|
904
906
|
for (let i = 0; i < jsonData.docs.length; i++) {
|
|
905
907
|
const doc = jsonData.docs[i];
|
|
906
908
|
if (!doc.title || !doc.blocks || !Array.isArray(doc.blocks)) {
|
|
@@ -908,6 +910,7 @@ WHEN CREATING COURSE MATERIALS (docs field):
|
|
|
908
910
|
continue;
|
|
909
911
|
}
|
|
910
912
|
|
|
913
|
+
|
|
911
914
|
try {
|
|
912
915
|
let pdfBytes = await createPdf(doc.blocks);
|
|
913
916
|
if (pdfBytes) {
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { createTRPCRouter, publicProcedure } from "../trpc.js";
|
|
3
|
+
import { prisma } from "../lib/prisma.js";
|
|
4
|
+
import { v4 } from "uuid";
|
|
5
|
+
|
|
6
|
+
export const marketingRouter = createTRPCRouter({
|
|
7
|
+
createSchoolDevelopementProgram: publicProcedure
|
|
8
|
+
.input(z.object({
|
|
9
|
+
name: z.string(),
|
|
10
|
+
type: z.string(),
|
|
11
|
+
address: z.string(),
|
|
12
|
+
city: z.string(),
|
|
13
|
+
country: z.string(),
|
|
14
|
+
numberOfStudents: z.number(),
|
|
15
|
+
numberOfTeachers: z.number(),
|
|
16
|
+
website: z.string().optional(),
|
|
17
|
+
contactName: z.string().optional(),
|
|
18
|
+
contactRole: z.string().optional(),
|
|
19
|
+
contactEmail: z.string().optional(),
|
|
20
|
+
contactPhone: z.string().optional(),
|
|
21
|
+
eligibilityInformation: z.string().optional(),
|
|
22
|
+
whyHelp: z.string().optional(),
|
|
23
|
+
additionalInformation: z.string().optional(),
|
|
24
|
+
}))
|
|
25
|
+
.mutation(async ({ ctx, input }) => {
|
|
26
|
+
const { name, type, address, city, country, numberOfStudents, numberOfTeachers, website, contactName, contactRole, contactEmail, contactPhone, eligibilityInformation, whyHelp, additionalInformation } = input;
|
|
27
|
+
|
|
28
|
+
const date = new Date();
|
|
29
|
+
|
|
30
|
+
const id = name.slice(0, 3).toUpperCase() + '-' + date.getFullYear() + '-' + v4().slice(0, 4).toUpperCase();
|
|
31
|
+
const schoolDevelopementProgram = await prisma.schoolDevelopementProgram.create({
|
|
32
|
+
data: {
|
|
33
|
+
id,
|
|
34
|
+
name,
|
|
35
|
+
type,
|
|
36
|
+
address,
|
|
37
|
+
city,
|
|
38
|
+
country,
|
|
39
|
+
numberOfStudents,
|
|
40
|
+
numberOfTeachers,
|
|
41
|
+
website,
|
|
42
|
+
contactName,
|
|
43
|
+
contactRole,
|
|
44
|
+
contactEmail,
|
|
45
|
+
contactPhone,
|
|
46
|
+
eligibilityInformation,
|
|
47
|
+
whyHelp,
|
|
48
|
+
additionalInformation,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
id: schoolDevelopementProgram.id,
|
|
54
|
+
};
|
|
55
|
+
}),
|
|
56
|
+
searchSchoolDevelopementPrograms: publicProcedure
|
|
57
|
+
.input(z.object({
|
|
58
|
+
id: z.string(),
|
|
59
|
+
}))
|
|
60
|
+
.query(async ({ input }) => {
|
|
61
|
+
const { id } = input;
|
|
62
|
+
const schoolDevelopementProgram = await prisma.schoolDevelopementProgram.findUnique({
|
|
63
|
+
where: {
|
|
64
|
+
id,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
return schoolDevelopementProgram;
|
|
68
|
+
}),
|
|
69
|
+
earlyAccessRequest: publicProcedure
|
|
70
|
+
.input(z.object({
|
|
71
|
+
email: z.string(),
|
|
72
|
+
institutionSize: z.string(),
|
|
73
|
+
}))
|
|
74
|
+
.mutation(async ({ input }) => {
|
|
75
|
+
const { email, institutionSize } = input;
|
|
76
|
+
const earlyAccessRequest = await prisma.earlyAccessRequest.create({
|
|
77
|
+
data: {
|
|
78
|
+
email,
|
|
79
|
+
institutionSize,
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
return {
|
|
83
|
+
id: earlyAccessRequest.id,
|
|
84
|
+
};
|
|
85
|
+
}),
|
|
86
|
+
});
|