@purpleschool/gptbot 0.7.56 → 0.7.57-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 +10 -0
- package/api/controllers/http/tool.ts +0 -1
- package/build/api/controllers/http/presentation.js +7 -0
- package/build/api/controllers/http/tool.js +0 -1
- package/build/commands/chat/check-limit.command.js +0 -1
- 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 +7 -0
- package/build/commands/tools/presentation/presentation-generate-report.command.js +17 -0
- package/build/commands/tools/presentation/presentation-paraphrase.command.js +20 -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 +34 -0
- package/build/commands/tools/presentation/update-slide.command.js +19 -0
- package/build/commands/tools/tool/index.js +0 -1
- package/build/constants/errors/errors.js +2 -7
- package/build/constants/presentation/enums/index.js +4 -0
- package/build/constants/presentation/enums/presentation-ai-action-call-status.enum.js +9 -0
- package/build/constants/presentation/enums/presentation-ai-action-pricing-type.enum.js +8 -0
- package/build/constants/presentation/enums/presentation-ai-action-type.enum.js +8 -0
- package/build/constants/presentation/enums/slide-image-slot-action.enum.js +8 -0
- package/build/constants/subscription/enums/subscription-feature-type.enum.js +0 -3
- package/build/constants/transaction/enums/user-balance-status.enum.js +0 -1
- package/build/helpers/index.js +1 -0
- package/build/helpers/presentation/calculate-presentation-ai-action-price.util.js +16 -0
- package/build/helpers/presentation/index.js +17 -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/page.schema.js +0 -2
- package/build/models/subscription-feature.schema.js +1 -26
- package/build/models/subscription.schema.js +0 -1
- package/build/models/tool.schema.js +1 -8
- package/build/models/tools/index.js +1 -0
- package/build/models/tools/presentation/index.js +1 -0
- package/build/models/tools/presentation/presentation-ai-action.schema.js +27 -0
- package/build/models/tools/presentation/presentation-config.schema.js +3 -0
- package/build/models/tools/presentation/presentation.schema.js +2 -0
- package/build/models/tools/presentation/slide-content-edit.schema.js +129 -0
- package/build/models/tools/presentation/slide-content.schema.js +22 -20
- package/build/models/tools/presentation/slide.schema.js +39 -1
- package/build/models/user-to-subscription.schema.js +0 -1
- package/commands/chat/check-limit.command.ts +0 -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 +7 -0
- package/commands/tools/presentation/presentation-generate-report.command.ts +21 -0
- package/commands/tools/presentation/presentation-paraphrase.command.ts +26 -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 +40 -0
- package/commands/tools/presentation/update-slide.command.ts +25 -0
- package/commands/tools/tool/index.ts +0 -1
- package/constants/errors/errors.ts +2 -7
- package/constants/presentation/enums/index.ts +4 -0
- package/constants/presentation/enums/presentation-ai-action-call-status.enum.ts +5 -0
- package/constants/presentation/enums/presentation-ai-action-pricing-type.enum.ts +4 -0
- package/constants/presentation/enums/presentation-ai-action-type.enum.ts +4 -0
- package/constants/presentation/enums/slide-image-slot-action.enum.ts +4 -0
- package/constants/subscription/enums/subscription-feature-type.enum.ts +0 -3
- package/constants/transaction/enums/user-balance-status.enum.ts +0 -1
- package/helpers/index.ts +1 -0
- package/helpers/presentation/calculate-presentation-ai-action-price.util.ts +20 -0
- package/helpers/presentation/index.ts +1 -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/page.schema.ts +0 -2
- package/models/subscription-feature.schema.ts +0 -30
- package/models/subscription.schema.ts +0 -1
- package/models/tool.schema.ts +0 -13
- package/models/tools/index.ts +1 -0
- package/models/tools/presentation/index.ts +1 -0
- package/models/tools/presentation/presentation-ai-action.schema.ts +33 -0
- package/models/tools/presentation/presentation-config.schema.ts +3 -0
- package/models/tools/presentation/presentation.schema.ts +2 -0
- package/models/tools/presentation/slide-content-edit.schema.ts +154 -0
- package/models/tools/presentation/slide-content.schema.ts +119 -32
- package/models/tools/presentation/slide.schema.ts +47 -0
- package/models/user-to-subscription.schema.ts +0 -1
- package/package.json +1 -1
- package/build/commands/tools/tool/find-formatted-tools.command.js +0 -11
- package/commands/tools/tool/find-formatted-tools.command.ts +0 -11
|
@@ -2014,14 +2014,9 @@ export const ERRORS = {
|
|
|
2014
2014
|
message: 'не удалось получить статистику пользователя',
|
|
2015
2015
|
httpCode: 500,
|
|
2016
2016
|
},
|
|
2017
|
-
|
|
2017
|
+
SLIDE_IMAGE_SLOT_UPDATE_ERROR: {
|
|
2018
2018
|
code: 'A412',
|
|
2019
|
-
message: '
|
|
2020
|
-
httpCode: 500,
|
|
2021
|
-
},
|
|
2022
|
-
TOOL_FIND_ALL_ERROR: {
|
|
2023
|
-
code: 'A413',
|
|
2024
|
-
message: 'Ошибка при получении всех тулов',
|
|
2019
|
+
message: 'Произошла ошибка при обновлении изображения на слайде',
|
|
2025
2020
|
httpCode: 500,
|
|
2026
2021
|
},
|
|
2027
2022
|
};
|
|
@@ -3,3 +3,7 @@ export * from './slide-content-type.enum';
|
|
|
3
3
|
export * from './slide-icon-slot-status.enum';
|
|
4
4
|
export * from './slide-image-slot.status.enum';
|
|
5
5
|
export * from './slide-layout.enum';
|
|
6
|
+
export * from './slide-image-slot-action.enum';
|
|
7
|
+
export * from './presentation-ai-action-type.enum';
|
|
8
|
+
export * from './presentation-ai-action-pricing-type.enum';
|
|
9
|
+
export * from './presentation-ai-action-call-status.enum';
|
|
@@ -14,8 +14,6 @@ export enum SUBSCRIPTION_FEATURE_TYPE {
|
|
|
14
14
|
VIDEO_MODEL_ACCESS = 'video_model_access',
|
|
15
15
|
EXTENDED_CONTEXT = 'extended_context',
|
|
16
16
|
PRESENTATION_QUOTA = 'presentation_quota',
|
|
17
|
-
TOKENS = 'tokens',
|
|
18
|
-
CARRYOVER_BALANCE = 'carryover_balance',
|
|
19
17
|
}
|
|
20
18
|
|
|
21
19
|
export enum SUBSCRIPTION_FEATURE_KIND {
|
|
@@ -27,5 +25,4 @@ export enum SUBSCRIPTION_FEATURE_KIND {
|
|
|
27
25
|
PRESENTATIONS = 'presentations',
|
|
28
26
|
VIDEO = 'video',
|
|
29
27
|
PRESENTATION = 'presentation',
|
|
30
|
-
BASE = 'base',
|
|
31
28
|
}
|
package/helpers/index.ts
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PRESENTATION_AI_ACTION_PRICING_TYPE } from '../../constants';
|
|
2
|
+
import { PresentationAiActionPricingRules } from '../../models/tools/presentation';
|
|
3
|
+
|
|
4
|
+
export function calculatePresentationAiActionPrice(
|
|
5
|
+
pricingRules: PresentationAiActionPricingRules,
|
|
6
|
+
selectionText: string,
|
|
7
|
+
): number {
|
|
8
|
+
switch (pricingRules.type) {
|
|
9
|
+
case PRESENTATION_AI_ACTION_PRICING_TYPE.PER_CHARACTER:
|
|
10
|
+
const characterCount = selectionText.length;
|
|
11
|
+
const price = characterCount * pricingRules.price;
|
|
12
|
+
return Math.max(1, Math.ceil(price));
|
|
13
|
+
|
|
14
|
+
case PRESENTATION_AI_ACTION_PRICING_TYPE.FLAT:
|
|
15
|
+
return Math.max(1, Math.ceil(pricingRules.price));
|
|
16
|
+
|
|
17
|
+
default:
|
|
18
|
+
throw new Error(`Unknown pricing type`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './calculate-presentation-ai-action-price.util';
|
package/models/chat.schema.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { CHAT_STATUS_ENUM, TChatStatusEnum } from '../constants';
|
|
3
|
-
import { MessageSchema } from './message.schema';
|
|
4
3
|
|
|
5
4
|
export const ChatSchema = z.object({
|
|
6
5
|
uuid: z.string().uuid(),
|
|
@@ -10,7 +9,6 @@ export const ChatSchema = z.object({
|
|
|
10
9
|
aIModelId: z.string().uuid(),
|
|
11
10
|
title: z.string(),
|
|
12
11
|
chatStatus: z.enum(Object.values(CHAT_STATUS_ENUM) as [TChatStatusEnum]),
|
|
13
|
-
messages: z.array(MessageSchema),
|
|
14
12
|
folderId: z.string().nullable(),
|
|
15
13
|
|
|
16
14
|
createdAt: z.date(),
|
package/models/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './ai-model-formatted.schema';
|
|
|
4
4
|
export * from './ai-model.schema';
|
|
5
5
|
export * from './ai-vendor.schema';
|
|
6
6
|
export * from './category.schema';
|
|
7
|
+
export * from './chat-with-messages.schema';
|
|
7
8
|
export * from './chat.schema';
|
|
8
9
|
export * from './cloud-payments-receipt.schema';
|
|
9
10
|
export * from './course-author.schema';
|
package/models/page.schema.ts
CHANGED
|
@@ -12,8 +12,6 @@ export const PageSchema = z.object({
|
|
|
12
12
|
categoryId: z.string().uuid().nullable().optional(),
|
|
13
13
|
aIModelId: z.string().uuid().nullable().optional(),
|
|
14
14
|
toolId: z.string().uuid().nullable().optional(),
|
|
15
|
-
toolOptionId: z.string().uuid().nullable().optional(),
|
|
16
|
-
toolTitle: z.string().nullable(),
|
|
17
15
|
type: z.nativeEnum(PageType),
|
|
18
16
|
|
|
19
17
|
createdAt: z.date(),
|
|
@@ -12,34 +12,6 @@ export const SubscriptionFeatureBaseSchema = z.object({
|
|
|
12
12
|
});
|
|
13
13
|
export type SubscriptionFeatureBase = z.infer<typeof SubscriptionFeatureBaseSchema>;
|
|
14
14
|
|
|
15
|
-
const SubscriptionFeatureIconsSchema = z.object({
|
|
16
|
-
light: z.object({
|
|
17
|
-
png: z.string(),
|
|
18
|
-
svg: z.string(),
|
|
19
|
-
}),
|
|
20
|
-
dark: z.object({
|
|
21
|
-
png: z.string(),
|
|
22
|
-
svg: z.string(),
|
|
23
|
-
}),
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
export const TokensFeatureSchema = SubscriptionFeatureBaseSchema.extend({
|
|
27
|
-
kind: z.literal(SUBSCRIPTION_FEATURE_KIND.BASE),
|
|
28
|
-
type: z.literal(SUBSCRIPTION_FEATURE_TYPE.TOKENS),
|
|
29
|
-
tokens: z.number(),
|
|
30
|
-
icons: SubscriptionFeatureIconsSchema,
|
|
31
|
-
});
|
|
32
|
-
export type TokensFeature = z.infer<typeof TokensFeatureSchema>;
|
|
33
|
-
|
|
34
|
-
export const CarryoverBalanceFeatureSchema = SubscriptionFeatureBaseSchema.extend({
|
|
35
|
-
kind: z.literal(SUBSCRIPTION_FEATURE_KIND.BASE),
|
|
36
|
-
type: z.literal(SUBSCRIPTION_FEATURE_TYPE.CARRYOVER_BALANCE),
|
|
37
|
-
isAvailable: z.boolean(),
|
|
38
|
-
tooltip: z.string(),
|
|
39
|
-
icons: SubscriptionFeatureIconsSchema,
|
|
40
|
-
});
|
|
41
|
-
export type CarryoverBalanceFeature = z.infer<typeof CarryoverBalanceFeatureSchema>;
|
|
42
|
-
|
|
43
15
|
export const AiModelAccessFeatureSchema = SubscriptionFeatureBaseSchema.extend({
|
|
44
16
|
type: z.literal(SUBSCRIPTION_FEATURE_TYPE.AI_MODEL_ACCESS),
|
|
45
17
|
kind: z.literal(SUBSCRIPTION_FEATURE_KIND.AI_MODEL),
|
|
@@ -162,8 +134,6 @@ export const SubscriptionFeatureSchema = z.union([
|
|
|
162
134
|
VideoModelAccessFeatureSchema,
|
|
163
135
|
ExtendedContextFeatureSchema,
|
|
164
136
|
PresentationQuotaFeatureSchema,
|
|
165
|
-
TokensFeatureSchema,
|
|
166
|
-
CarryoverBalanceFeatureSchema,
|
|
167
137
|
]);
|
|
168
138
|
|
|
169
139
|
export type SubscriptionFeature = z.infer<typeof SubscriptionFeatureSchema>;
|
package/models/tool.schema.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { PageSchema } from './page.schema';
|
|
3
2
|
|
|
4
3
|
export const ToolSchema = z.object({
|
|
5
4
|
uuid: z.string().uuid(),
|
|
@@ -7,16 +6,4 @@ export const ToolSchema = z.object({
|
|
|
7
6
|
description: z.string(),
|
|
8
7
|
icon: z.string(),
|
|
9
8
|
order: z.number(),
|
|
10
|
-
contentType: z.string(),
|
|
11
9
|
});
|
|
12
|
-
|
|
13
|
-
export const ToolFormattedSchema = z.intersection(
|
|
14
|
-
ToolSchema,
|
|
15
|
-
z.object({
|
|
16
|
-
pages: z.array(
|
|
17
|
-
PageSchema.pick({ alias: true, toolTitle: true, toolOptionId: true })
|
|
18
|
-
.optional()
|
|
19
|
-
.nullable(),
|
|
20
|
-
),
|
|
21
|
-
}),
|
|
22
|
-
);
|
package/models/tools/index.ts
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import {
|
|
3
|
+
PRESENTATION_AI_ACTION_PRICING_TYPE,
|
|
4
|
+
PRESENTATION_AI_ACTION_TYPE,
|
|
5
|
+
} from '../../../constants';
|
|
6
|
+
|
|
7
|
+
export const PresentationAiActionPricingRulesSchema = z.discriminatedUnion('type', [
|
|
8
|
+
z.object({
|
|
9
|
+
type: z.literal(PRESENTATION_AI_ACTION_PRICING_TYPE.PER_CHARACTER),
|
|
10
|
+
price: z.number(),
|
|
11
|
+
}),
|
|
12
|
+
z.object({
|
|
13
|
+
type: z.literal(PRESENTATION_AI_ACTION_PRICING_TYPE.FLAT),
|
|
14
|
+
price: z.number(),
|
|
15
|
+
}),
|
|
16
|
+
]);
|
|
17
|
+
export type PresentationAiActionPricingRules = z.infer<
|
|
18
|
+
typeof PresentationAiActionPricingRulesSchema
|
|
19
|
+
>;
|
|
20
|
+
|
|
21
|
+
export const PresentationAiActionSchema = z.object({
|
|
22
|
+
uuid: z.string(),
|
|
23
|
+
type: z.nativeEnum(PRESENTATION_AI_ACTION_TYPE),
|
|
24
|
+
pricingRules: PresentationAiActionPricingRulesSchema,
|
|
25
|
+
maxPromptLength: z.number(),
|
|
26
|
+
aiModel: z.string(),
|
|
27
|
+
title: z.string(),
|
|
28
|
+
icon: z.string(),
|
|
29
|
+
order: z.number(),
|
|
30
|
+
createdAt: z.date(),
|
|
31
|
+
updatedAt: z.date(),
|
|
32
|
+
});
|
|
33
|
+
export type PresentationAiAction = z.infer<typeof PresentationAiActionSchema>;
|
|
@@ -2,16 +2,19 @@ import { z } from 'zod';
|
|
|
2
2
|
import { SlideContentTypeSchema } from './slide-content-type.schema';
|
|
3
3
|
import { LanguageSchema } from '../language';
|
|
4
4
|
import { PresentationTemplateSchema } from './presentation-template.schema';
|
|
5
|
+
import { PresentationAiActionSchema } from './presentation-ai-action.schema';
|
|
5
6
|
|
|
6
7
|
export const PresentationConfigSchema = z.object({
|
|
7
8
|
slideContentTypes: z.array(SlideContentTypeSchema),
|
|
8
9
|
languages: z.array(LanguageSchema),
|
|
9
10
|
templates: z.array(PresentationTemplateSchema),
|
|
11
|
+
aiActions: z.array(PresentationAiActionSchema),
|
|
10
12
|
slideGenerationPrice: z.number(),
|
|
11
13
|
maxSlides: z.number(),
|
|
12
14
|
minSlides: z.number(),
|
|
13
15
|
maxSlideTitleLength: z.number(),
|
|
14
16
|
maxSlideOutlineLength: z.number(),
|
|
15
17
|
maxPromptLength: z.number(),
|
|
18
|
+
imageGenerationPrice: z.number(),
|
|
16
19
|
});
|
|
17
20
|
export type PresentationConfig = z.infer<typeof PresentationConfigSchema>;
|
|
@@ -13,6 +13,8 @@ export const PresentationSchema = z.object({
|
|
|
13
13
|
templateId: z.string(),
|
|
14
14
|
downloadUrl: z.string().nullable(),
|
|
15
15
|
slideCount: z.number(),
|
|
16
|
+
lastContentUpdateAt: z.date().nullable(),
|
|
17
|
+
lastPptxExportedAt: z.date().nullable(),
|
|
16
18
|
createdAt: z.date(),
|
|
17
19
|
updatedAt: z.date(),
|
|
18
20
|
});
|
|
@@ -0,0 +1,154 @@
|
|
|
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
|
+
} from './slide-content.schema';
|
|
16
|
+
import { SLIDE_CONTENT_TYPE } from '../../../constants';
|
|
17
|
+
|
|
18
|
+
export const CoverSlideDataUserEditSchema = z.object({
|
|
19
|
+
contentType: z.literal(SLIDE_CONTENT_TYPE.COVER),
|
|
20
|
+
title: z.string().max(1000),
|
|
21
|
+
author: z.object({
|
|
22
|
+
label: z.string().max(200),
|
|
23
|
+
value: z.string().max(500),
|
|
24
|
+
}),
|
|
25
|
+
date: z.object({
|
|
26
|
+
label: z.string().max(200),
|
|
27
|
+
value: z.string().max(500),
|
|
28
|
+
}),
|
|
29
|
+
email: z.object({
|
|
30
|
+
label: z.string().max(200),
|
|
31
|
+
value: z.string().max(500),
|
|
32
|
+
}),
|
|
33
|
+
version: z.literal(1),
|
|
34
|
+
}) satisfies z.ZodType<ICoverSlideDataStructure>;
|
|
35
|
+
|
|
36
|
+
export const ThankYouSlideDataUserEditSchema = z.object({
|
|
37
|
+
contentType: z.literal(SLIDE_CONTENT_TYPE.THANK_YOU),
|
|
38
|
+
title: z.string().max(1000),
|
|
39
|
+
author: z.object({
|
|
40
|
+
label: z.string().max(200),
|
|
41
|
+
value: z.string().max(500),
|
|
42
|
+
}),
|
|
43
|
+
date: z.object({
|
|
44
|
+
label: z.string().max(200),
|
|
45
|
+
value: z.string().max(500),
|
|
46
|
+
}),
|
|
47
|
+
email: z.object({
|
|
48
|
+
label: z.string().max(200),
|
|
49
|
+
value: z.string().max(500),
|
|
50
|
+
}),
|
|
51
|
+
version: z.literal(1),
|
|
52
|
+
}) satisfies z.ZodType<IThankYouSlideDataStructure>;
|
|
53
|
+
|
|
54
|
+
export const TextSlideDataUserEditSchema = z.object({
|
|
55
|
+
contentType: z.literal(SLIDE_CONTENT_TYPE.TEXT),
|
|
56
|
+
title: z.string().max(1000),
|
|
57
|
+
description: z.string().max(5000),
|
|
58
|
+
version: z.literal(1),
|
|
59
|
+
}) satisfies z.ZodType<ITextSlideDataStructure>;
|
|
60
|
+
|
|
61
|
+
export const StructuredListSlideDataUserEditSchema = z.object({
|
|
62
|
+
contentType: z.literal(SLIDE_CONTENT_TYPE.STRUCTURED_LIST),
|
|
63
|
+
title: z.string().max(1000),
|
|
64
|
+
description: z.string().max(2000),
|
|
65
|
+
list: z
|
|
66
|
+
.array(
|
|
67
|
+
z.object({
|
|
68
|
+
title: z.string().max(500),
|
|
69
|
+
description: z.string().max(1000),
|
|
70
|
+
}),
|
|
71
|
+
)
|
|
72
|
+
.max(15),
|
|
73
|
+
version: z.literal(1),
|
|
74
|
+
}) satisfies z.ZodType<IStructuredListSlideDataStructure>;
|
|
75
|
+
|
|
76
|
+
export const ContentsSlideDataUserEditSchema = z.object({
|
|
77
|
+
contentType: z.literal(SLIDE_CONTENT_TYPE.CONTENTS),
|
|
78
|
+
title: z.string().max(1000),
|
|
79
|
+
items: z
|
|
80
|
+
.array(
|
|
81
|
+
z.object({
|
|
82
|
+
pageNumber: z.number(),
|
|
83
|
+
title: z.string().max(1000),
|
|
84
|
+
}),
|
|
85
|
+
)
|
|
86
|
+
.max(100),
|
|
87
|
+
version: z.literal(1),
|
|
88
|
+
}) satisfies z.ZodType<IContentsSlideDataStructure>;
|
|
89
|
+
|
|
90
|
+
export const ImageSlideDataUserEditSchema = z.object({
|
|
91
|
+
contentType: z.literal(SLIDE_CONTENT_TYPE.TEXT_WITH_IMAGE),
|
|
92
|
+
title: z.string().max(1000),
|
|
93
|
+
description: z.string().max(4000),
|
|
94
|
+
imageSlot: ImageSlotSchema,
|
|
95
|
+
version: z.literal(1),
|
|
96
|
+
}) satisfies z.ZodType<IImageSlideDataStructure>;
|
|
97
|
+
|
|
98
|
+
export const SectionBreakSlideDataUserEditSchema = z.object({
|
|
99
|
+
contentType: z.literal(SLIDE_CONTENT_TYPE.SECTION_BREAK),
|
|
100
|
+
title: z.string().max(1000),
|
|
101
|
+
description: z.string().max(1000),
|
|
102
|
+
version: z.literal(1),
|
|
103
|
+
}) satisfies z.ZodType<ISectionBreakSlideDataStructure>;
|
|
104
|
+
|
|
105
|
+
export const TableSlideDataUserEditSchema = z.object({
|
|
106
|
+
contentType: z.literal(SLIDE_CONTENT_TYPE.TABLE),
|
|
107
|
+
title: z.string().max(1000),
|
|
108
|
+
description: z.string().max(2000),
|
|
109
|
+
table: z.object({
|
|
110
|
+
columnHeaders: z.array(z.string().max(500)).max(30),
|
|
111
|
+
rows: z.array(z.array(z.string().max(1000))).max(50),
|
|
112
|
+
hasRowHeaders: z.boolean(),
|
|
113
|
+
hasSummaryRow: z.boolean(),
|
|
114
|
+
}),
|
|
115
|
+
version: z.literal(1),
|
|
116
|
+
}) satisfies z.ZodType<ITableSlideDataStructure>;
|
|
117
|
+
|
|
118
|
+
export const BarChartSlideDataUserEditSchema = z.object({
|
|
119
|
+
type: z.literal(SLIDE_CHART_TYPE.BAR),
|
|
120
|
+
categories: z.array(z.string().max(500)).max(100),
|
|
121
|
+
series: z
|
|
122
|
+
.array(
|
|
123
|
+
z.object({
|
|
124
|
+
name: z.string().max(500),
|
|
125
|
+
data: z.array(z.number()),
|
|
126
|
+
type: z.number().min(0).max(11),
|
|
127
|
+
}),
|
|
128
|
+
)
|
|
129
|
+
.max(10),
|
|
130
|
+
yAxisLabel: z.string().max(500).optional(),
|
|
131
|
+
unit: z.string().max(100).optional(),
|
|
132
|
+
version: z.literal(1),
|
|
133
|
+
}) satisfies z.ZodType<IBarChartSlideDataStructure>;
|
|
134
|
+
|
|
135
|
+
export const ChartSlideDataUserEditSchema = z.object({
|
|
136
|
+
contentType: z.literal(SLIDE_CONTENT_TYPE.CHART),
|
|
137
|
+
title: z.string().max(1000),
|
|
138
|
+
description: z.string().max(4000),
|
|
139
|
+
chart: z.discriminatedUnion('type', [BarChartSlideDataUserEditSchema]),
|
|
140
|
+
version: z.literal(1),
|
|
141
|
+
}) satisfies z.ZodType<IChartSlideDataStructure>;
|
|
142
|
+
|
|
143
|
+
export const SlideContentUserEditSchema = z.discriminatedUnion('contentType', [
|
|
144
|
+
CoverSlideDataUserEditSchema,
|
|
145
|
+
StructuredListSlideDataUserEditSchema,
|
|
146
|
+
TextSlideDataUserEditSchema,
|
|
147
|
+
ContentsSlideDataUserEditSchema,
|
|
148
|
+
SectionBreakSlideDataUserEditSchema,
|
|
149
|
+
ImageSlideDataUserEditSchema,
|
|
150
|
+
ThankYouSlideDataUserEditSchema,
|
|
151
|
+
TableSlideDataUserEditSchema,
|
|
152
|
+
ChartSlideDataUserEditSchema,
|
|
153
|
+
]);
|
|
154
|
+
export type SlideContentUserEdit = z.infer<typeof SlideContentUserEditSchema>;
|