biz-slide-core 1.2.85 → 1.2.87

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. package/dist/entity/analytic.entity.js +4 -4
  2. package/dist/entity/config.enity.js +2 -2
  3. package/dist/entity/cron.entity.js +2 -2
  4. package/dist/entity/customer.entity.js +3 -3
  5. package/dist/entity/image.entity.js +2 -2
  6. package/dist/entity/logs.entity.js +2 -2
  7. package/dist/entity/png-svg.entity.js +2 -2
  8. package/dist/entity/ppt-email-queue.entity.js +2 -2
  9. package/dist/entity/ppt-event.entity.js +2 -2
  10. package/dist/entity/ppt-slide.entity.js +2 -2
  11. package/dist/entity/ppt.entity.d.ts +1 -0
  12. package/dist/entity/ppt.entity.d.ts.map +1 -1
  13. package/dist/entity/ppt.entity.js +2 -2
  14. package/dist/entity/slide-layout.entity.js +4 -4
  15. package/dist/entity/slide.entity.js +3 -3
  16. package/dist/entity/socket.entity.js +2 -2
  17. package/dist/entity/template-type.entity.js +6 -6
  18. package/dist/entity/template.entity.js +2 -2
  19. package/dist/entity/training-queue.entity.js +2 -2
  20. package/dist/entity/user.entity.js +2 -2
  21. package/dist/middleware/authentication.js +112 -215
  22. package/dist/middleware/schemaValidate.js +10 -52
  23. package/dist/resHandler/errorHandler.js +20 -42
  24. package/dist/resHandler/successHandler.js +1 -1
  25. package/dist/utilities/callWithRetries.js +9 -67
  26. package/dist/utilities/createFolder.js +10 -51
  27. package/dist/utilities/encryptionUtils.js +14 -54
  28. package/dist/utilities/hasAbusiveWords.js +4 -5
  29. package/package.json +3 -1
  30. package/src/entity/analytic.entity.ts +0 -62
  31. package/src/entity/common.ts +0 -19
  32. package/src/entity/config.enity.ts +0 -18
  33. package/src/entity/cron.entity.ts +0 -22
  34. package/src/entity/customer.entity.ts +0 -40
  35. package/src/entity/image.entity.ts +0 -32
  36. package/src/entity/index.ts +0 -20
  37. package/src/entity/logs.entity.ts +0 -20
  38. package/src/entity/png-svg.entity.ts +0 -44
  39. package/src/entity/ppt-email-queue.entity.ts +0 -22
  40. package/src/entity/ppt-event.entity.ts +0 -25
  41. package/src/entity/ppt-slide.entity.ts +0 -40
  42. package/src/entity/ppt.entity.ts +0 -79
  43. package/src/entity/slide-layout.entity.ts +0 -56
  44. package/src/entity/slide.entity.ts +0 -61
  45. package/src/entity/socket.entity.ts +0 -20
  46. package/src/entity/template-type.entity.ts +0 -87
  47. package/src/entity/template.entity.ts +0 -38
  48. package/src/entity/training-queue.entity.ts +0 -26
  49. package/src/entity/user.entity.ts +0 -24
  50. package/src/index.ts +0 -6
  51. package/src/middleware/authentication.ts +0 -150
  52. package/src/middleware/index.ts +0 -3
  53. package/src/middleware/role.ts +0 -5
  54. package/src/middleware/schemaValidate.ts +0 -20
  55. package/src/resHandler/errorHandler.ts +0 -66
  56. package/src/resHandler/index.ts +0 -2
  57. package/src/resHandler/successHandler.ts +0 -11
  58. package/src/types/IController.ts +0 -6
  59. package/src/types/IRequest.ts +0 -8
  60. package/src/types/index.ts +0 -11
  61. package/src/utilities/callWithRetries.ts +0 -9
  62. package/src/utilities/createFolder.ts +0 -11
  63. package/src/utilities/encryptionUtils.ts +0 -26
  64. package/src/utilities/hasAbusiveWords.ts +0 -33
  65. package/src/utilities/index.ts +0 -5
  66. package/src/utilities/pngSvgCategories.ts +0 -167
  67. package/tsconfig.json +0 -11
@@ -1,59 +1,18 @@
1
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
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
39
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
40
4
  };
41
5
  Object.defineProperty(exports, "__esModule", { value: true });
42
6
  exports.createFolder = void 0;
