@common_ch/common 1.0.176 → 1.0.182
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/build/enums/admin.d.ts +4 -0
- package/build/enums/admin.js +8 -0
- package/build/enums/ai.d.ts +22 -0
- package/build/enums/ai.js +28 -0
- package/build/enums/blog.d.ts +4 -0
- package/build/enums/blog.js +8 -0
- package/build/enums/category.d.ts +4 -0
- package/build/enums/category.js +8 -0
- package/build/enums/discount.d.ts +8 -0
- package/build/enums/discount.js +13 -0
- package/build/enums/image.d.ts +5 -0
- package/build/enums/image.js +9 -0
- package/build/enums/message.d.ts +5 -0
- package/build/enums/message.js +9 -0
- package/build/enums/org.d.ts +4 -0
- package/build/enums/org.js +8 -0
- package/build/enums/plan.d.ts +8 -0
- package/build/enums/plan.js +13 -0
- package/build/enums/ticket.d.ts +15 -0
- package/build/enums/ticket.js +21 -0
- package/build/enums/transaction.d.ts +6 -0
- package/build/enums/transaction.js +10 -0
- package/build/enums/user.d.ts +4 -0
- package/build/enums/user.js +8 -0
- package/build/enums/voice.d.ts +4 -0
- package/build/enums/voice.js +8 -0
- package/build/events/app/ticket/ticket-created-event.d.ts +1 -12
- package/build/events/app/ticket/ticket-created-event.js +0 -14
- package/build/events/app/ticket/ticket-done-by-user.d.ts +1 -1
- package/build/events/app/ticket/ticket-response-by-user.d.ts +1 -2
- package/build/events/app/transaction/create-transaction.d.ts +1 -1
- package/build/events/order/transaction/transaction-verify-event.d.ts +1 -1
- package/build/events/portal/admin/admin-change-status-event.d.ts +1 -4
- package/build/events/portal/admin/admin-change-status-event.js +0 -6
- package/build/events/portal/ai-option/ai-created-event.d.ts +1 -22
- package/build/events/portal/ai-option/ai-created-event.js +0 -26
- package/build/events/portal/ai-option/ai-option-changeStatus-event.d.ts +1 -1
- package/build/events/portal/blog/blog-change-status-event.d.ts +1 -1
- package/build/events/portal/blog/blog-create-event.d.ts +1 -4
- package/build/events/portal/blog/blog-create-event.js +0 -6
- package/build/events/portal/blog-category/blog-category-change-status-event.d.ts +1 -1
- package/build/events/portal/discount/discount-change-status-event.d.ts +1 -1
- package/build/events/portal/discount/discount-create-event.d.ts +1 -8
- package/build/events/portal/discount/discount-create-event.js +0 -11
- package/build/events/portal/discount/discount-update-event.d.ts +1 -1
- package/build/events/portal/org/org-change-status-event.d.ts +1 -4
- package/build/events/portal/org/org-change-status-event.js +0 -6
- package/build/events/portal/plan/plan-change-status-event.d.ts +1 -1
- package/build/events/portal/plan/plan-create-event.d.ts +1 -1
- package/build/events/portal/plan/plan-update-event.d.ts +1 -1
- package/build/events/portal/plan-org/plan-org-change-status-event.d.ts +1 -0
- package/build/events/portal/plan-org/plan-org-create-event.d.ts +2 -1
- package/build/events/portal/plan-org/plan-org-update-event.d.ts +2 -1
- package/build/events/portal/ticket/ticket-answered-event.ts.d.ts +1 -2
- package/build/events/portal/user/user-change-status-event.d.ts +1 -4
- package/build/events/portal/user/user-change-status-event.js +0 -6
- package/build/index.d.ts +2 -0
- package/build/index.js +2 -0
- package/build/middlewares/current-admin-org.d.ts +16 -0
- package/build/middlewares/current-admin-org.js +21 -0
- package/build/middlewares/require-auth-admin-org.d.ts +2 -0
- package/build/middlewares/require-auth-admin-org.js +11 -0
- package/build/models/app/ai-option.d.ts +1 -1
- package/build/models/app/ai-option.js +5 -5
- package/build/models/app/blog-category.d.ts +1 -4
- package/build/models/app/blog-category.js +4 -8
- package/build/models/app/blog.d.ts +1 -1
- package/build/models/app/blog.js +3 -3
- package/build/models/app/discount.d.ts +1 -1
- package/build/models/app/discount.js +4 -4
- package/build/models/app/image.d.ts +1 -5
- package/build/models/app/image.js +3 -8
- package/build/models/app/message.d.ts +1 -5
- package/build/models/app/message.js +3 -8
- package/build/models/app/plan.d.ts +1 -8
- package/build/models/app/plan.js +6 -15
- package/build/models/app/ticket.d.ts +1 -5
- package/build/models/app/ticket.js +7 -12
- package/build/models/app/transaction.d.ts +1 -6
- package/build/models/app/transaction.js +4 -10
- package/build/models/app/user.d.ts +2 -5
- package/build/models/app/user.js +4 -8
- package/build/models/app/voice.d.ts +1 -4
- package/build/models/app/voice.js +3 -7
- package/package.json +1 -1
|
@@ -1,8 +1,5 @@
|
|
|
1
|
+
import { UserStatusEnum } from "../../../enums/user";
|
|
1
2
|
import { Subjects } from "../../subjects";
|
|
2
|
-
export declare enum UserStatusEnum {
|
|
3
|
-
active = "active",
|
|
4
|
-
deactive = "deactive"
|
|
5
|
-
}
|
|
6
3
|
export interface UserChangedStatusInPortalEvent {
|
|
7
4
|
subject: Subjects.UserChangedStatusInPortal;
|
|
8
5
|
data: {
|
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UserStatusEnum = void 0;
|
|
4
|
-
var UserStatusEnum;
|
|
5
|
-
(function (UserStatusEnum) {
|
|
6
|
-
UserStatusEnum["active"] = "active";
|
|
7
|
-
UserStatusEnum["deactive"] = "deactive";
|
|
8
|
-
})(UserStatusEnum || (exports.UserStatusEnum = UserStatusEnum = {}));
|
package/build/index.d.ts
CHANGED
|
@@ -9,6 +9,8 @@ export * from './middlewares/current-admin';
|
|
|
9
9
|
export * from './middlewares/error-handler';
|
|
10
10
|
export * from './middlewares/require-auth';
|
|
11
11
|
export * from './middlewares/require-auth-admin';
|
|
12
|
+
export * from './middlewares/current-admin-org';
|
|
13
|
+
export * from './middlewares/require-auth-admin-org';
|
|
12
14
|
export * from './events/base-listener';
|
|
13
15
|
export * from './events/base-publisher';
|
|
14
16
|
export * from './events/subjects';
|
package/build/index.js
CHANGED
|
@@ -25,6 +25,8 @@ __exportStar(require("./middlewares/current-admin"), exports);
|
|
|
25
25
|
__exportStar(require("./middlewares/error-handler"), exports);
|
|
26
26
|
__exportStar(require("./middlewares/require-auth"), exports);
|
|
27
27
|
__exportStar(require("./middlewares/require-auth-admin"), exports);
|
|
28
|
+
__exportStar(require("./middlewares/current-admin-org"), exports);
|
|
29
|
+
__exportStar(require("./middlewares/require-auth-admin-org"), exports);
|
|
28
30
|
// export * from './models/app/ai';
|
|
29
31
|
// export * from './models/app/blog';
|
|
30
32
|
// export * from './models/app/discount';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Request, Response, NextFunction } from 'express';
|
|
2
|
+
interface AdminOrgPayload {
|
|
3
|
+
_id: string;
|
|
4
|
+
email: string;
|
|
5
|
+
username: string;
|
|
6
|
+
mobile: string;
|
|
7
|
+
}
|
|
8
|
+
declare global {
|
|
9
|
+
namespace Express {
|
|
10
|
+
interface Request {
|
|
11
|
+
currentAdminOrg?: AdminOrgPayload;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export declare const currentAdminOrg: (req: Request, res: Response, next: NextFunction) => void;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.currentAdminOrg = void 0;
|
|
7
|
+
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
8
|
+
const currentAdminOrg = (req, res, next) => {
|
|
9
|
+
const authHeader = req.headers['authorization'];
|
|
10
|
+
if (!authHeader || !authHeader.startsWith('Bearer')) {
|
|
11
|
+
return next();
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
const token = authHeader.split(' ')[1];
|
|
15
|
+
const payload = jsonwebtoken_1.default.verify(token, process.env.JWT_KEY_ADMIN_ORG);
|
|
16
|
+
req.currentAdminOrg = payload;
|
|
17
|
+
}
|
|
18
|
+
catch (err) { }
|
|
19
|
+
next();
|
|
20
|
+
};
|
|
21
|
+
exports.currentAdminOrg = currentAdminOrg;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.requireAuthAdminOrg = void 0;
|
|
4
|
+
const not_authorized_error_1 = require("../errors/not-authorized-error");
|
|
5
|
+
const requireAuthAdminOrg = (req, res, next) => {
|
|
6
|
+
if (!req.currentAdminOrg) {
|
|
7
|
+
throw new not_authorized_error_1.NotAuthorizedError();
|
|
8
|
+
}
|
|
9
|
+
next();
|
|
10
|
+
};
|
|
11
|
+
exports.requireAuthAdminOrg = requireAuthAdminOrg;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import mongoose from 'mongoose';
|
|
2
|
-
import { AiOptionFieldEnum, AiOptionStatusEnum } from '../../
|
|
2
|
+
import { AiOptionFieldEnum, AiOptionStatusEnum } from '../../enums/ai';
|
|
3
3
|
export interface AiOptionAttrs {
|
|
4
4
|
_id: string;
|
|
5
5
|
name: string;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.AiOption = void 0;
|
|
7
7
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
8
|
const mongoose_update_if_current_1 = require("mongoose-update-if-current");
|
|
9
|
-
const
|
|
9
|
+
const ai_1 = require("../../enums/ai");
|
|
10
10
|
const aiOptionSchema = new mongoose_1.default.Schema({
|
|
11
11
|
name: {
|
|
12
12
|
type: String,
|
|
@@ -14,13 +14,13 @@ const aiOptionSchema = new mongoose_1.default.Schema({
|
|
|
14
14
|
},
|
|
15
15
|
status: {
|
|
16
16
|
type: String,
|
|
17
|
-
enum:
|
|
18
|
-
default:
|
|
17
|
+
enum: ai_1.AiOptionStatusEnum,
|
|
18
|
+
default: ai_1.AiOptionStatusEnum.active,
|
|
19
19
|
},
|
|
20
20
|
field: {
|
|
21
21
|
type: String,
|
|
22
|
-
enum:
|
|
23
|
-
default:
|
|
22
|
+
enum: ai_1.AiOptionFieldEnum,
|
|
23
|
+
default: ai_1.AiOptionFieldEnum.chat,
|
|
24
24
|
},
|
|
25
25
|
aiId: {
|
|
26
26
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import mongoose from 'mongoose';
|
|
2
|
-
|
|
3
|
-
active = "active",
|
|
4
|
-
deactive = "deactive"
|
|
5
|
-
}
|
|
2
|
+
import { BlogCategoryStatusEnum } from '../../enums/category';
|
|
6
3
|
export interface BlogCategoryAttrs {
|
|
7
4
|
_id: string;
|
|
8
5
|
title: string;
|
|
@@ -3,14 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.BlogCategory =
|
|
6
|
+
exports.BlogCategory = void 0;
|
|
7
7
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
8
|
const mongoose_update_if_current_1 = require("mongoose-update-if-current");
|
|
9
|
-
|
|
10
|
-
(function (BlogCategoryStatusEnum) {
|
|
11
|
-
BlogCategoryStatusEnum["active"] = "active";
|
|
12
|
-
BlogCategoryStatusEnum["deactive"] = "deactive";
|
|
13
|
-
})(BlogCategoryStatusEnum || (exports.BlogCategoryStatusEnum = BlogCategoryStatusEnum = {}));
|
|
9
|
+
const category_1 = require("../../enums/category");
|
|
14
10
|
const blogCategorySchema = new mongoose_1.default.Schema({
|
|
15
11
|
title: {
|
|
16
12
|
type: String,
|
|
@@ -22,8 +18,8 @@ const blogCategorySchema = new mongoose_1.default.Schema({
|
|
|
22
18
|
},
|
|
23
19
|
status: {
|
|
24
20
|
type: String,
|
|
25
|
-
enum: BlogCategoryStatusEnum,
|
|
26
|
-
default: BlogCategoryStatusEnum.active,
|
|
21
|
+
enum: category_1.BlogCategoryStatusEnum,
|
|
22
|
+
default: category_1.BlogCategoryStatusEnum.active,
|
|
27
23
|
},
|
|
28
24
|
createdAt: {
|
|
29
25
|
type: mongoose_1.default.Schema.Types.Date,
|
package/build/models/app/blog.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.Blog = void 0;
|
|
7
7
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
8
|
const mongoose_update_if_current_1 = require("mongoose-update-if-current");
|
|
9
|
-
const
|
|
9
|
+
const blog_1 = require("../../enums/blog");
|
|
10
10
|
const blogSchema = new mongoose_1.default.Schema({
|
|
11
11
|
title: {
|
|
12
12
|
type: String,
|
|
@@ -44,8 +44,8 @@ const blogSchema = new mongoose_1.default.Schema({
|
|
|
44
44
|
],
|
|
45
45
|
status: {
|
|
46
46
|
type: String,
|
|
47
|
-
enum:
|
|
48
|
-
default:
|
|
47
|
+
enum: blog_1.BlogStatusEnum,
|
|
48
|
+
default: blog_1.BlogStatusEnum.active,
|
|
49
49
|
},
|
|
50
50
|
createdAt: {
|
|
51
51
|
type: mongoose_1.default.Schema.Types.Date,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import mongoose from 'mongoose';
|
|
2
2
|
import { UserDoc } from './user';
|
|
3
3
|
import { PlanDoc } from './plan';
|
|
4
|
-
import { DiscountStatusEnum, DiscountType } from '../../
|
|
4
|
+
import { DiscountStatusEnum, DiscountType } from '../../enums/discount';
|
|
5
5
|
export interface DiscountAttrs {
|
|
6
6
|
_id: string;
|
|
7
7
|
title: string;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.Discount = void 0;
|
|
7
7
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
8
|
const mongoose_update_if_current_1 = require("mongoose-update-if-current");
|
|
9
|
-
const
|
|
9
|
+
const discount_1 = require("../../enums/discount");
|
|
10
10
|
const discountSchema = new mongoose_1.default.Schema({
|
|
11
11
|
title: {
|
|
12
12
|
type: String,
|
|
@@ -14,7 +14,7 @@ const discountSchema = new mongoose_1.default.Schema({
|
|
|
14
14
|
},
|
|
15
15
|
type: {
|
|
16
16
|
type: String,
|
|
17
|
-
enum:
|
|
17
|
+
enum: discount_1.DiscountType,
|
|
18
18
|
required: true,
|
|
19
19
|
},
|
|
20
20
|
amount: {
|
|
@@ -33,8 +33,8 @@ const discountSchema = new mongoose_1.default.Schema({
|
|
|
33
33
|
},
|
|
34
34
|
status: {
|
|
35
35
|
type: String,
|
|
36
|
-
enum:
|
|
37
|
-
default:
|
|
36
|
+
enum: discount_1.DiscountStatusEnum,
|
|
37
|
+
default: discount_1.DiscountStatusEnum.active,
|
|
38
38
|
},
|
|
39
39
|
users: [{ type: mongoose_1.default.Schema.Types.ObjectId, ref: 'User' }],
|
|
40
40
|
plan: {
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import mongoose from 'mongoose';
|
|
2
2
|
import { AiAttrs, AiDoc } from './ai';
|
|
3
|
-
|
|
4
|
-
system = "system",
|
|
5
|
-
user = "user",
|
|
6
|
-
assistant = "assistant"
|
|
7
|
-
}
|
|
3
|
+
import { ImageRoleEnum } from '../../enums/image';
|
|
8
4
|
export interface ImageAttrs {
|
|
9
5
|
userId: string;
|
|
10
6
|
imageName: string;
|
|
@@ -3,15 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ImageModel =
|
|
6
|
+
exports.ImageModel = void 0;
|
|
7
7
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
8
|
const mongoose_update_if_current_1 = require("mongoose-update-if-current");
|
|
9
|
-
|
|
10
|
-
(function (ImageRoleEnum) {
|
|
11
|
-
ImageRoleEnum["system"] = "system";
|
|
12
|
-
ImageRoleEnum["user"] = "user";
|
|
13
|
-
ImageRoleEnum["assistant"] = "assistant";
|
|
14
|
-
})(ImageRoleEnum || (exports.ImageRoleEnum = ImageRoleEnum = {}));
|
|
9
|
+
const image_1 = require("../../enums/image");
|
|
15
10
|
const ImageSchema = new mongoose_1.default.Schema({
|
|
16
11
|
userId: {
|
|
17
12
|
type: String,
|
|
@@ -39,7 +34,7 @@ const ImageSchema = new mongoose_1.default.Schema({
|
|
|
39
34
|
role: {
|
|
40
35
|
type: String,
|
|
41
36
|
required: true,
|
|
42
|
-
enum: Object.values(ImageRoleEnum),
|
|
37
|
+
enum: Object.values(image_1.ImageRoleEnum),
|
|
43
38
|
},
|
|
44
39
|
content: {
|
|
45
40
|
type: String,
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import mongoose from 'mongoose';
|
|
2
2
|
import { AiAttrs, AiDoc } from './ai';
|
|
3
|
-
|
|
4
|
-
system = "system",
|
|
5
|
-
user = "user",
|
|
6
|
-
assistant = "assistant"
|
|
7
|
-
}
|
|
3
|
+
import { MessageRoleEnum } from '../../enums/message';
|
|
8
4
|
export interface MessageAttrs {
|
|
9
5
|
userId: string;
|
|
10
6
|
messageName: string;
|
|
@@ -3,14 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Message =
|
|
6
|
+
exports.Message = void 0;
|
|
7
7
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
|
-
|
|
9
|
-
(function (MessageRoleEnum) {
|
|
10
|
-
MessageRoleEnum["system"] = "system";
|
|
11
|
-
MessageRoleEnum["user"] = "user";
|
|
12
|
-
MessageRoleEnum["assistant"] = "assistant";
|
|
13
|
-
})(MessageRoleEnum || (exports.MessageRoleEnum = MessageRoleEnum = {}));
|
|
8
|
+
const message_1 = require("../../enums/message");
|
|
14
9
|
const messageSchema = new mongoose_1.default.Schema({
|
|
15
10
|
userId: {
|
|
16
11
|
type: String,
|
|
@@ -55,7 +50,7 @@ const messageSchema = new mongoose_1.default.Schema({
|
|
|
55
50
|
role: {
|
|
56
51
|
type: String,
|
|
57
52
|
required: true,
|
|
58
|
-
enum: Object.values(MessageRoleEnum),
|
|
53
|
+
enum: Object.values(message_1.MessageRoleEnum),
|
|
59
54
|
},
|
|
60
55
|
content: {
|
|
61
56
|
type: String,
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import mongoose from 'mongoose';
|
|
2
2
|
import { AiDoc } from './ai';
|
|
3
3
|
import { PlanTypeEnum } from '../../events/types_/plan';
|
|
4
|
-
|
|
5
|
-
active = "active",
|
|
6
|
-
deactive = "deactive"
|
|
7
|
-
}
|
|
8
|
-
export declare enum TypePayEnum {
|
|
9
|
-
year = "Year",
|
|
10
|
-
season = "season"
|
|
11
|
-
}
|
|
4
|
+
import { PlanStatusEnum, TypePayEnum } from '../../enums/plan';
|
|
12
5
|
export interface PlanAttrs {
|
|
13
6
|
_id?: string;
|
|
14
7
|
price: string;
|
package/build/models/app/plan.js
CHANGED
|
@@ -3,20 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Plan =
|
|
6
|
+
exports.Plan = void 0;
|
|
7
7
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
8
|
const mongoose_update_if_current_1 = require("mongoose-update-if-current");
|
|
9
9
|
const plan_1 = require("../../events/types_/plan");
|
|
10
|
-
|
|
11
|
-
(function (PlanStatusEnum) {
|
|
12
|
-
PlanStatusEnum["active"] = "active";
|
|
13
|
-
PlanStatusEnum["deactive"] = "deactive";
|
|
14
|
-
})(PlanStatusEnum || (exports.PlanStatusEnum = PlanStatusEnum = {}));
|
|
15
|
-
var TypePayEnum;
|
|
16
|
-
(function (TypePayEnum) {
|
|
17
|
-
TypePayEnum["year"] = "Year";
|
|
18
|
-
TypePayEnum["season"] = "season";
|
|
19
|
-
})(TypePayEnum || (exports.TypePayEnum = TypePayEnum = {}));
|
|
10
|
+
const plan_2 = require("../../enums/plan");
|
|
20
11
|
const planSchema = new mongoose_1.default.Schema({
|
|
21
12
|
price: {
|
|
22
13
|
type: String,
|
|
@@ -51,8 +42,8 @@ const planSchema = new mongoose_1.default.Schema({
|
|
|
51
42
|
},
|
|
52
43
|
status: {
|
|
53
44
|
type: String,
|
|
54
|
-
enum: PlanStatusEnum,
|
|
55
|
-
default: PlanStatusEnum.active,
|
|
45
|
+
enum: plan_2.PlanStatusEnum,
|
|
46
|
+
default: plan_2.PlanStatusEnum.active,
|
|
56
47
|
},
|
|
57
48
|
type: {
|
|
58
49
|
type: String,
|
|
@@ -61,9 +52,9 @@ const planSchema = new mongoose_1.default.Schema({
|
|
|
61
52
|
},
|
|
62
53
|
typePay: {
|
|
63
54
|
type: String,
|
|
64
|
-
enum: TypePayEnum,
|
|
55
|
+
enum: plan_2.TypePayEnum,
|
|
65
56
|
required: false,
|
|
66
|
-
default: TypePayEnum.season,
|
|
57
|
+
default: plan_2.TypePayEnum.season,
|
|
67
58
|
},
|
|
68
59
|
createdAt: {
|
|
69
60
|
type: mongoose_1.default.Schema.Types.Date,
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import mongoose from 'mongoose';
|
|
2
|
-
import { TicketStatusEnum, TicketTypeEnum } from '../../
|
|
3
|
-
export declare enum MessageTypeTicketEnum {
|
|
4
|
-
user = "user",
|
|
5
|
-
admin = "admin"
|
|
6
|
-
}
|
|
2
|
+
import { MessageTypeTicketEnum, TicketStatusEnum, TicketTypeEnum } from '../../enums/ticket';
|
|
7
3
|
export interface TicketAttrs {
|
|
8
4
|
userId: string;
|
|
9
5
|
title: string;
|
|
@@ -3,15 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Ticket =
|
|
6
|
+
exports.Ticket = void 0;
|
|
7
7
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
8
|
const mongoose_update_if_current_1 = require("mongoose-update-if-current");
|
|
9
|
-
const
|
|
10
|
-
var MessageTypeTicketEnum;
|
|
11
|
-
(function (MessageTypeTicketEnum) {
|
|
12
|
-
MessageTypeTicketEnum["user"] = "user";
|
|
13
|
-
MessageTypeTicketEnum["admin"] = "admin";
|
|
14
|
-
})(MessageTypeTicketEnum || (exports.MessageTypeTicketEnum = MessageTypeTicketEnum = {}));
|
|
9
|
+
const ticket_1 = require("../../enums/ticket");
|
|
15
10
|
const ticketSchema = new mongoose_1.default.Schema({
|
|
16
11
|
userId: {
|
|
17
12
|
type: mongoose_1.default.Schema.Types.ObjectId,
|
|
@@ -24,9 +19,9 @@ const ticketSchema = new mongoose_1.default.Schema({
|
|
|
24
19
|
},
|
|
25
20
|
type: {
|
|
26
21
|
type: String,
|
|
27
|
-
enum: Object.values(
|
|
22
|
+
enum: Object.values(ticket_1.TicketTypeEnum),
|
|
28
23
|
required: true,
|
|
29
|
-
default:
|
|
24
|
+
default: ticket_1.TicketTypeEnum.general,
|
|
30
25
|
},
|
|
31
26
|
messages: [{
|
|
32
27
|
file: {
|
|
@@ -48,7 +43,7 @@ const ticketSchema = new mongoose_1.default.Schema({
|
|
|
48
43
|
typeMessage: {
|
|
49
44
|
type: String,
|
|
50
45
|
required: true,
|
|
51
|
-
default: MessageTypeTicketEnum.user
|
|
46
|
+
default: ticket_1.MessageTypeTicketEnum.user
|
|
52
47
|
},
|
|
53
48
|
createdAt: {
|
|
54
49
|
type: mongoose_1.default.Schema.Types.Date,
|
|
@@ -56,8 +51,8 @@ const ticketSchema = new mongoose_1.default.Schema({
|
|
|
56
51
|
}],
|
|
57
52
|
status: {
|
|
58
53
|
type: String,
|
|
59
|
-
enum:
|
|
60
|
-
default:
|
|
54
|
+
enum: ticket_1.TicketStatusEnum,
|
|
55
|
+
default: ticket_1.TicketStatusEnum.waitingResponse,
|
|
61
56
|
},
|
|
62
57
|
createdAt: {
|
|
63
58
|
type: mongoose_1.default.Schema.Types.Date,
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import mongoose from 'mongoose';
|
|
2
|
-
|
|
3
|
-
success = "success",
|
|
4
|
-
failed = "failed",
|
|
5
|
-
unknown = "unknown",
|
|
6
|
-
expired = "expired"
|
|
7
|
-
}
|
|
2
|
+
import { TransactionStatusEnum } from '../../enums/transaction';
|
|
8
3
|
export interface TransactionAttrs {
|
|
9
4
|
_id?: string;
|
|
10
5
|
description: string;
|
|
@@ -3,16 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Transaction =
|
|
6
|
+
exports.Transaction = void 0;
|
|
7
7
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
8
|
const mongoose_update_if_current_1 = require("mongoose-update-if-current");
|
|
9
|
-
|
|
10
|
-
(function (TransactionStatusEnum) {
|
|
11
|
-
TransactionStatusEnum["success"] = "success";
|
|
12
|
-
TransactionStatusEnum["failed"] = "failed";
|
|
13
|
-
TransactionStatusEnum["unknown"] = "unknown";
|
|
14
|
-
TransactionStatusEnum["expired"] = "expired";
|
|
15
|
-
})(TransactionStatusEnum || (exports.TransactionStatusEnum = TransactionStatusEnum = {}));
|
|
9
|
+
const transaction_1 = require("../../enums/transaction");
|
|
16
10
|
const transactionSchema = new mongoose_1.default.Schema({
|
|
17
11
|
description: {
|
|
18
12
|
type: String,
|
|
@@ -50,8 +44,8 @@ const transactionSchema = new mongoose_1.default.Schema({
|
|
|
50
44
|
},
|
|
51
45
|
status: {
|
|
52
46
|
type: String,
|
|
53
|
-
enum: TransactionStatusEnum,
|
|
54
|
-
default: TransactionStatusEnum.unknown,
|
|
47
|
+
enum: transaction_1.TransactionStatusEnum,
|
|
48
|
+
default: transaction_1.TransactionStatusEnum.unknown,
|
|
55
49
|
},
|
|
56
50
|
createdAt: {
|
|
57
51
|
type: mongoose_1.default.Schema.Types.Date,
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import mongoose from 'mongoose';
|
|
2
2
|
import { PlanDoc } from './plan';
|
|
3
|
-
|
|
4
|
-
active = "active",
|
|
5
|
-
deactive = "deactive"
|
|
6
|
-
}
|
|
3
|
+
import { UserStatusEnum } from '../../enums/user';
|
|
7
4
|
export interface UserAttrs {
|
|
8
5
|
_id: string;
|
|
9
6
|
walletBalance?: mongoose.Types.Decimal128;
|
|
@@ -20,7 +17,7 @@ export interface UserAttrs {
|
|
|
20
17
|
limit?: boolean;
|
|
21
18
|
username?: string;
|
|
22
19
|
mobile?: string;
|
|
23
|
-
status?:
|
|
20
|
+
status?: UserStatusEnum;
|
|
24
21
|
name?: string;
|
|
25
22
|
password?: string;
|
|
26
23
|
family?: string;
|
package/build/models/app/user.js
CHANGED
|
@@ -12,15 +12,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.User =
|
|
15
|
+
exports.User = void 0;
|
|
16
16
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
17
17
|
// import { updateIfCurrentPlugin } from 'mongoose-update-if-current';
|
|
18
18
|
const password_1 = require("../../services/password");
|
|
19
|
-
|
|
20
|
-
(function (userStatusEnum) {
|
|
21
|
-
userStatusEnum["active"] = "active";
|
|
22
|
-
userStatusEnum["deactive"] = "deactive";
|
|
23
|
-
})(userStatusEnum || (exports.userStatusEnum = userStatusEnum = {}));
|
|
19
|
+
const user_1 = require("../../enums/user");
|
|
24
20
|
const userSchema = new mongoose_1.default.Schema({
|
|
25
21
|
email: {
|
|
26
22
|
type: String,
|
|
@@ -111,8 +107,8 @@ const userSchema = new mongoose_1.default.Schema({
|
|
|
111
107
|
},
|
|
112
108
|
status: {
|
|
113
109
|
type: String,
|
|
114
|
-
enum:
|
|
115
|
-
default:
|
|
110
|
+
enum: user_1.UserStatusEnum,
|
|
111
|
+
default: user_1.UserStatusEnum.active,
|
|
116
112
|
},
|
|
117
113
|
createdAt: {
|
|
118
114
|
type: Number,
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import mongoose from 'mongoose';
|
|
2
2
|
import { AiAttrs, AiDoc } from './ai';
|
|
3
|
-
|
|
4
|
-
textToSpeech = "textToSpeech",
|
|
5
|
-
speechToText = "speechToText"
|
|
6
|
-
}
|
|
3
|
+
import { SpeechTypeEnum } from '../../enums/voice';
|
|
7
4
|
export interface SpeechAttrs {
|
|
8
5
|
userId: string;
|
|
9
6
|
speechName: string;
|
|
@@ -3,14 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.SpeechModel =
|
|
6
|
+
exports.SpeechModel = void 0;
|
|
7
7
|
const mongoose_1 = __importDefault(require("mongoose"));
|
|
8
8
|
const mongoose_update_if_current_1 = require("mongoose-update-if-current");
|
|
9
|
-
|
|
10
|
-
(function (SpeechTypeEnum) {
|
|
11
|
-
SpeechTypeEnum["textToSpeech"] = "textToSpeech";
|
|
12
|
-
SpeechTypeEnum["speechToText"] = "speechToText";
|
|
13
|
-
})(SpeechTypeEnum || (exports.SpeechTypeEnum = SpeechTypeEnum = {}));
|
|
9
|
+
const voice_1 = require("../../enums/voice");
|
|
14
10
|
const SpeechSchema = new mongoose_1.default.Schema({
|
|
15
11
|
userId: {
|
|
16
12
|
type: String,
|
|
@@ -37,7 +33,7 @@ const SpeechSchema = new mongoose_1.default.Schema({
|
|
|
37
33
|
type: {
|
|
38
34
|
type: String,
|
|
39
35
|
required: true,
|
|
40
|
-
enum: Object.values(SpeechTypeEnum),
|
|
36
|
+
enum: Object.values(voice_1.SpeechTypeEnum),
|
|
41
37
|
},
|
|
42
38
|
content: {
|
|
43
39
|
type: String,
|