@purpleschool/student-works 1.2.2 → 1.4.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 (127) hide show
  1. package/api/controller/http/index.ts +1 -0
  2. package/api/controller/http/presentation.ts +39 -0
  3. package/api/routes.ts +94 -0
  4. package/build/api/controller/http/index.js +1 -0
  5. package/build/api/controller/http/presentation.js +34 -0
  6. package/build/api/routes.js +54 -0
  7. package/build/commands/index.js +1 -0
  8. package/build/commands/presentation/build-blank-slide.command.js +16 -0
  9. package/build/commands/presentation/create-presentation.command.js +19 -0
  10. package/build/commands/presentation/delete-all-user-presentations.command.js +9 -0
  11. package/build/commands/presentation/delete-presentation.command.js +11 -0
  12. package/build/commands/presentation/delete-slide-outline.command.js +12 -0
  13. package/build/commands/presentation/export-presentation-as-pptx.command.js +17 -0
  14. package/build/commands/presentation/find-presentation-by-uuid.command.js +14 -0
  15. package/build/commands/presentation/find-presentation-outline.command.js +14 -0
  16. package/build/commands/presentation/find-presentations.command.js +18 -0
  17. package/build/commands/presentation/generate-and-insert-slide.command.js +22 -0
  18. package/build/commands/presentation/generate-presentation-slides.command.js +17 -0
  19. package/build/commands/presentation/get-presentation-config.command.js +11 -0
  20. package/build/commands/presentation/index.js +40 -0
  21. package/build/commands/presentation/presentation-generate-report.command.js +17 -0
  22. package/build/commands/presentation/presentation-paraphrase.command.js +20 -0
  23. package/build/commands/presentation/reposition-slide-outline.command.js +15 -0
  24. package/build/commands/presentation/reposition-slide.command.js +15 -0
  25. package/build/commands/presentation/set-reaction-to-presentation.command.js +28 -0
  26. package/build/commands/presentation/update-presentation-outline.command.js +15 -0
  27. package/build/commands/presentation/update-presentation-slides.command.js +25 -0
  28. package/build/commands/presentation/update-presentation.command.js +15 -0
  29. package/build/commands/presentation/update-slide-image-slot.command.js +34 -0
  30. package/build/commands/presentation/update-slide-outline.command.js +23 -0
  31. package/build/commands/presentation/update-slide.command.js +19 -0
  32. package/build/constants/errors/errors.js +261 -0
  33. package/build/constants/index.js +1 -0
  34. package/build/constants/presentation/enums/index.js +27 -0
  35. package/build/constants/presentation/enums/presentation-ai-action-call-status.enum.js +9 -0
  36. package/build/constants/presentation/enums/presentation-ai-action-pricing-type.enum.js +8 -0
  37. package/build/constants/presentation/enums/presentation-ai-action-type.enum.js +8 -0
  38. package/build/constants/presentation/enums/presentation-stage.enum.js +14 -0
  39. package/build/constants/presentation/enums/presentation-target-audience.enum.js +10 -0
  40. package/build/constants/presentation/enums/slide-content-type.enum.js +16 -0
  41. package/build/constants/presentation/enums/slide-icon-slot-status.enum.js +10 -0
  42. package/build/constants/presentation/enums/slide-image-slot-action.enum.js +8 -0
  43. package/build/constants/presentation/enums/slide-image-slot.status.enum.js +10 -0
  44. package/build/constants/presentation/enums/slide-layout.enum.js +8 -0
  45. package/build/constants/presentation/index.js +18 -0
  46. package/build/constants/presentation/maps/index.js +17 -0
  47. package/build/constants/presentation/maps/slide-layout-map.constant.js +17 -0
  48. package/build/helpers/index.js +1 -0
  49. package/build/helpers/presentation/calculate-presentation-ai-action-price.util.js +16 -0
  50. package/build/helpers/presentation/index.js +17 -0
  51. package/build/models/index.js +1 -0
  52. package/build/models/language.schema.js +11 -0
  53. package/build/models/presentation/index.js +25 -0
  54. package/build/models/presentation/pptx-export-payload.schema.js +216 -0
  55. package/build/models/presentation/presentation-ai-action.schema.js +27 -0
  56. package/build/models/presentation/presentation-config.schema.js +21 -0
  57. package/build/models/presentation/presentation-template.schema.js +13 -0
  58. package/build/models/presentation/presentation-title-page.schema.js +9 -0
  59. package/build/models/presentation/presentation.schema.js +35 -0
  60. package/build/models/presentation/slide-content-edit.schema.js +146 -0
  61. package/build/models/presentation/slide-content-type.schema.js +14 -0
  62. package/build/models/presentation/slide-content.schema.js +368 -0
  63. package/build/models/presentation/slide-icon-slot.schema.js +15 -0
  64. package/build/models/presentation/slide-image-slot.schema.js +16 -0
  65. package/build/models/presentation/slide-outline.schema.js +50 -0
  66. package/build/models/presentation/slide.schema.js +58 -0
  67. package/commands/index.ts +1 -0
  68. package/commands/presentation/build-blank-slide.command.ts +18 -0
  69. package/commands/presentation/create-presentation.command.ts +21 -0
  70. package/commands/presentation/delete-all-user-presentations.command.ts +9 -0
  71. package/commands/presentation/delete-presentation.command.ts +13 -0
  72. package/commands/presentation/delete-slide-outline.command.ts +12 -0
  73. package/commands/presentation/export-presentation-as-pptx.command.ts +20 -0
  74. package/commands/presentation/find-presentation-by-uuid.command.ts +16 -0
  75. package/commands/presentation/find-presentation-outline.command.ts +16 -0
  76. package/commands/presentation/find-presentations.command.ts +18 -0
  77. package/commands/presentation/generate-and-insert-slide.command.ts +27 -0
  78. package/commands/presentation/generate-presentation-slides.command.ts +21 -0
  79. package/commands/presentation/get-presentation-config.command.ts +10 -0
  80. package/commands/presentation/index.ts +24 -0
  81. package/commands/presentation/presentation-generate-report.command.ts +21 -0
  82. package/commands/presentation/presentation-paraphrase.command.ts +26 -0
  83. package/commands/presentation/reposition-slide-outline.command.ts +17 -0
  84. package/commands/presentation/reposition-slide.command.ts +17 -0
  85. package/commands/presentation/set-reaction-to-presentation.command.ts +33 -0
  86. package/commands/presentation/update-presentation-outline.command.ts +18 -0
  87. package/commands/presentation/update-presentation-slides.command.ts +32 -0
  88. package/commands/presentation/update-presentation.command.ts +18 -0
  89. package/commands/presentation/update-slide-image-slot.command.ts +40 -0
  90. package/commands/presentation/update-slide-outline.command.ts +26 -0
  91. package/commands/presentation/update-slide.command.ts +25 -0
  92. package/constants/errors/errors.ts +261 -0
  93. package/constants/index.ts +1 -0
  94. package/constants/presentation/enums/index.ts +11 -0
  95. package/constants/presentation/enums/presentation-ai-action-call-status.enum.ts +5 -0
  96. package/constants/presentation/enums/presentation-ai-action-pricing-type.enum.ts +4 -0
  97. package/constants/presentation/enums/presentation-ai-action-type.enum.ts +4 -0
  98. package/constants/presentation/enums/presentation-stage.enum.ts +13 -0
  99. package/constants/presentation/enums/presentation-target-audience.enum.ts +6 -0
  100. package/constants/presentation/enums/slide-content-type.enum.ts +12 -0
  101. package/constants/presentation/enums/slide-icon-slot-status.enum.ts +6 -0
  102. package/constants/presentation/enums/slide-image-slot-action.enum.ts +4 -0
  103. package/constants/presentation/enums/slide-image-slot.status.enum.ts +6 -0
  104. package/constants/presentation/enums/slide-layout.enum.ts +4 -0
  105. package/constants/presentation/index.ts +2 -0
  106. package/constants/presentation/maps/index.ts +1 -0
  107. package/constants/presentation/maps/slide-layout-map.constant.ts +15 -0
  108. package/helpers/index.ts +1 -0
  109. package/helpers/presentation/calculate-presentation-ai-action-price.util.ts +20 -0
  110. package/helpers/presentation/index.ts +1 -0
  111. package/models/index.ts +1 -0
  112. package/models/language.schema.ts +9 -0
  113. package/models/presentation/index.ts +9 -0
  114. package/models/presentation/pptx-export-payload.schema.ts +246 -0
  115. package/models/presentation/presentation-ai-action.schema.ts +30 -0
  116. package/models/presentation/presentation-config.schema.ts +20 -0
  117. package/models/presentation/presentation-template.schema.ts +11 -0
  118. package/models/presentation/presentation-title-page.schema.ts +9 -0
  119. package/models/presentation/presentation.schema.ts +38 -0
  120. package/models/presentation/slide-content-edit.schema.ts +175 -0
  121. package/models/presentation/slide-content-type.schema.ts +13 -0
  122. package/models/presentation/slide-content.schema.ts +581 -0
  123. package/models/presentation/slide-icon-slot.schema.ts +13 -0
  124. package/models/presentation/slide-image-slot.schema.ts +14 -0
  125. package/models/presentation/slide-outline.schema.ts +58 -0
  126. package/models/presentation/slide.schema.ts +66 -0
  127. package/package.json +2 -2
