@purpleschool/gptbot 0.5.16 → 0.5.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/api/controllers/course.ts +6 -0
- package/api/controllers/index.ts +1 -0
- package/build/api/controllers/course.js +8 -0
- package/build/api/controllers/index.js +1 -0
- package/build/commands/course/create-course.command.js +16 -0
- package/build/commands/course/find-course-by-alias.command.js +14 -0
- package/build/commands/course/find-course-by-uuid.command.js +14 -0
- package/build/commands/course/index.js +19 -0
- package/build/commands/index.js +1 -0
- package/build/commands/user-to-subscription/get-user-to-subscriptions.command.js +1 -1
- package/build/constants/course/enums/course-status.enum.js +8 -0
- package/build/constants/course/enums/index.js +17 -0
- package/build/constants/course/index.js +17 -0
- package/build/constants/errors/errors.js +5 -0
- package/build/constants/index.js +1 -0
- package/build/models/course-author.schema.js +9 -0
- package/build/models/course.schema.js +24 -0
- package/build/models/index.js +4 -0
- package/build/models/lesson.schema.js +14 -0
- package/build/models/section.schema.js +17 -0
- package/build/models/user-to-subscription.schema.js +5 -1
- package/commands/course/create-course.command.ts +18 -0
- package/commands/course/find-course-by-alias.command.ts +16 -0
- package/commands/course/find-course-by-uuid.command.ts +16 -0
- package/commands/course/index.ts +3 -0
- package/commands/index.ts +1 -0
- package/commands/user-to-subscription/get-user-to-subscriptions.command.ts +2 -2
- package/constants/course/enums/course-status.enum.ts +4 -0
- package/constants/course/enums/index.ts +1 -0
- package/constants/course/index.ts +1 -0
- package/constants/errors/errors.ts +5 -0
- package/constants/index.ts +1 -0
- package/models/course-author.schema.ts +7 -0
- package/models/course.schema.ts +27 -0
- package/models/index.ts +4 -0
- package/models/lesson.schema.ts +13 -0
- package/models/section.schema.ts +20 -0
- package/models/user-to-subscription.schema.ts +8 -0
- package/package.json +1 -1
package/api/controllers/index.ts
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.COURSE_ROUTES = exports.COURSE_CONTROLLER = void 0;
|
|
4
|
+
exports.COURSE_CONTROLLER = 'course';
|
|
5
|
+
exports.COURSE_ROUTES = {
|
|
6
|
+
FIND_BY_UUID: 'by/uuid',
|
|
7
|
+
FIND_BY_ALIAS: 'by/alias',
|
|
8
|
+
};
|
|
@@ -21,6 +21,7 @@ __exportStar(require("./category"), exports);
|
|
|
21
21
|
__exportStar(require("./chat-private"), exports);
|
|
22
22
|
__exportStar(require("./chat-public"), exports);
|
|
23
23
|
__exportStar(require("./cloud-payments"), exports);
|
|
24
|
+
__exportStar(require("./course"), exports);
|
|
24
25
|
__exportStar(require("./files"), exports);
|
|
25
26
|
__exportStar(require("./referral"), exports);
|
|
26
27
|
__exportStar(require("./message"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateCourseCommand = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
var CreateCourseCommand;
|
|
7
|
+
(function (CreateCourseCommand) {
|
|
8
|
+
CreateCourseCommand.RequestSchema = models_1.CourseSchema.omit({
|
|
9
|
+
uuid: true,
|
|
10
|
+
createdAt: true,
|
|
11
|
+
updatedAt: true,
|
|
12
|
+
});
|
|
13
|
+
CreateCourseCommand.ResponseSchema = zod_1.z.object({
|
|
14
|
+
data: models_1.CourseSchema,
|
|
15
|
+
});
|
|
16
|
+
})(CreateCourseCommand || (exports.CreateCourseCommand = CreateCourseCommand = {}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FindCourseByAliasCommand = void 0;
|
|
4
|
+
const models_1 = require("../../models");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
var FindCourseByAliasCommand;
|
|
7
|
+
(function (FindCourseByAliasCommand) {
|
|
8
|
+
FindCourseByAliasCommand.RequestSchema = models_1.CourseSchema.pick({
|
|
9
|
+
alias: true,
|
|
10
|
+
});
|
|
11
|
+
FindCourseByAliasCommand.ResponseSchema = zod_1.z.object({
|
|
12
|
+
data: models_1.CourseWithSectionsSchema,
|
|
13
|
+
});
|
|
14
|
+
})(FindCourseByAliasCommand || (exports.FindCourseByAliasCommand = FindCourseByAliasCommand = {}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FindCourseByUUIDCommand = void 0;
|
|
4
|
+
const models_1 = require("../../models");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
var FindCourseByUUIDCommand;
|
|
7
|
+
(function (FindCourseByUUIDCommand) {
|
|
8
|
+
FindCourseByUUIDCommand.RequestSchema = models_1.CourseSchema.pick({
|
|
9
|
+
uuid: true,
|
|
10
|
+
});
|
|
11
|
+
FindCourseByUUIDCommand.ResponseSchema = zod_1.z.object({
|
|
12
|
+
data: models_1.CourseWithSectionsSchema,
|
|
13
|
+
});
|
|
14
|
+
})(FindCourseByUUIDCommand || (exports.FindCourseByUUIDCommand = FindCourseByUUIDCommand = {}));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./create-course.command"), exports);
|
|
18
|
+
__exportStar(require("./find-course-by-alias.command"), exports);
|
|
19
|
+
__exportStar(require("./find-course-by-uuid.command"), exports);
|
package/build/commands/index.js
CHANGED
|
@@ -19,6 +19,7 @@ __exportStar(require("./auth"), exports);
|
|
|
19
19
|
__exportStar(require("./blog"), exports);
|
|
20
20
|
__exportStar(require("./category"), exports);
|
|
21
21
|
__exportStar(require("./chat"), exports);
|
|
22
|
+
__exportStar(require("./course"), exports);
|
|
22
23
|
__exportStar(require("./message"), exports);
|
|
23
24
|
__exportStar(require("./page"), exports);
|
|
24
25
|
__exportStar(require("./payment"), exports);
|
|
@@ -6,6 +6,6 @@ const models_1 = require("../../models");
|
|
|
6
6
|
var GetUserToSubscriptionsCommand;
|
|
7
7
|
(function (GetUserToSubscriptionsCommand) {
|
|
8
8
|
GetUserToSubscriptionsCommand.ResponseSchema = zod_1.z.object({
|
|
9
|
-
data: zod_1.z.array(models_1.
|
|
9
|
+
data: zod_1.z.array(models_1.UserToSubscriptionWithSubscriptionSchema),
|
|
10
10
|
});
|
|
11
11
|
})(GetUserToSubscriptionsCommand || (exports.GetUserToSubscriptionsCommand = GetUserToSubscriptionsCommand = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CourseStatus = void 0;
|
|
4
|
+
var CourseStatus;
|
|
5
|
+
(function (CourseStatus) {
|
|
6
|
+
CourseStatus["DRAFT"] = "draft";
|
|
7
|
+
CourseStatus["PUBLISHED"] = "published";
|
|
8
|
+
})(CourseStatus || (exports.CourseStatus = CourseStatus = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./course-status.enum"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./enums"), exports);
|
package/build/constants/index.js
CHANGED
|
@@ -18,6 +18,7 @@ __exportStar(require("./ai-model"), exports);
|
|
|
18
18
|
__exportStar(require("./category"), exports);
|
|
19
19
|
__exportStar(require("./chat"), exports);
|
|
20
20
|
__exportStar(require("./cloud-payments"), exports);
|
|
21
|
+
__exportStar(require("./course"), exports);
|
|
21
22
|
__exportStar(require("./domains"), exports);
|
|
22
23
|
__exportStar(require("./email"), exports);
|
|
23
24
|
__exportStar(require("./errors"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CourseAuthorSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.CourseAuthorSchema = zod_1.z.object({
|
|
6
|
+
name: zod_1.z.string(),
|
|
7
|
+
avatar: zod_1.z.string(),
|
|
8
|
+
bio: zod_1.z.string(),
|
|
9
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CourseWithSectionsSchema = exports.CourseSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
const course_author_schema_1 = require("./course-author.schema");
|
|
7
|
+
const section_schema_1 = require("./section.schema");
|
|
8
|
+
exports.CourseSchema = zod_1.z.object({
|
|
9
|
+
uuid: zod_1.z.string().uuid(),
|
|
10
|
+
title: zod_1.z.string(),
|
|
11
|
+
subtitle: zod_1.z.string(),
|
|
12
|
+
alias: zod_1.z.string(),
|
|
13
|
+
author: course_author_schema_1.CourseAuthorSchema,
|
|
14
|
+
prerequisites: zod_1.z.string(),
|
|
15
|
+
videoId: zod_1.z.string(),
|
|
16
|
+
status: zod_1.z.nativeEnum(constants_1.CourseStatus),
|
|
17
|
+
skills: zod_1.z.array(zod_1.z.string()),
|
|
18
|
+
description: zod_1.z.string(),
|
|
19
|
+
createdAt: zod_1.z.date(),
|
|
20
|
+
updatedAt: zod_1.z.date(),
|
|
21
|
+
});
|
|
22
|
+
exports.CourseWithSectionsSchema = zod_1.z.intersection(exports.CourseSchema, zod_1.z.object({
|
|
23
|
+
sections: zod_1.z.array(section_schema_1.SectionWithLessonsSchema),
|
|
24
|
+
}));
|
package/build/models/index.js
CHANGED
|
@@ -17,6 +17,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./ai-model.schema"), exports);
|
|
18
18
|
__exportStar(require("./category.schema"), exports);
|
|
19
19
|
__exportStar(require("./chat.schema"), exports);
|
|
20
|
+
__exportStar(require("./course-author.schema"), exports);
|
|
21
|
+
__exportStar(require("./course.schema"), exports);
|
|
22
|
+
__exportStar(require("./lesson.schema"), exports);
|
|
20
23
|
__exportStar(require("./message.schema"), exports);
|
|
21
24
|
__exportStar(require("./order.schema"), exports);
|
|
22
25
|
__exportStar(require("./page.schema"), exports);
|
|
@@ -26,6 +29,7 @@ __exportStar(require("./post.schema"), exports);
|
|
|
26
29
|
__exportStar(require("./product.schema"), exports);
|
|
27
30
|
__exportStar(require("./question.schema"), exports);
|
|
28
31
|
__exportStar(require("./referral-bonus.schema"), exports);
|
|
32
|
+
__exportStar(require("./section.schema"), exports);
|
|
29
33
|
__exportStar(require("./subscription-upgrade-schema"), exports);
|
|
30
34
|
__exportStar(require("./subscription.schema"), exports);
|
|
31
35
|
__exportStar(require("./unregistered-user.schema"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LessonSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.LessonSchema = zod_1.z.object({
|
|
6
|
+
uuid: zod_1.z.string().uuid(),
|
|
7
|
+
sectionId: zod_1.z.string().uuid(),
|
|
8
|
+
title: zod_1.z.string(),
|
|
9
|
+
length: zod_1.z.number(),
|
|
10
|
+
videoId: zod_1.z.string(),
|
|
11
|
+
order: zod_1.z.number(),
|
|
12
|
+
createdAt: zod_1.z.date(),
|
|
13
|
+
updatedAt: zod_1.z.date(),
|
|
14
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SectionWithLessonsSchema = exports.SectionSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const lesson_schema_1 = require("./lesson.schema");
|
|
6
|
+
exports.SectionSchema = zod_1.z.object({
|
|
7
|
+
uuid: zod_1.z.string().uuid(),
|
|
8
|
+
courseId: zod_1.z.string().uuid(),
|
|
9
|
+
title: zod_1.z.string(),
|
|
10
|
+
length: zod_1.z.number(),
|
|
11
|
+
order: zod_1.z.number(),
|
|
12
|
+
createdAt: zod_1.z.date(),
|
|
13
|
+
updatedAt: zod_1.z.date(),
|
|
14
|
+
});
|
|
15
|
+
exports.SectionWithLessonsSchema = zod_1.z.intersection(exports.SectionSchema, zod_1.z.object({
|
|
16
|
+
lessons: zod_1.z.array(lesson_schema_1.LessonSchema),
|
|
17
|
+
}));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UserToSubscriptionSchema = void 0;
|
|
3
|
+
exports.UserToSubscriptionWithSubscriptionSchema = exports.UserToSubscriptionSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const subscription_schema_1 = require("./subscription.schema");
|
|
5
6
|
exports.UserToSubscriptionSchema = zod_1.z.object({
|
|
6
7
|
uuid: zod_1.z.string().uuid(),
|
|
7
8
|
userId: zod_1.z.string().uuid(),
|
|
@@ -15,3 +16,6 @@ exports.UserToSubscriptionSchema = zod_1.z.object({
|
|
|
15
16
|
createdAt: zod_1.z.date(),
|
|
16
17
|
updatedAt: zod_1.z.date(),
|
|
17
18
|
});
|
|
19
|
+
exports.UserToSubscriptionWithSubscriptionSchema = zod_1.z.intersection(exports.UserToSubscriptionSchema, zod_1.z.object({
|
|
20
|
+
subscription: subscription_schema_1.SubscriptionSchema,
|
|
21
|
+
}));
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CourseSchema } from '../../models';
|
|
3
|
+
|
|
4
|
+
export namespace CreateCourseCommand {
|
|
5
|
+
export const RequestSchema = CourseSchema.omit({
|
|
6
|
+
uuid: true,
|
|
7
|
+
createdAt: true,
|
|
8
|
+
updatedAt: true,
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
12
|
+
|
|
13
|
+
export const ResponseSchema = z.object({
|
|
14
|
+
data: CourseSchema,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CourseSchema, CourseWithSectionsSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace FindCourseByAliasCommand {
|
|
5
|
+
export const RequestSchema = CourseSchema.pick({
|
|
6
|
+
alias: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: CourseWithSectionsSchema,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CourseSchema, CourseWithSectionsSchema } from '../../models';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
export namespace FindCourseByUUIDCommand {
|
|
5
|
+
export const RequestSchema = CourseSchema.pick({
|
|
6
|
+
uuid: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Request = z.infer<typeof RequestSchema>;
|
|
10
|
+
|
|
11
|
+
export const ResponseSchema = z.object({
|
|
12
|
+
data: CourseWithSectionsSchema,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type Response = z.infer<typeof ResponseSchema>;
|
|
16
|
+
}
|
package/commands/index.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import {
|
|
2
|
+
import { UserToSubscriptionWithSubscriptionSchema } from '../../models';
|
|
3
3
|
|
|
4
4
|
export namespace GetUserToSubscriptionsCommand {
|
|
5
5
|
export const ResponseSchema = z.object({
|
|
6
|
-
data: z.array(
|
|
6
|
+
data: z.array(UserToSubscriptionWithSubscriptionSchema),
|
|
7
7
|
});
|
|
8
8
|
|
|
9
9
|
export type Response = z.infer<typeof ResponseSchema>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './course-status.enum';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './enums';
|
package/constants/index.ts
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CourseStatus } from '../constants';
|
|
3
|
+
import { CourseAuthorSchema } from './course-author.schema';
|
|
4
|
+
import { SectionWithLessonsSchema } from './section.schema';
|
|
5
|
+
|
|
6
|
+
export const CourseSchema = z.object({
|
|
7
|
+
uuid: z.string().uuid(),
|
|
8
|
+
title: z.string(),
|
|
9
|
+
subtitle: z.string(),
|
|
10
|
+
alias: z.string(),
|
|
11
|
+
author: CourseAuthorSchema,
|
|
12
|
+
prerequisites: z.string(),
|
|
13
|
+
videoId: z.string(),
|
|
14
|
+
status: z.nativeEnum(CourseStatus),
|
|
15
|
+
skills: z.array(z.string()),
|
|
16
|
+
description: z.string(),
|
|
17
|
+
|
|
18
|
+
createdAt: z.date(),
|
|
19
|
+
updatedAt: z.date(),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const CourseWithSectionsSchema = z.intersection(
|
|
23
|
+
CourseSchema,
|
|
24
|
+
z.object({
|
|
25
|
+
sections: z.array(SectionWithLessonsSchema),
|
|
26
|
+
}),
|
|
27
|
+
);
|
package/models/index.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export * from './ai-model.schema';
|
|
2
2
|
export * from './category.schema';
|
|
3
3
|
export * from './chat.schema';
|
|
4
|
+
export * from './course-author.schema';
|
|
5
|
+
export * from './course.schema';
|
|
6
|
+
export * from './lesson.schema';
|
|
4
7
|
export * from './message.schema';
|
|
5
8
|
export * from './order.schema';
|
|
6
9
|
export * from './page.schema';
|
|
@@ -10,6 +13,7 @@ export * from './post.schema';
|
|
|
10
13
|
export * from './product.schema';
|
|
11
14
|
export * from './question.schema';
|
|
12
15
|
export * from './referral-bonus.schema';
|
|
16
|
+
export * from './section.schema';
|
|
13
17
|
export * from './subscription-upgrade-schema';
|
|
14
18
|
export * from './subscription.schema';
|
|
15
19
|
export * from './unregistered-user.schema';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const LessonSchema = z.object({
|
|
4
|
+
uuid: z.string().uuid(),
|
|
5
|
+
sectionId: z.string().uuid(),
|
|
6
|
+
title: z.string(),
|
|
7
|
+
length: z.number(),
|
|
8
|
+
videoId: z.string(),
|
|
9
|
+
order: z.number(),
|
|
10
|
+
|
|
11
|
+
createdAt: z.date(),
|
|
12
|
+
updatedAt: z.date(),
|
|
13
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { LessonSchema } from './lesson.schema';
|
|
3
|
+
|
|
4
|
+
export const SectionSchema = z.object({
|
|
5
|
+
uuid: z.string().uuid(),
|
|
6
|
+
courseId: z.string().uuid(),
|
|
7
|
+
title: z.string(),
|
|
8
|
+
length: z.number(),
|
|
9
|
+
order: z.number(),
|
|
10
|
+
|
|
11
|
+
createdAt: z.date(),
|
|
12
|
+
updatedAt: z.date(),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const SectionWithLessonsSchema = z.intersection(
|
|
16
|
+
SectionSchema,
|
|
17
|
+
z.object({
|
|
18
|
+
lessons: z.array(LessonSchema),
|
|
19
|
+
}),
|
|
20
|
+
);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { SubscriptionSchema } from './subscription.schema';
|
|
2
3
|
|
|
3
4
|
export const UserToSubscriptionSchema = z.object({
|
|
4
5
|
uuid: z.string().uuid(),
|
|
@@ -13,3 +14,10 @@ export const UserToSubscriptionSchema = z.object({
|
|
|
13
14
|
createdAt: z.date(),
|
|
14
15
|
updatedAt: z.date(),
|
|
15
16
|
});
|
|
17
|
+
|
|
18
|
+
export const UserToSubscriptionWithSubscriptionSchema = z.intersection(
|
|
19
|
+
UserToSubscriptionSchema,
|
|
20
|
+
z.object({
|
|
21
|
+
subscription: SubscriptionSchema,
|
|
22
|
+
}),
|
|
23
|
+
);
|