43
- var fs_1 = __importDefault(require("fs"));
44
- function createFolder(folderPath) {
45
- return __awaiter(this, void 0, void 0, function () {
46
- return __generator(this, function (_a) {
47
- try {
48
- if (!fs_1.default.existsSync(folderPath)) {
49
- fs_1.default.mkdirSync(folderPath);
50
- }
51
- }
52
- catch (error) {
53
- console.error("Error: ".concat(error.message));
54
- }
55
- return [2 /*return*/];
56
- });
57
- });
7
+ const fs_1 = __importDefault(require("fs"));
8
+ async function createFolder(folderPath) {
9
+ try {
10
+ if (!fs_1.default.existsSync(folderPath)) {
11
+ fs_1.default.mkdirSync(folderPath);
12
+ }
13
+ }
14
+ catch (error) {
15
+ console.error(`Error: ${error.message}`);
16
+ }
58
17
  }
59
18
  exports.createFolder = createFolder;
@@ -1,66 +1,26 @@
1
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
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
39
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
40
4
  };
41
5
  Object.defineProperty(exports, "__esModule", { value: true });
42
6
  exports.verifyUid = exports.signUid = void 0;
43
- var jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
44
- var signUid = function (value) {
45
- return jsonwebtoken_1.default.sign({ value: value }, process.env.JWTSECRET || 'secret', {
7
+ const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
8
+ const signUid = (value) => {
9
+ return jsonwebtoken_1.default.sign({ value }, process.env.JWTSECRET || 'secret', {
46
10
  expiresIn: '8h' // expires in 8 hours
47
11
  });
48
12
  };
49
13
  exports.signUid = signUid;
50
- var verifyUid = function (token) { return __awaiter(void 0, void 0, void 0, function () {
51
- return __generator(this, function (_a) {
52
- return [2 /*return*/, new Promise(function (resolve) {
53
- var jwtToken = token.split(" ")[1] || token;
54
- jsonwebtoken_1.default.verify(jwtToken, process.env.JWTSECRET || 'secret', function (err, decoded) {
55
- if (err) {
56
- // console.log("error verifyUid", err)
57
- resolve(null);
58
- }
59
- else {
60
- resolve(decoded);
61
- }
62
- });
63
- })];
14
+ const verifyUid = async (token) => new Promise(resolve => {
15
+ const jwtToken = token.split(" ")[1] || token;
16
+ jsonwebtoken_1.default.verify(jwtToken, process.env.JWTSECRET || 'secret', (err, decoded) => {
17
+ if (err) {
18
+ // console.log("error verifyUid", err)
19
+ resolve(null);
20
+ }
21
+ else {
22
+ resolve(decoded);
23
+ }
64
24
  });
65
- }); };
25
+ });
66
26
  exports.verifyUid = verifyUid;
@@ -3,27 +3,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.hasAbusiveWords = exports.hasSpecialCharacter = exports.hasExactMatch = void 0;
4
4
  function hasExactMatch(str, word) {
5
5
  // Construct a regular expression to match the word as a whole word
6
- var regex = new RegExp('\\b' + word + '\\b', 'i'); // 'i' for case-insensitive matching
6
+ const regex = new RegExp('\\b' + word + '\\b', 'i'); // 'i' for case-insensitive matching
7
7
  // Test if the word has an exact match in the string
8
8
  return regex.test(str);
9
9
  }
10
10
  exports.hasExactMatch = hasExactMatch;
11
11
  function hasSpecialCharacter(str) {
12
12
  // Define a regular expression with a character class containing special characters
13
- var regex = /[!@#$%^&*()_+\-=\[\]{};:\\|<>\/?]/;
13
+ const regex = /[!@#$%^&*()_+\-=\[\]{};:\\|<>\/?]/;
14
14
  // Test if the string contains any special character
15
15
  return regex.test(str);
16
16
  }
17
17
  exports.hasSpecialCharacter = hasSpecialCharacter;
18
18
  function hasAbusiveWords(str, words) {
19
19
  // Convert the string to lowercase for case-insensitive matching
20
- var lowerStr = str.toLowerCase();
20
+ const lowerStr = str.toLowerCase();
21
21
  if (hasSpecialCharacter(lowerStr)) {
22
22
  return true;
23
23
  }
24
24
  // Check if any abusive word exists in the string
25
- for (var _i = 0, words_1 = words; _i < words_1.length; _i++) {
26
- var word = words_1[_i];
25
+ for (const word of words) {
27
26
  if (hasExactMatch(lowerStr, word.toLowerCase())) {
28
27
  return true;
29
28
  }
package/package.json CHANGED
@@ -1,8 +1,10 @@
1
1
  {
2
2
  "name": "biz-slide-core",
3
- "version": "1.2.85",
3
+ "version": "1.2.87",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": ["dist"],
6
8
  "scripts": {
7
9
  "build": "tsc",
8
10
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -1,62 +0,0 @@
1
- import { Schema, model, Types } from "mongoose";
2
-
3
- export interface ILayoutAnalyticsSchema {
4
- name: string;
5
- count: number;
6
- percentage: number;
7
- }
8
-
9
- export interface IEventsSchema {
10
- name: string;
11
- count: number;
12
- }
13
-
14
- export interface IAnalyticSchema {
15
- appName: string;
16
- noOfPPT: number;
17
- totalDownloaded: number;
18
- navigateFromGPT: number;
19
- noOfGuestPPT: number;
20
- events: Array<IEventsSchema>;
21
- totalSlides: number;
22
- layouts: Array<ILayoutAnalyticsSchema>;
23
- analyticsDate: Date;
24
- templateTypeId: Types.ObjectId;
25
- }
26
-
27
- const eventSchema = new Schema<IEventsSchema>({
28
- name: { type: String, required: true },
29
- count: { type: Number, default: 0 }
30
- }, {
31
- timestamps: false,
32
- _id: false
33
- })
34
-
35
- const layoutAnalyticsSchema = new Schema<ILayoutAnalyticsSchema>({
36
- name: { type: String, required: true },
37
- count: { type: Number, default: 0 },
38
- percentage: { type: Number, default: 0 }
39
- }, {
40
- timestamps: false,
41
- _id: false
42
- });
43
-
44
- const AnalyticSchema = new Schema<IAnalyticSchema>(
45
- {
46
- templateTypeId: { type: Schema.Types.ObjectId, ref: "template-type" },
47
- appName: { type: String, required: true },
48
- noOfPPT: { type: Number, default: 0 },
49
- totalDownloaded: { type: Number, default: 0 },
50
- navigateFromGPT: { type: Number, default: 0 },
51
- noOfGuestPPT: { type: Number, default: 0 },
52
- events: { type: [eventSchema], default: [] },
53
- totalSlides: { type: Number, default: 0 },
54
- layouts: {type: [layoutAnalyticsSchema], default: []},
55
- analyticsDate: { type: Date, default: Date.now }
56
- },
57
- {
58
- timestamps: true,
59
- }
60
- );
61
-
62
- export const AnalyticModel = model<IAnalyticSchema>("analytic", AnalyticSchema);
@@ -1,19 +0,0 @@
1
- export interface IMessageSchema {
2
- message: string;
3
- keys: Array<string>;
4
- }
5
- export interface ISystemLayout {
6
- system: IMessageSchema;
7
- user: IMessageSchema;
8
- }
9
-
10
- export interface IVariantsSystemLayout {
11
- single: {
12
- system: IMessageSchema;
13
- user: IMessageSchema;
14
- },
15
- multiple: {
16
- system: IMessageSchema;
17
- user: IMessageSchema;
18
- }
19
- }
@@ -1,18 +0,0 @@
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);
@@ -1,22 +0,0 @@
1
- import { Schema, model } from "mongoose";
2
-
3
- export interface ICronSchema {
4
- name: string;
5
- status: boolean;
6
- }
7
-
8
-
9
- const CronSchema = new Schema<ICronSchema>(
10
- {
11
- name: { type: String, required: true },
12
- status: { type: Boolean, default: false}
13
- },
14
- {
15
- timestamps: true,
16
- }
17
- );
18
-
19
- CronSchema.index({userId: 1});
20
-
21
-
22
- export const CronModel = model<ICronSchema>("cron", CronSchema);
@@ -1,40 +0,0 @@
1
- import { Schema, model } from "mongoose";
2
-
3
- export interface IEmailTemplateStatus {
4
- sent: boolean;
5
- }
6
-
7
-
8
- export interface ICustomerSchema {
9
- appName: string;
10
- userId: string;
11
- emailId: string;
12
- emailTemplateStatus: Record<string, IEmailTemplateStatus>
13
- }
14
-
15
- const EmailTemplateStatusSchema = new Schema<IEmailTemplateStatus>(
16
- {
17
- sent: { type: Boolean, default: false },
18
- },
19
- {
20
- timestamps: false,
21
- _id: false
22
- }
23
- );
24
-
25
- const CustomerSchema = new Schema<ICustomerSchema>(
26
- {
27
- appName: { type: String, required: true },
28
- userId: { type: String, required: true},
29
- emailId: { type: String, default: "" },
30
- emailTemplateStatus: {type: Map, of: EmailTemplateStatusSchema}
31
- },
32
- {
33
- timestamps: true,
34
- }
35
- );
36
-
37
- CustomerSchema.index({userId: 1});
38
-
39
-
40
- export const CustomerModel = model<ICustomerSchema>("customer", CustomerSchema);
@@ -1,32 +0,0 @@
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);
@@ -1,20 +0,0 @@
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
- export * from "./analytic.entity";
16
- export * from "./ppt-email-queue.entity";
17
- export * from "./customer.entity";
18
- export * from "./cron.entity";
19
-
20
-
@@ -1,20 +0,0 @@
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);
@@ -1,44 +0,0 @@
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
- appName: string;
20
- }
21
-
22
- const PngSvgSchema = new Schema<IPngSvgSchema>(
23
- {
24
- deletedAt: { type: Date, default: null },
25
- isLocked: { type: Boolean, default: false },
26
- optionsDownloaded: Schema.Types.Mixed,
27
- isDownloaded: { type: Boolean, default: false },
28
- isCompleted: { type: Boolean, default: false },
29
- hasError: { type: Boolean, default: false },
30
- userId: { type: String, default: null },
31
- userReaction: { type: Number, default: 0 },
32
- userFeedback: { type: String, default: null },
33
- title: { type: String, default: null },
34
- styleCategory: { type: String, default: null },
35
- styleSubCategory: { type: String, default: null },
36
- colors: { type: [{ type: String, default: null }], default: null, _id: false },
37
- appName: { type: String, default: null },
38
- },
39
- {
40
- timestamps: true,
41
- }
42
- );
43
-
44
- export const PngSvgModel = model<IPngSvgSchema>("png-svg", PngSvgSchema);
@@ -1,22 +0,0 @@
1
- import { Schema, model, Types } from "mongoose";
2
-
3
- export interface IPPTEmailQueueSchema {
4
- pptRef: Types.ObjectId;
5
- emailType: string;
6
- sent: boolean;
7
- }
8
-
9
- const PPTEmailQueueSchema = new Schema<IPPTEmailQueueSchema>(
10
- {
11
- pptRef: { type: Schema.Types.ObjectId, ref: 'ppt' },
12
- emailType: { type: String, required: true },
13
- sent: { type: Boolean, default: false }
14
- },
15
- {
16
- timestamps: true,
17
- }
18
- );
19
-
20
- PPTEmailQueueSchema.index({sent: 1, createdAt: 1});
21
-
22
- export const PPTEmailQueueModel = model<IPPTEmailQueueSchema>("ppt-email-queue", PPTEmailQueueSchema);
@@ -1,25 +0,0 @@
1
- import { Schema, model, Types } from "mongoose";
2
-
3
-
4
- export interface IPPTEventSchema {
5
- pptRef: Types.ObjectId;
6
- event: string;
7
- message: string;
8
- appName: string;
9
- createdAt?: Date;
10
- updatedAt?: Date;
11
- }
12
-
13
- const PPTEventSchema = new Schema<IPPTEventSchema>(
14
- {
15
- pptRef: { type: Schema.Types.ObjectId, ref: 'ppt' },
16
- message: { type: String, default: null },
17
- event: { type: String, default: null },
18
- appName: { type: String, default: null }
19
- },
20
- {
21
- timestamps: true,
22
- }
23
- );
24
-
25
- export const PPTSlideEventModel = model<IPPTEventSchema>("ppt-event", PPTEventSchema);
@@ -1,40 +0,0 @@
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
- originalData: string;
9
- images: string;
10
- staticData: string;
11
- createdAt?: Date;
12
- updatedAt?: Date;
13
- deletedAt?: Date;
14
- istmp?: boolean;
15
- appName: string;
16
- }
17
-
18
- const PPTSlideSchema = new Schema<IPPTSlideSchema>(
19
- {
20
- deletedAt: { type: Date, default: null },
21
- pptRef: { type: Schema.Types.ObjectId, ref: 'ppt' },
22
- slideRef: { type: Schema.Types.ObjectId, ref: 'slide' },
23
- slideLayoutRef: { type: Schema.Types.ObjectId, ref: 'slide-layout' },
24
- title: { type: String, default: null },
25
- rawData: { type: String, default: "{}" },
26
- originalData: { type: String, default: "{}" },
27
- staticData: {type: String, default: "{}" },
28
- images: { type: String, default: "{}" },
29
- istmp: { type: Boolean, default: false },
30
- appName: { type: String, default: null },
31
- },
32
- {
33
- timestamps: true,
34
- }
35
- );
36
-
37
- PPTSlideSchema.index({ createdAt: 1,istmp: 1})
38
-
39
-
40
- export const PPTSlideModel = model<IPPTSlideSchema>("ppt-slide", PPTSlideSchema);
@@ -1,79 +0,0 @@
1
- import { Schema, model, Types } from "mongoose";
2
-
3
- export interface IPPTSchema {
4
- systemGeneratedtopics: Array<string>;
5
- userSelectedTopics: Array<string>;
6
- userLanguageTopics: Array<string>;
7
- colors: Array<string>;
8
- slideRefs: Types.ObjectId[];
9
- templateId: Types.ObjectId;
10
- templateTypeId: Types.ObjectId;
11
- prompt: string;
12
- promptAlias: string;
13
- userId: string;
14
- userReaction: number;
15
- userFeedback: string;
16
- isLocked?: boolean;
17
- fileCreated?: boolean;
18
- isCompleted?: boolean;
19
- createdAt?: Date;
20
- updatedAt?: Date;
21
- deletedAt?: Date;
22
- hasError?: boolean;
23
- version?: string;
24
- noOfSlides: number;
25
- trackIP: string;
26
- sessionId: string;
27
- fileCreateCount: number;
28
- language: string;
29
- info: string;
30
- addtionalInfoUrl: string;
31
- appName: string;
32
- navigateFromGPT: boolean;
33
- googleDriveId: string;
34
- isPartialFile: boolean;
35
- isEditable: boolean;
36
- }
37
-
38
- const PPTSchema = new Schema<IPPTSchema>(
39
- {
40
- deletedAt: { type: Date, default: null },
41
- isLocked: { type: Boolean, default: false },
42
- isCompleted: { type: Boolean, default: false },
43
- fileCreated: { type: Boolean, default: false }, // S3 file creation
44
- userId: { type: String, default: null },
45
- templateTypeId: { type: Schema.Types.ObjectId, ref: "template-type" },
46
- systemGeneratedtopics: { type: [String], default: [], _id: false },
47
- userSelectedTopics: { type: [String], default: [], _id: false },
48
- userLanguageTopics: { type: [String], default: [], _id: false },
49
- userReaction: { type: Number, default: 0 },
50
- userFeedback: { type: String, default: null },
51
- colors: { type: [String], default: [], _id: false },
52
- templateId: { type: Schema.Types.ObjectId, ref: 'template' },
53
- hasError: { type: Boolean, default: false },
54
- slideRefs: {type: [{ type: Schema.Types.ObjectId, ref: 'ppt-slide' }], default: [], _id: false},
55
- version: { type: String, default: null },
56
- trackIP: { type: String, default: null },
57
- sessionId: { type: String, default: null },
58
- fileCreateCount: { type: Number, default: 0},
59
- language: { type: String, default: "English" },
60
- addtionalInfoUrl: { type: String, default: null },
61
- info: { type: String, default: null },
62
- prompt: { type: String, default: null },
63
- promptAlias: { type: String, default: null },
64
- noOfSlides: { type: Number, default: null },
65
- appName: { type: String, default: null },
66
- navigateFromGPT: { type: Boolean, default: false },
67
- googleDriveId: { type: String, default: null }, // google file creation
68
- isPartialFile: { type: Boolean, default: false }, // was free file created
69
- isEditable: { type: Boolean, default: false } // if is editable is true them menas user will get PPT in editable format
70
- },
71
- {
72
- timestamps: true,
73
- }
74
- );
75
-
76
- PPTSchema.index({userId: 1, isCompleted: 1, hasError: 1, isLocked: 1});
77
-
78
-
79
- export const PPTModel = model<IPPTSchema>("ppt", PPTSchema);