@purpleschool/gptbot 0.7.53 → 0.7.54-presentations
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/api/controllers/http/presentation.ts +5 -0
- package/build/api/controllers/http/presentation.js +4 -0
- package/build/commands/chat/create-chat.command.js +1 -3
- package/build/commands/chat/find-chat-by-uuid.command.js +1 -1
- package/build/commands/chat/find-chats.command.js +1 -3
- package/build/commands/chat/get-last-active-chat-command.js +1 -1
- package/build/commands/folder/find-folder-by-uuid-with-chats.command.js +1 -3
- package/build/commands/tools/presentation/build-blank-slide.command.js +21 -0
- package/build/commands/tools/presentation/generate-and-insert-slide.command.js +22 -0
- package/build/commands/tools/presentation/index.js +4 -0
- package/build/commands/tools/presentation/update-presentation-slides.command.js +25 -0
- package/build/commands/tools/presentation/update-presentation.command.js +4 -3
- package/build/commands/tools/presentation/update-slide-image-slot.command.js +36 -0
- package/build/constants/presentation/enums/index.js +1 -0
- package/build/constants/presentation/enums/slide-image-slot-action.enum.js +8 -0
- package/build/models/chat-with-messages.schema.js +9 -0
- package/build/models/chat.schema.js +0 -2
- package/build/models/index.js +1 -0
- package/build/models/tools/presentation/presentation.schema.js +2 -0
- package/build/models/tools/presentation/slide-content-edit.schema.js +135 -0
- package/build/models/tools/presentation/slide-content.schema.js +22 -20
- package/build/models/tools/presentation/slide.schema.js +32 -1
- package/commands/chat/create-chat.command.ts +2 -4
- package/commands/chat/find-chat-by-uuid.command.ts +2 -2
- package/commands/chat/find-chats.command.ts +2 -6
- package/commands/chat/get-last-active-chat-command.ts +2 -2
- package/commands/folder/find-folder-by-uuid-with-chats.command.ts +2 -6
- package/commands/tools/presentation/build-blank-slide.command.ts +23 -0
- package/commands/tools/presentation/generate-and-insert-slide.command.ts +27 -0
- package/commands/tools/presentation/index.ts +4 -0
- package/commands/tools/presentation/update-presentation-slides.command.ts +32 -0
- package/commands/tools/presentation/update-presentation.command.ts +5 -4
- package/commands/tools/presentation/update-slide-image-slot.command.ts +41 -0
- package/constants/presentation/enums/index.ts +1 -0
- package/constants/presentation/enums/slide-image-slot-action.enum.ts +4 -0
- package/models/chat-with-messages.schema.ts +7 -0
- package/models/chat.schema.ts +0 -2
- package/models/index.ts +1 -0
- package/models/tools/presentation/presentation.schema.ts +2 -0
- package/models/tools/presentation/slide-content-edit.schema.ts +160 -0
- package/models/tools/presentation/slide-content.schema.ts +119 -32
- package/models/tools/presentation/slide.schema.ts +38 -0
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import { SlideContentSchema } from './slide-content.schema';
|
|
|
3
3
|
import { SLIDE_CONTENT_TYPE, SLIDE_LAYOUT } from '../../../constants';
|
|
4
4
|
import { SlideIconSlotSchema } from './slide-icon-slot.schema';
|
|
5
5
|
import { SlideImageSlotSchema } from './slide-image-slot.schema';
|
|
6
|
+
import { SlideContentUserEditSchema } from './slide-content-edit.schema';
|
|
6
7
|
|
|
7
8
|
export const SlideSchema = z.object({
|
|
8
9
|
uuid: z.string().uuid(),
|
|
@@ -17,3 +18,40 @@ export const SlideSchema = z.object({
|
|
|
17
18
|
updatedAt: z.date(),
|
|
18
19
|
});
|
|
19
20
|
export type Slide = z.infer<typeof SlideSchema>;
|
|
21
|
+
|
|
22
|
+
export const SlideBulkUpdateSchema = SlideSchema.pick({
|
|
23
|
+
order: true,
|
|
24
|
+
contentTypeId: true,
|
|
25
|
+
layoutId: true,
|
|
26
|
+
presentationId: true,
|
|
27
|
+
})
|
|
28
|
+
.extend({
|
|
29
|
+
uuid: z.string().uuid().optional(),
|
|
30
|
+
content: SlideContentUserEditSchema,
|
|
31
|
+
})
|
|
32
|
+
.array()
|
|
33
|
+
.min(1, 'Must include at least one slide')
|
|
34
|
+
.refine(
|
|
35
|
+
(arr) => {
|
|
36
|
+
const orders = arr.map((s) => s.order);
|
|
37
|
+
const unique = new Set(orders);
|
|
38
|
+
if (unique.size !== orders.length) return false;
|
|
39
|
+
const sorted = [...orders].sort((a, b) => a - b);
|
|
40
|
+
return sorted.every((val, idx) => val === idx);
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
message: 'Slide orders must be unique and sequential starting at 0',
|
|
44
|
+
path: ['order'],
|
|
45
|
+
},
|
|
46
|
+
)
|
|
47
|
+
.refine(
|
|
48
|
+
(arr) => {
|
|
49
|
+
const [firstId, ...rest] = arr.map((s) => s.presentationId);
|
|
50
|
+
return rest.every((id) => id === firstId);
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
message: 'All slides must belong to the same presentation',
|
|
54
|
+
path: ['presentationId'],
|
|
55
|
+
},
|
|
56
|
+
);
|
|
57
|
+
export type SlideBulkUpdate = z.infer<typeof SlideBulkUpdateSchema>;
|