biz-slide-core 1.2.28 → 1.2.30
Sign up to get free protection for your applications and to get access to all the features.
- package/{entity → dist/entity}/template.entity.js +1 -0
- package/dist/package-lock.json +1770 -0
- package/dist/package.json +23 -0
- package/{utilities → dist/utilities}/index.js +1 -0
- package/dist/utilities/sendEmail.js +83 -0
- package/package.json +4 -2
- package/src/entity/config.enity.ts +18 -0
- package/src/entity/image.entity.ts +32 -0
- package/src/entity/index.ts +16 -0
- package/src/entity/logs.entity.ts +20 -0
- package/src/entity/png-svg.entity.ts +42 -0
- package/src/entity/ppt-event.entity.ts +23 -0
- package/src/entity/ppt-slide.entity.ts +29 -0
- package/src/entity/ppt.entity.ts +48 -0
- package/src/entity/slide-layout.entity.ts +22 -0
- package/src/entity/slide.entity.ts +47 -0
- package/src/entity/socket.entity.ts +20 -0
- package/src/entity/template-type.entity.ts +57 -0
- package/src/entity/template.entity.ts +38 -0
- package/src/entity/training-queue.entity.ts +26 -0
- package/src/entity/user.entity.ts +24 -0
- package/src/index.ts +6 -0
- package/src/middleware/authentication.ts +68 -0
- package/src/middleware/index.ts +3 -0
- package/src/middleware/role.ts +5 -0
- package/src/middleware/schemaValidate.ts +20 -0
- package/src/resHandler/errorHandler.ts +65 -0
- package/src/resHandler/index.ts +2 -0
- package/src/resHandler/successHandler.ts +11 -0
- package/src/types/IController.ts +6 -0
- package/src/types/IRequest.ts +8 -0
- package/src/types/index.ts +11 -0
- package/src/utilities/callWithRetries.ts +9 -0
- package/src/utilities/createFolder.ts +11 -0
- package/src/utilities/encryptionUtils.ts +26 -0
- package/src/utilities/hasAbusiveWords.ts +33 -0
- package/src/utilities/index.ts +6 -0
- package/src/utilities/pngSvgCategories.ts +167 -0
- package/src/utilities/sendEmail.ts +30 -0
- package/tsconfig.json +11 -0
- /package/{entity → dist/entity}/config.enity.js +0 -0
- /package/{entity → dist/entity}/image.entity.js +0 -0
- /package/{entity → dist/entity}/index.js +0 -0
- /package/{entity → dist/entity}/logs.entity.js +0 -0
- /package/{entity → dist/entity}/png-svg.entity.js +0 -0
- /package/{entity → dist/entity}/ppt-event.entity.js +0 -0
- /package/{entity → dist/entity}/ppt-slide.entity.js +0 -0
- /package/{entity → dist/entity}/ppt.entity.js +0 -0
- /package/{entity → dist/entity}/slide-layout.entity.js +0 -0
- /package/{entity → dist/entity}/slide.entity.js +0 -0
- /package/{entity → dist/entity}/socket.entity.js +0 -0
- /package/{entity → dist/entity}/template-type.entity.js +0 -0
- /package/{entity → dist/entity}/training-queue.entity.js +0 -0
- /package/{entity → dist/entity}/user.entity.js +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{middleware → dist/middleware}/authentication.js +0 -0
- /package/{middleware → dist/middleware}/index.js +0 -0
- /package/{middleware → dist/middleware}/role.js +0 -0
- /package/{middleware → dist/middleware}/schemaValidate.js +0 -0
- /package/{resHandler → dist/resHandler}/errorHandler.js +0 -0
- /package/{resHandler → dist/resHandler}/index.js +0 -0
- /package/{resHandler → dist/resHandler}/successHandler.js +0 -0
- /package/{types → dist/types}/IController.js +0 -0
- /package/{types → dist/types}/IRequest.js +0 -0
- /package/{types → dist/types}/index.js +0 -0
- /package/{utilities → dist/utilities}/callWithRetries.js +0 -0
- /package/{utilities → dist/utilities}/createFolder.js +0 -0
- /package/{utilities → dist/utilities}/encryptionUtils.js +0 -0
- /package/{utilities → dist/utilities}/hasAbusiveWords.js +0 -0
- /package/{utilities → dist/utilities}/pngSvgCategories.js +0 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
{
|
2
|
+
"name": "biz-slide-core",
|
3
|
+
"version": "1.2.30",
|
4
|
+
"description": "",
|
5
|
+
"main": "dist/index.js",
|
6
|
+
"scripts": {
|
7
|
+
"build": "tsc",
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
9
|
+
},
|
10
|
+
"keywords": [],
|
11
|
+
"author": "",
|
12
|
+
"license": "ISC",
|
13
|
+
"dependencies": {
|
14
|
+
"express": "^4.18.2",
|
15
|
+
"joi": "^17.11.0",
|
16
|
+
"jsonwebtoken": "^9.0.2",
|
17
|
+
"typescript": "^5.3.3"
|
18
|
+
},
|
19
|
+
"devDependencies": {
|
20
|
+
"@types/express": "^4.17.21",
|
21
|
+
"@types/jsonwebtoken": "^9.0.5"
|
22
|
+
}
|
23
|
+
}
|
@@ -0,0 +1,83 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
15
|
+
function step(op) {
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
20
|
+
switch (op[0]) {
|
21
|
+
case 0: case 1: t = op; break;
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
25
|
+
default:
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
30
|
+
if (t[2]) _.ops.pop();
|
31
|
+
_.trys.pop(); continue;
|
32
|
+
}
|
33
|
+
op = body.call(thisArg, _);
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
36
|
+
}
|
37
|
+
};
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
40
|
+
};
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
42
|
+
exports.sendEmail = void 0;
|
43
|
+
var nodemailer_1 = __importDefault(require("nodemailer"));
|
44
|
+
function sendEmail(to, subject, text, attachments) {
|
45
|
+
return __awaiter(this, void 0, void 0, function () {
|
46
|
+
var transporter, mailOptions, info, error_1;
|
47
|
+
return __generator(this, function (_a) {
|
48
|
+
switch (_a.label) {
|
49
|
+
case 0:
|
50
|
+
transporter = nodemailer_1.default.createTransport({
|
51
|
+
host: process.env.EMAIL_HOST, // SES SMTP endpoint for your region
|
52
|
+
port: 465,
|
53
|
+
secure: true, // use TLS
|
54
|
+
auth: {
|
55
|
+
user: process.env.EMAIL_USER, // SMTP username (not used but still required)
|
56
|
+
pass: process.env.EMAIL_PASS // Access token
|
57
|
+
}
|
58
|
+
});
|
59
|
+
mailOptions = {
|
60
|
+
from: process.env.EMAIL_SUPPORT, // sender email address
|
61
|
+
to: to, // recipient email address
|
62
|
+
subject: subject, // subject of the email
|
63
|
+
text: text, // plaintext body
|
64
|
+
attachments: attachments || []
|
65
|
+
};
|
66
|
+
_a.label = 1;
|
67
|
+
case 1:
|
68
|
+
_a.trys.push([1, 3, , 4]);
|
69
|
+
return [4 /*yield*/, transporter.sendMail(mailOptions)];
|
70
|
+
case 2:
|
71
|
+
info = _a.sent();
|
72
|
+
console.log('Email sent:', info.response);
|
73
|
+
return [3 /*break*/, 4];
|
74
|
+
case 3:
|
75
|
+
error_1 = _a.sent();
|
76
|
+
console.error('Error sending email: ', error_1);
|
77
|
+
return [2 /*return*/, undefined];
|
78
|
+
case 4: return [2 /*return*/];
|
79
|
+
}
|
80
|
+
});
|
81
|
+
});
|
82
|
+
}
|
83
|
+
exports.sendEmail = sendEmail;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "biz-slide-core",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.30",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"scripts": {
|
@@ -14,10 +14,12 @@
|
|
14
14
|
"express": "^4.18.2",
|
15
15
|
"joi": "^17.11.0",
|
16
16
|
"jsonwebtoken": "^9.0.2",
|
17
|
+
"nodemailer": "^6.9.13",
|
17
18
|
"typescript": "^5.3.3"
|
18
19
|
},
|
19
20
|
"devDependencies": {
|
20
21
|
"@types/express": "^4.17.21",
|
21
|
-
"@types/jsonwebtoken": "^9.0.5"
|
22
|
+
"@types/jsonwebtoken": "^9.0.5",
|
23
|
+
"@types/nodemailer": "^6.4.14"
|
22
24
|
}
|
23
25
|
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { Schema, model, Types } from "mongoose";
|
2
|
+
|
3
|
+
export interface IConfigSchema {
|
4
|
+
configType: string;
|
5
|
+
value: string;
|
6
|
+
}
|
7
|
+
|
8
|
+
const CongigSchema = new Schema<IConfigSchema>(
|
9
|
+
{
|
10
|
+
configType: { type: String, required: true },
|
11
|
+
value: { type: String, required: true },
|
12
|
+
},
|
13
|
+
{
|
14
|
+
timestamps: true,
|
15
|
+
}
|
16
|
+
);
|
17
|
+
|
18
|
+
export const ConfigModel = model<IConfigSchema>("config", CongigSchema);
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { Schema, model, Types } from "mongoose";
|
2
|
+
|
3
|
+
export interface IImageSchema {
|
4
|
+
focusPoint: { x: number, y: number };
|
5
|
+
url: string;
|
6
|
+
radius: string;
|
7
|
+
keywords: [string] | null;
|
8
|
+
title: string;
|
9
|
+
aliasName: string;
|
10
|
+
userId: Types.ObjectId;
|
11
|
+
createdAt: Date;
|
12
|
+
updatedAt: Date;
|
13
|
+
deletedAt: Date;
|
14
|
+
}
|
15
|
+
|
16
|
+
const ImageSchema = new Schema<IImageSchema>(
|
17
|
+
{
|
18
|
+
focusPoint: { x: Number, y: Number },
|
19
|
+
url: { type: String, required: true },
|
20
|
+
radius: { type: String, required: true },
|
21
|
+
aliasName: { type: String, required: true },
|
22
|
+
keywords: { type: [String], default: [] },
|
23
|
+
title: { type: String, required: true },
|
24
|
+
userId: { type: Schema.Types.ObjectId, ref: "user" },
|
25
|
+
deletedAt: { type: Date, default: null },
|
26
|
+
},
|
27
|
+
{
|
28
|
+
timestamps: true,
|
29
|
+
}
|
30
|
+
);
|
31
|
+
|
32
|
+
export const ImageModel = model<IImageSchema>("image", ImageSchema);
|
@@ -0,0 +1,16 @@
|
|
1
|
+
export * from "./image.entity";
|
2
|
+
export * from "./png-svg.entity";
|
3
|
+
export * from "./ppt-event.entity";
|
4
|
+
export * from "./ppt-slide.entity";
|
5
|
+
export * from "./ppt.entity";
|
6
|
+
export * from "./slide-layout.entity";
|
7
|
+
export * from "./slide.entity";
|
8
|
+
export * from "./socket.entity";
|
9
|
+
export * from "./template.entity";
|
10
|
+
export * from "./template-type.entity";
|
11
|
+
export * from "./user.entity";
|
12
|
+
export * from "./training-queue.entity";
|
13
|
+
export * from "./config.enity";
|
14
|
+
export * from "./logs.entity";
|
15
|
+
|
16
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { Schema, model } from "mongoose";
|
2
|
+
|
3
|
+
export interface ILogsSchema {
|
4
|
+
type: string;
|
5
|
+
event: string;
|
6
|
+
message: string;
|
7
|
+
}
|
8
|
+
|
9
|
+
const LogsSchema = new Schema<ILogsSchema>(
|
10
|
+
{
|
11
|
+
type: { type: String, required: true },
|
12
|
+
event: { type: String, required: true },
|
13
|
+
message: { type: String, required: true },
|
14
|
+
},
|
15
|
+
{
|
16
|
+
timestamps: true,
|
17
|
+
}
|
18
|
+
);
|
19
|
+
|
20
|
+
export const LogsModel = model<ILogsSchema>("logs", LogsSchema);
|
@@ -0,0 +1,42 @@
|
|
1
|
+
import { Schema, model } from "mongoose";
|
2
|
+
|
3
|
+
export interface IPngSvgSchema {
|
4
|
+
title: string;
|
5
|
+
styleCategory: string;
|
6
|
+
styleSubCategory: string;
|
7
|
+
colors: Array<string>;
|
8
|
+
userId: string;
|
9
|
+
isLocked?: boolean;
|
10
|
+
isCompleted?: boolean;
|
11
|
+
isDownloaded?: boolean;
|
12
|
+
hasError?: boolean;
|
13
|
+
optionsDownloaded: any;
|
14
|
+
userReaction: number;
|
15
|
+
userFeedback: string;
|
16
|
+
createdAt?: Date;
|
17
|
+
updatedAt?: Date;
|
18
|
+
deletedAt?: Date;
|
19
|
+
}
|
20
|
+
|
21
|
+
const PngSvgSchema = new Schema<IPngSvgSchema>(
|
22
|
+
{
|
23
|
+
deletedAt: { type: Date, default: null },
|
24
|
+
isLocked: { type: Boolean, default: false },
|
25
|
+
optionsDownloaded: Schema.Types.Mixed,
|
26
|
+
isDownloaded: { type: Boolean, default: false },
|
27
|
+
isCompleted: { type: Boolean, default: false },
|
28
|
+
hasError: { type: Boolean, default: false },
|
29
|
+
userId: { type: String, default: null },
|
30
|
+
userReaction: { type: Number, default: 0 },
|
31
|
+
userFeedback: { type: String, default: null },
|
32
|
+
title: { type: String, default: null },
|
33
|
+
styleCategory: { type: String, default: null },
|
34
|
+
styleSubCategory: { type: String, default: null },
|
35
|
+
colors: { type: [{ type: String, default: null }], default: null, _id: false }
|
36
|
+
},
|
37
|
+
{
|
38
|
+
timestamps: true,
|
39
|
+
}
|
40
|
+
);
|
41
|
+
|
42
|
+
export const PngSvgModel = model<IPngSvgSchema>("png-svg", PngSvgSchema);
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { Schema, model, Types } from "mongoose";
|
2
|
+
|
3
|
+
|
4
|
+
export interface IPPTEventSchema {
|
5
|
+
pptRef: Types.ObjectId;
|
6
|
+
event: string;
|
7
|
+
message: string;
|
8
|
+
createdAt?: Date;
|
9
|
+
updatedAt?: Date;
|
10
|
+
}
|
11
|
+
|
12
|
+
const PPTEventSchema = new Schema<IPPTEventSchema>(
|
13
|
+
{
|
14
|
+
pptRef: { type: Schema.Types.ObjectId, ref: 'ppt' },
|
15
|
+
message: { type: String, default: null },
|
16
|
+
event: { type: String, default: null },
|
17
|
+
},
|
18
|
+
{
|
19
|
+
timestamps: true,
|
20
|
+
}
|
21
|
+
);
|
22
|
+
|
23
|
+
export const PPTSlideEventModel = model<IPPTEventSchema>("ppt-event", PPTEventSchema);
|
@@ -0,0 +1,29 @@
|
|
1
|
+
import { Schema, model, Types } from "mongoose";
|
2
|
+
export interface IPPTSlideSchema {
|
3
|
+
pptRef: Types.ObjectId;
|
4
|
+
slideRef: Types.ObjectId;
|
5
|
+
slideLayoutRef: Types.ObjectId;
|
6
|
+
title: string;
|
7
|
+
rawData: string;
|
8
|
+
images: string;
|
9
|
+
createdAt?: Date;
|
10
|
+
updatedAt?: Date;
|
11
|
+
deletedAt?: Date;
|
12
|
+
}
|
13
|
+
|
14
|
+
const PPTSlideSchema = new Schema<IPPTSlideSchema>(
|
15
|
+
{
|
16
|
+
deletedAt: { type: Date, default: null },
|
17
|
+
pptRef: { type: Schema.Types.ObjectId, ref: 'ppt' },
|
18
|
+
slideRef: { type: Schema.Types.ObjectId, ref: 'slide' },
|
19
|
+
slideLayoutRef: { type: Schema.Types.ObjectId, ref: 'slide-layout' },
|
20
|
+
title: { type: String, default: null },
|
21
|
+
rawData: { type: String, default: "{}" },
|
22
|
+
images: { type: String, default: "{}" },
|
23
|
+
},
|
24
|
+
{
|
25
|
+
timestamps: true,
|
26
|
+
}
|
27
|
+
);
|
28
|
+
|
29
|
+
export const PPTSlideModel = model<IPPTSlideSchema>("ppt-slide", PPTSlideSchema);
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import { Schema, model, Types } from "mongoose";
|
2
|
+
|
3
|
+
export interface IPPTSchema {
|
4
|
+
systemGeneratedtopics: Array<string>;
|
5
|
+
userSelectedTopics: Array<string>;
|
6
|
+
colors: Array<string>;
|
7
|
+
slideRefs: Types.ObjectId[];
|
8
|
+
templateId: Types.ObjectId;
|
9
|
+
templateTypeId: Types.ObjectId;
|
10
|
+
prompt: string;
|
11
|
+
userId: string;
|
12
|
+
userReaction: number;
|
13
|
+
userFeedback: string;
|
14
|
+
questions: Array<string>;
|
15
|
+
isLocked?: boolean;
|
16
|
+
fileCreated?: boolean;
|
17
|
+
isCompleted?: boolean;
|
18
|
+
createdAt?: Date;
|
19
|
+
updatedAt?: Date;
|
20
|
+
deletedAt?: Date;
|
21
|
+
hasError?: boolean;
|
22
|
+
}
|
23
|
+
|
24
|
+
const PPTSchema = new Schema<IPPTSchema>(
|
25
|
+
{
|
26
|
+
deletedAt: { type: Date, default: null },
|
27
|
+
isLocked: { type: Boolean, default: false },
|
28
|
+
isCompleted: { type: Boolean, default: false },
|
29
|
+
fileCreated: { type: Boolean, default: false },
|
30
|
+
userId: { type: String, default: null },
|
31
|
+
templateTypeId: { type: Schema.Types.ObjectId, ref: "template-type" },
|
32
|
+
systemGeneratedtopics: { type: [String], default: [], _id: false },
|
33
|
+
userSelectedTopics: { type: [String], default: [], _id: false },
|
34
|
+
userReaction: { type: Number, default: 0 },
|
35
|
+
userFeedback: { type: String, default: null },
|
36
|
+
questions: { type: [String], default: [], _id: false },
|
37
|
+
colors: { type: [String], default: [], _id: false },
|
38
|
+
prompt: { type: String, default: null },
|
39
|
+
templateId: { type: Schema.Types.ObjectId, ref: 'template' },
|
40
|
+
hasError: { type: Boolean, default: false },
|
41
|
+
slideRefs: {type: [{ type: Schema.Types.ObjectId, ref: 'ppt-slide' }], default: [], _id: false}
|
42
|
+
},
|
43
|
+
{
|
44
|
+
timestamps: true,
|
45
|
+
}
|
46
|
+
);
|
47
|
+
|
48
|
+
export const PPTModel = model<IPPTSchema>("ppt", PPTSchema);
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { Schema, model, Types } from "mongoose";
|
2
|
+
|
3
|
+
export interface ISlideLayoutSchema {
|
4
|
+
name: string;
|
5
|
+
templateTypeId: Types.ObjectId;
|
6
|
+
createdAt: Date;
|
7
|
+
updatedAt: Date;
|
8
|
+
deletedAt: Date;
|
9
|
+
}
|
10
|
+
|
11
|
+
const SlideLayoutSchema = new Schema<ISlideLayoutSchema>(
|
12
|
+
{
|
13
|
+
name: { type: String, default: "", required: true },
|
14
|
+
templateTypeId: { type: Schema.Types.ObjectId, ref: "template-type" },
|
15
|
+
deletedAt: { type: Date, default: null },
|
16
|
+
},
|
17
|
+
{
|
18
|
+
timestamps: true,
|
19
|
+
}
|
20
|
+
);
|
21
|
+
|
22
|
+
export const SlideLayoutModel = model<ISlideLayoutSchema>("slide-layout", SlideLayoutSchema);
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import { Schema, model, Types } from "mongoose";
|
2
|
+
|
3
|
+
interface layer {
|
4
|
+
metaType: String;
|
5
|
+
optionsMeta: String;
|
6
|
+
chatMeta: string;
|
7
|
+
}
|
8
|
+
|
9
|
+
const layerSchema = new Schema<layer>({
|
10
|
+
metaType: { type: String, enum: ['text', 'image', 'shape', 'list', 'table'] },
|
11
|
+
optionsMeta: { type: String },
|
12
|
+
chatMeta: { type: String },
|
13
|
+
}, {
|
14
|
+
timestamps: false,
|
15
|
+
_id: false
|
16
|
+
})
|
17
|
+
|
18
|
+
export interface ISlideSchema {
|
19
|
+
name: string;
|
20
|
+
postfix: string;
|
21
|
+
rules: string;
|
22
|
+
slideLayoutId: Types.ObjectId;
|
23
|
+
templateId: Types.ObjectId;
|
24
|
+
layers: layer[];
|
25
|
+
createdAt: Date;
|
26
|
+
updatedAt: Date;
|
27
|
+
deletedAt: Date;
|
28
|
+
isDelete: boolean;
|
29
|
+
}
|
30
|
+
|
31
|
+
const SlideSchema = new Schema<ISlideSchema>(
|
32
|
+
{
|
33
|
+
name: { type: String, default: "", required: true },
|
34
|
+
postfix: { type: String, default: "" },
|
35
|
+
rules: { type: String, default: "" },
|
36
|
+
layers: [layerSchema],
|
37
|
+
slideLayoutId: { type: Schema.Types.ObjectId, ref: "slide-layout" },
|
38
|
+
templateId: { type: Schema.Types.ObjectId, ref: "template" },
|
39
|
+
deletedAt: { type: Date, default: null },
|
40
|
+
isDelete: { type: Boolean, default: false }
|
41
|
+
},
|
42
|
+
{
|
43
|
+
timestamps: true,
|
44
|
+
}
|
45
|
+
);
|
46
|
+
|
47
|
+
export const SlideModel = model<ISlideSchema>("slide", SlideSchema);
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { Schema, model, Types } from "mongoose";
|
2
|
+
|
3
|
+
export interface ISocketSchema {
|
4
|
+
userId: string;
|
5
|
+
socketIds: Array<string>;
|
6
|
+
createdAt?: Date;
|
7
|
+
updatedAt?: Date;
|
8
|
+
}
|
9
|
+
|
10
|
+
const SocketSchema = new Schema<ISocketSchema>(
|
11
|
+
{
|
12
|
+
userId: { type: String, default: null },
|
13
|
+
socketIds: { type: [String], default: [] }
|
14
|
+
},
|
15
|
+
{
|
16
|
+
timestamps: true,
|
17
|
+
}
|
18
|
+
);
|
19
|
+
|
20
|
+
export const SocketModel = model<ISocketSchema>("socket", SocketSchema);
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import { Schema, model } from "mongoose";
|
2
|
+
|
3
|
+
interface IQuestionSchema {
|
4
|
+
question: string;
|
5
|
+
systemMessage: string;
|
6
|
+
keyId: string;
|
7
|
+
placeholder: string;
|
8
|
+
}
|
9
|
+
|
10
|
+
export interface ITemplateLayout {
|
11
|
+
title: string;
|
12
|
+
layoutType: string;
|
13
|
+
}
|
14
|
+
export interface ITemplateTypeSchema{
|
15
|
+
name: string;
|
16
|
+
questions: Array<IQuestionSchema>;
|
17
|
+
predefineSystemMessage: string;
|
18
|
+
layouts: Array<ITemplateLayout>;
|
19
|
+
createdAt: Date;
|
20
|
+
updatedAt: Date;
|
21
|
+
deletedAt: Date;
|
22
|
+
suggestionPrompts: Array<string>;
|
23
|
+
}
|
24
|
+
|
25
|
+
const questionSchema = new Schema<IQuestionSchema>({
|
26
|
+
question: { type: String },
|
27
|
+
systemMessage: { type: String },
|
28
|
+
keyId: { type: String },
|
29
|
+
placeholder: { type: String },
|
30
|
+
}, {
|
31
|
+
timestamps: false,
|
32
|
+
_id: false
|
33
|
+
})
|
34
|
+
|
35
|
+
const layoutsSchema = new Schema<ITemplateLayout>({
|
36
|
+
title: { type: String },
|
37
|
+
layoutType: { type: String },
|
38
|
+
}, {
|
39
|
+
timestamps: false,
|
40
|
+
_id: false
|
41
|
+
})
|
42
|
+
|
43
|
+
const TemplateTypeSchema = new Schema<ITemplateTypeSchema>(
|
44
|
+
{
|
45
|
+
name: { type: String, default: "", required: true },
|
46
|
+
questions: [questionSchema],
|
47
|
+
predefineSystemMessage: {type: String, default: ""},
|
48
|
+
layouts: [layoutsSchema],
|
49
|
+
suggestionPrompts: {type: [String], default: [], _id: false},
|
50
|
+
deletedAt: { type: Date, default: null },
|
51
|
+
},
|
52
|
+
{
|
53
|
+
timestamps: true,
|
54
|
+
}
|
55
|
+
);
|
56
|
+
|
57
|
+
export const TemplateTypeModel = model<ITemplateTypeSchema>("template-type", TemplateTypeSchema);
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import { Schema, model, Types } from "mongoose";
|
2
|
+
|
3
|
+
export interface ITemplateSchema{
|
4
|
+
name: string;
|
5
|
+
templateTypeId: Types.ObjectId;
|
6
|
+
createdAt: Date,
|
7
|
+
updatedAt: Date,
|
8
|
+
deletedAt: Date,
|
9
|
+
defaultColorPallete: Array<string>;
|
10
|
+
colorPalletes: Array<Array<string>>;
|
11
|
+
staticImageDir: string;
|
12
|
+
published: boolean;
|
13
|
+
}
|
14
|
+
|
15
|
+
const TemplateSchema = new Schema<ITemplateSchema>(
|
16
|
+
{
|
17
|
+
name: { type: String, default: "", required: true },
|
18
|
+
published: { type: Boolean, default: false },
|
19
|
+
templateTypeId: { type: Schema.Types.ObjectId, ref: "template-type" },
|
20
|
+
defaultColorPallete: { type: [String], default: [], _id: false },
|
21
|
+
colorPalletes: {
|
22
|
+
type: [
|
23
|
+
{
|
24
|
+
type: [String],
|
25
|
+
default: [],
|
26
|
+
_id: false
|
27
|
+
}
|
28
|
+
], default: [], _id: false
|
29
|
+
},
|
30
|
+
deletedAt: { type: Date, default: null },
|
31
|
+
staticImageDir: { type: String, default: "", required: true }
|
32
|
+
},
|
33
|
+
{
|
34
|
+
timestamps: true,
|
35
|
+
}
|
36
|
+
);
|
37
|
+
|
38
|
+
export const TemplateModel = model<ITemplateSchema>("template", TemplateSchema);
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { Schema, model, Types } from "mongoose";
|
2
|
+
|
3
|
+
interface ITrainingQueue {
|
4
|
+
filename: string,
|
5
|
+
isCompleted: boolean,
|
6
|
+
isLocked: boolean,
|
7
|
+
userId: Types.ObjectId;
|
8
|
+
createdAt: Date,
|
9
|
+
updatedAt: Date,
|
10
|
+
deletedAt: Date
|
11
|
+
}
|
12
|
+
|
13
|
+
const TrainingQueueSchema = new Schema<ITrainingQueue>(
|
14
|
+
{
|
15
|
+
filename: { type: String, default: null },
|
16
|
+
isCompleted: { type: Boolean, default: false },
|
17
|
+
userId: { type: Schema.Types.ObjectId, ref: "user" },
|
18
|
+
isLocked: { type: Boolean, default: false },
|
19
|
+
deletedAt: { type: Date, default: null},
|
20
|
+
},
|
21
|
+
{
|
22
|
+
timestamps: true,
|
23
|
+
}
|
24
|
+
);
|
25
|
+
|
26
|
+
export const TrainingQueueModel = model<ITrainingQueue>("training-queue", TrainingQueueSchema);
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { Schema, model } from "mongoose";
|
2
|
+
|
3
|
+
interface IUser {
|
4
|
+
email: string | null;
|
5
|
+
password: string,
|
6
|
+
role: string,
|
7
|
+
createdAt: Date,
|
8
|
+
updatedAt: Date,
|
9
|
+
deletedAt: Date
|
10
|
+
}
|
11
|
+
|
12
|
+
const UserSchema = new Schema<IUser>(
|
13
|
+
{
|
14
|
+
email: { type: String, unique: true, sparse: true },
|
15
|
+
password: { type: String, default: null },
|
16
|
+
role: { type: String, default: null },
|
17
|
+
deletedAt: { type: Date, default: null},
|
18
|
+
},
|
19
|
+
{
|
20
|
+
timestamps: true,
|
21
|
+
}
|
22
|
+
);
|
23
|
+
|
24
|
+
export const UserModel = model<IUser>("user", UserSchema);
|