@@ -0,0 +1,175 @@
1
+ import z from 'zod';
2
+ import {
3
+ ICoverSlideDataStructure,
4
+ IThankYouSlideDataStructure,
5
+ ITextSlideDataStructure,
6
+ IStructuredListSlideDataStructure,
7
+ IContentsSlideDataStructure,
8
+ IImageSlideDataStructure,
9
+ ISectionBreakSlideDataStructure,
10
+ ITableSlideDataStructure,
11
+ SLIDE_CHART_TYPE,
12
+ IBarChartSlideDataStructure,
13
+ IChartSlideDataStructure,
14
+ ImageSlotSchema,
15
+ ITimelineSlideDataStructure,
16
+ } from './slide-content.schema';
17
+ import { SLIDE_CONTENT_TYPE } from '../../constants';
18
+
19
+ export const CoverSlideDataUserEditSchema = z.object({
20
+ contentType: z.literal(SLIDE_CONTENT_TYPE.COVER),
21
+ title: z.string().max(1000),
22
+ author: z.object({
23
+ label: z.string().max(200),
24
+ value: z.string().max(500),
25
+ }),
26
+ date: z.object({
27
+ label: z.string().max(200),
28
+ value: z.string().max(500),
29
+ }),
30
+ email: z.object({
31
+ label: z.string().max(200),
32
+ value: z.string().max(500),
33
+ }),
34
+ version: z.literal(1),
35
+ }) satisfies z.ZodType<ICoverSlideDataStructure>;
36
+
37
+ export const ThankYouSlideDataUserEditSchema = z.object({
38
+ contentType: z.literal(SLIDE_CONTENT_TYPE.THANK_YOU),
39
+ title: z.string().max(1000),
40
+ author: z.object({
41
+ label: z.string().max(200),
42
+ value: z.string().max(500),
43
+ }),
44
+ date: z.object({
45
+ label: z.string().max(200),
46
+ value: z.string().max(500),
47
+ }),
48
+ email: z.object({
49
+ label: z.string().max(200),
50
+ value: z.string().max(500),
51
+ }),
52
+ version: z.literal(1),
53
+ }) satisfies z.ZodType<IThankYouSlideDataStructure>;
54
+
55
+ export const TextSlideDataUserEditSchema = z.object({
56
+ contentType: z.literal(SLIDE_CONTENT_TYPE.TEXT),
57
+ title: z.string().max(1000),
58
+ description: z.string().max(5000),
59
+ version: z.literal(1),
60
+ }) satisfies z.ZodType<ITextSlideDataStructure>;
61
+
62
+ export const StructuredListSlideDataUserEditSchema = z.object({
63
+ contentType: z.literal(SLIDE_CONTENT_TYPE.STRUCTURED_LIST),
64
+ title: z.string().max(1000),
65
+ description: z.string().max(2000),
66
+ list: z
67
+ .array(
68
+ z.object({
69
+ title: z.string().max(500),
70
+ description: z.string().max(1000),
71
+ }),
72
+ )
73
+ .max(15),
74
+ version: z.literal(1),
75
+ }) satisfies z.ZodType<IStructuredListSlideDataStructure>;
76
+
77
+ export const ContentsSlideDataUserEditSchema = z.object({
78
+ contentType: z.literal(SLIDE_CONTENT_TYPE.CONTENTS),
79
+ title: z.string().max(1000),
80
+ items: z
81
+ .array(
82
+ z.object({
83
+ pageNumber: z.number(),
84
+ title: z.string().max(1000),
85
+ }),
86
+ )
87
+ .max(100),
88
+ version: z.literal(1),
89
+ }) satisfies z.ZodType<IContentsSlideDataStructure>;
90
+
91
+ export const ImageSlideDataUserEditSchema = z.object({
92
+ contentType: z.literal(SLIDE_CONTENT_TYPE.TEXT_WITH_IMAGE),
93
+ title: z.string().max(1000),
94
+ description: z.string().max(4000),
95
+ imageSlot: ImageSlotSchema,
96
+ version: z.literal(1),
97
+ }) satisfies z.ZodType<IImageSlideDataStructure>;
98
+
99
+ export const SectionBreakSlideDataUserEditSchema = z.object({
100
+ contentType: z.literal(SLIDE_CONTENT_TYPE.SECTION_BREAK),
101
+ title: z.string().max(1000),
102
+ description: z.string().max(1000),
103
+ version: z.literal(1),
104
+ }) satisfies z.ZodType<ISectionBreakSlideDataStructure>;
105
+
106
+ export const TableSlideDataUserEditSchema = z.object({
107
+ contentType: z.literal(SLIDE_CONTENT_TYPE.TABLE),
108
+ title: z.string().max(1000),
109
+ description: z.string().max(2000),
110
+ table: z.object({
111
+ columnHeaders: z.array(z.string().max(500)).max(30),
112
+ rows: z.array(z.array(z.string().max(1000))).max(50),
113
+ hasRowHeaders: z.boolean(),
114
+ hasSummaryRow: z.boolean(),
115
+ }),
116
+ version: z.literal(1),
117
+ }) satisfies z.ZodType<ITableSlideDataStructure>;
118
+
119
+ export const BarChartSlideDataUserEditSchema = z.object({
120
+ type: z.literal(SLIDE_CHART_TYPE.BAR),
121
+ categories: z.array(z.string().max(500)).max(100),
122
+ series: z
123
+ .array(
124
+ z.object({
125
+ name: z.string().max(500),
126
+ data: z.array(z.number()),
127
+ type: z.number().min(0).max(11),
128
+ }),
129
+ )
130
+ .max(10),
131
+ yAxisLabel: z.string().max(500).optional(),
132
+ unit: z.string().max(100).optional(),
133
+ version: z.literal(1),
134
+ }) satisfies z.ZodType<IBarChartSlideDataStructure>;
135
+
136
+ export const ChartSlideDataUserEditSchema = z.object({
137
+ contentType: z.literal(SLIDE_CONTENT_TYPE.CHART),
138
+ title: z.string().max(1000),
139
+ description: z.string().max(4000),
140
+ chart: z.discriminatedUnion('type', [BarChartSlideDataUserEditSchema]),
141
+ version: z.literal(1),
142
+ }) satisfies z.ZodType<IChartSlideDataStructure>;
143
+
144
+ export const TimelineSlideDataUserEditSchema = z.object({
145
+ contentType: z.literal(SLIDE_CONTENT_TYPE.TIMELINE),
146
+ title: z.string().min(1).max(500),
147
+ description: z.string().min(1).max(1000),
148
+ timeline: z.object({
149
+ events: z
150
+ .array(
151
+ z.object({
152
+ date: z.string().min(1).max(100),
153
+ title: z.string().min(1).max(200),
154
+ description: z.string().min(1).max(500),
155
+ }),
156
+ )
157
+ .min(2)
158
+ .max(10),
159
+ }),
160
+ version: z.literal(1),
161
+ }) satisfies z.ZodType<ITimelineSlideDataStructure>;
162
+
163
+ export const SlideContentUserEditSchema = z.discriminatedUnion('contentType', [
164
+ CoverSlideDataUserEditSchema,
165
+ StructuredListSlideDataUserEditSchema,
166
+ TextSlideDataUserEditSchema,
167
+ ContentsSlideDataUserEditSchema,
168
+ SectionBreakSlideDataUserEditSchema,
169
+ ImageSlideDataUserEditSchema,
170
+ ThankYouSlideDataUserEditSchema,
171
+ TableSlideDataUserEditSchema,
172
+ ChartSlideDataUserEditSchema,
173
+ TimelineSlideDataUserEditSchema,
174
+ ]);
175
+ export type SlideContentUserEdit = z.infer<typeof SlideContentUserEditSchema>;
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ import { SLIDE_CONTENT_TYPE, SLIDE_LAYOUT } from '../../constants';
3
+
4
+ export const SlideContentTypeSchema = z.object({
5
+ id: z.nativeEnum(SLIDE_CONTENT_TYPE),
6
+ title: z.string(),
7
+ layouts: z.array(z.nativeEnum(SLIDE_LAYOUT)),
8
+ order: z.number(),
9
+ icon: z.string(),
10
+ createdAt: z.date(),
11
+ updatedAt: z.date(),
12
+ });
13
+ export type SlideContentType = z.infer<typeof SlideContentTypeSchema>;