biz-email-builder-shared 1.6.0 → 1.6.2
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/dist/middleware/authentication.d.ts +3 -3
- package/dist/middleware/authentication.d.ts.map +1 -1
- package/dist/middleware/authentication.js +16 -13
- package/dist/middleware/schemaValidate.d.ts +2 -2
- package/dist/middleware/schemaValidate.d.ts.map +1 -1
- package/dist/middleware/schemaValidate.js +3 -2
- package/dist/resHandler/errorHandler.d.ts +7 -1
- package/dist/resHandler/errorHandler.d.ts.map +1 -1
- package/dist/resHandler/errorHandler.js +33 -11
- package/dist/utilities/index.d.ts +2 -1
- package/dist/utilities/index.d.ts.map +1 -1
- package/dist/utilities/index.js +1 -0
- package/package.json +1 -1
- package/dist/entity/emailTemplate.entity.d.ts +0 -5
- package/dist/entity/emailTemplate.entity.d.ts.map +0 -1
- package/dist/entity/emailTemplate.entity.js +0 -45
- package/dist/entity/role.entitty.d.ts +0 -14
- package/dist/entity/role.entitty.d.ts.map +0 -1
- package/dist/entity/role.entitty.js +0 -13
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Response, NextFunction } from "express";
|
|
2
2
|
import { FEATURE_TYPE, ROLES } from "../utilities";
|
|
3
3
|
import { IRequest } from "../types";
|
|
4
|
-
declare const authorize: () => (req: IRequest, res: Response, next: NextFunction) => Promise<
|
|
5
|
-
declare const checkRoleAccess: (roles: ROLES[]) => (req: IRequest, res: Response, next: NextFunction) => Promise<
|
|
6
|
-
declare const checkFeatureAccess: (features: FEATURE_TYPE[]) => (req: IRequest, res: Response, next: NextFunction) => Promise<
|
|
4
|
+
declare const authorize: () => (req: IRequest, res: Response, next: NextFunction) => Promise<void>;
|
|
5
|
+
declare const checkRoleAccess: (roles: ROLES[]) => (req: IRequest, res: Response, next: NextFunction) => Promise<void>;
|
|
6
|
+
declare const checkFeatureAccess: (features: FEATURE_TYPE[]) => (req: IRequest, res: Response, next: NextFunction) => Promise<void>;
|
|
7
7
|
export { authorize, checkFeatureAccess, checkRoleAccess };
|
|
8
8
|
//# sourceMappingURL=authentication.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../src/middleware/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,KAAK,EAA8B,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIpC,QAAA,MAAM,SAAS,cACe,QAAQ,OAAO,QAAQ,QAAQ,YAAY,
|
|
1
|
+
{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../src/middleware/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,KAAK,EAA8B,MAAM,cAAc,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIpC,QAAA,MAAM,SAAS,cACe,QAAQ,OAAO,QAAQ,QAAQ,YAAY,kBA0CxE,CAAC;AAEF,QAAA,MAAM,eAAe,UAAW,KAAK,EAAE,WACT,QAAQ,OAAO,QAAQ,QAAQ,YAAY,kBAaxE,CAAC;AAEF,QAAA,MAAM,kBAAkB,aAAc,YAAY,EAAE,WACtB,QAAQ,OAAO,QAAQ,QAAQ,YAAY,kBAgBxE,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -14,32 +14,35 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.checkRoleAccess = exports.checkFeatureAccess = exports.authorize = void 0;
|
|
15
15
|
const utilities_1 = require("../utilities");
|
|
16
16
|
const entity_1 = require("../entity");
|
|
17
|
+
const resHandler_1 = require("../resHandler");
|
|
17
18
|
const authorize = () => {
|
|
18
19
|
return async function (req, res, next) {
|
|
19
20
|
try {
|
|
20
21
|
if (!req.headers.authorization) {
|
|
21
|
-
|
|
22
|
+
throw new resHandler_1.UnauthorizedRequestError(utilities_1.SERVER_MESSAGES.SE_UNAUTHORIZED);
|
|
22
23
|
}
|
|
23
24
|
if (req.headers.authorization) {
|
|
24
25
|
const token = await (0, utilities_1.verifyUid)(req.headers.authorization);
|
|
25
26
|
if (!token) {
|
|
26
|
-
|
|
27
|
+
throw new resHandler_1.UnauthorizedRequestError(utilities_1.SERVER_MESSAGES.SE_SESSION_EXPIRED);
|
|
27
28
|
}
|
|
28
|
-
let user = await entity_1.UserModel.findById(token.value.id)
|
|
29
|
+
let user = await entity_1.UserModel.findById(token.value.id)
|
|
30
|
+
.populate({
|
|
29
31
|
path: "groups",
|
|
30
32
|
populate: { path: "features", select: "name" },
|
|
31
|
-
})
|
|
33
|
+
})
|
|
34
|
+
.lean();
|
|
32
35
|
if (!user) {
|
|
33
|
-
|
|
36
|
+
throw new resHandler_1.UnauthorizedRequestError(utilities_1.SERVER_MESSAGES.SE_USER_NOT_FOUND);
|
|
34
37
|
}
|
|
35
38
|
if (user.role === undefined || user.role === null || !Object.values(utilities_1.ROLES).includes(user.role)) {
|
|
36
|
-
|
|
39
|
+
throw new resHandler_1.UnauthorizedRequestError(utilities_1.SERVER_MESSAGES.SE_NO_ROLE_ASSIGNED_ROLE_INVALID);
|
|
37
40
|
}
|
|
38
41
|
const { createdAt, updatedAt, deletedAt, password } = user, rest = __rest(user, ["createdAt", "updatedAt", "deletedAt", "password"]);
|
|
39
42
|
req.user = rest;
|
|
40
43
|
if (req.user && user.role === utilities_1.ROLES.ADMIN) {
|
|
41
44
|
req.user.isAdmin = true;
|
|
42
|
-
req.user.groups.push({ name: "DEFAULT", features: Object.values(utilities_1.FEATURE_TYPE).map(value => ({ name: value })) });
|
|
45
|
+
req.user.groups.push({ name: "DEFAULT", features: Object.values(utilities_1.FEATURE_TYPE).map((value) => ({ name: value })) });
|
|
43
46
|
}
|
|
44
47
|
next();
|
|
45
48
|
}
|
|
@@ -54,11 +57,11 @@ const checkRoleAccess = (roles) => {
|
|
|
54
57
|
return async function (req, res, next) {
|
|
55
58
|
const { user } = req;
|
|
56
59
|
if (!user) {
|
|
57
|
-
|
|
60
|
+
throw new resHandler_1.UnauthorizedRequestError(utilities_1.SERVER_MESSAGES.SE_UNAUTHORIZED);
|
|
58
61
|
}
|
|
59
|
-
const hasAccess = roles.find(role => role === user.role);
|
|
62
|
+
const hasAccess = roles.find((role) => role === user.role);
|
|
60
63
|
if (!hasAccess) {
|
|
61
|
-
|
|
64
|
+
throw new resHandler_1.UnauthorizedRequestError(utilities_1.SERVER_MESSAGES.SE_FORBIDDEN_ROLE_ACCESS_DENIED);
|
|
62
65
|
}
|
|
63
66
|
next();
|
|
64
67
|
};
|
|
@@ -68,12 +71,12 @@ const checkFeatureAccess = (features) => {
|
|
|
68
71
|
return async function (req, res, next) {
|
|
69
72
|
const { user } = req;
|
|
70
73
|
if (!user) {
|
|
71
|
-
|
|
74
|
+
throw new resHandler_1.UnauthorizedRequestError(utilities_1.SERVER_MESSAGES.SE_UNAUTHORIZED);
|
|
72
75
|
}
|
|
73
|
-
const userFeatureNames = user.groups.flatMap(group => group.features ? group.features.map((feature) => feature.name) : []);
|
|
76
|
+
const userFeatureNames = user.groups.flatMap((group) => (group.features ? group.features.map((feature) => feature.name) : []));
|
|
74
77
|
const hasAccess = features.some((feature) => userFeatureNames.includes(feature));
|
|
75
78
|
if (!hasAccess) {
|
|
76
|
-
|
|
79
|
+
throw new resHandler_1.ForbiddenRequestError(utilities_1.SERVER_MESSAGES.SE_FORBIDDEN_FEATURE_ACCESS_DENIED);
|
|
77
80
|
}
|
|
78
81
|
next();
|
|
79
82
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NextFunction, Response } from "express";
|
|
2
|
-
import Joi from
|
|
2
|
+
import Joi from "joi";
|
|
3
3
|
import { IRequest } from "../types";
|
|
4
|
-
export declare const validateSchema: (schema: Joi.ObjectSchema<any>) => (req: IRequest, res: Response, next: NextFunction) => Promise<
|
|
4
|
+
export declare const validateSchema: (schema: Joi.ObjectSchema<any>) => (req: IRequest, res: Response, next: NextFunction) => Promise<void>;
|
|
5
5
|
//# sourceMappingURL=schemaValidate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemaValidate.d.ts","sourceRoot":"","sources":["../../src/middleware/schemaValidate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"schemaValidate.d.ts","sourceRoot":"","sources":["../../src/middleware/schemaValidate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAIpC,eAAO,MAAM,cAAc,WAAY,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,WAC9B,QAAQ,OAAO,QAAQ,QAAQ,YAAY,kBAUxE,CAAC"}
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateSchema = void 0;
|
|
4
4
|
const utilities_1 = require("../utilities");
|
|
5
|
+
const resHandler_1 = require("../resHandler");
|
|
5
6
|
const validateSchema = (schema) => {
|
|
6
7
|
return async function (req, res, next) {
|
|
7
8
|
const { error } = schema.validate(req.body, { abortEarly: false });
|
|
8
9
|
if (error) {
|
|
9
|
-
const errorMessage = error.details.map((err) => err.message).join(
|
|
10
|
-
|
|
10
|
+
const errorMessage = error.details.map((err) => err.message).join(", ");
|
|
11
|
+
throw new resHandler_1.BadRequestError(`{ message: ${utilities_1.SERVER_MESSAGES.SE_INVALID_INPUT}, description: ${errorMessage}`);
|
|
11
12
|
}
|
|
12
13
|
else {
|
|
13
14
|
next();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Request, Response, NextFunction } from
|
|
1
|
+
import { Request, Response, NextFunction } from "express";
|
|
2
2
|
export declare class BadRequestError extends Error {
|
|
3
3
|
constructor(message: string);
|
|
4
4
|
}
|
|
@@ -13,5 +13,11 @@ export declare class CustomRequestError {
|
|
|
13
13
|
};
|
|
14
14
|
constructor(title: string, description: string);
|
|
15
15
|
}
|
|
16
|
+
export declare class UnauthorizedRequestError extends Error {
|
|
17
|
+
constructor(message: string);
|
|
18
|
+
}
|
|
19
|
+
export declare class ForbiddenRequestError extends Error {
|
|
20
|
+
constructor(message: string);
|
|
21
|
+
}
|
|
16
22
|
export declare const errorHandler: (err: Error, req: Request, res: Response, next: NextFunction) => void;
|
|
17
23
|
//# sourceMappingURL=errorHandler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorHandler.d.ts","sourceRoot":"","sources":["../../src/resHandler/errorHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE1D,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAK5B;AAED,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM;CAK5B;AAED,qBAAa,kBAAkB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"errorHandler.d.ts","sourceRoot":"","sources":["../../src/resHandler/errorHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE1D,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAK5B;AAED,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,OAAO,EAAE,MAAM;CAK5B;AAED,qBAAa,kBAAkB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;gBAEU,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;CAO/C;AAED,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,EAAE,MAAM;CAK5B;AAED,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,OAAO,EAAE,MAAM;CAK5B;AAED,eAAO,MAAM,YAAY,QAAS,KAAK,OAAO,OAAO,OAAO,QAAQ,QAAQ,YAAY,SA2BvF,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.errorHandler = exports.CustomRequestError = exports.NotFoundRequestError = exports.BadRequestError = void 0;
|
|
3
|
+
exports.errorHandler = exports.ForbiddenRequestError = exports.UnauthorizedRequestError = exports.CustomRequestError = exports.NotFoundRequestError = exports.BadRequestError = void 0;
|
|
4
4
|
class BadRequestError extends Error {
|
|
5
5
|
constructor(message) {
|
|
6
6
|
super(message);
|
|
7
7
|
Object.setPrototypeOf(this, BadRequestError.prototype);
|
|
8
|
-
this.name =
|
|
8
|
+
this.name = "BadRequestError";
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
exports.BadRequestError = BadRequestError;
|
|
@@ -13,24 +13,39 @@ class NotFoundRequestError extends Error {
|
|
|
13
13
|
constructor(message) {
|
|
14
14
|
super(message);
|
|
15
15
|
Object.setPrototypeOf(this, NotFoundRequestError.prototype);
|
|
16
|
-
this.name =
|
|
16
|
+
this.name = "NotFoundRequestError";
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
exports.NotFoundRequestError = NotFoundRequestError;
|
|
20
20
|
class CustomRequestError {
|
|
21
21
|
constructor(title, description) {
|
|
22
|
-
this.name =
|
|
22
|
+
this.name = "CustomRequestError";
|
|
23
23
|
this.message = {
|
|
24
24
|
title,
|
|
25
|
-
description
|
|
25
|
+
description,
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
exports.CustomRequestError = CustomRequestError;
|
|
30
|
-
|
|
30
|
+
class UnauthorizedRequestError extends Error {
|
|
31
|
+
constructor(message) {
|
|
32
|
+
super(message);
|
|
33
|
+
Object.setPrototypeOf(this, UnauthorizedRequestError.prototype);
|
|
34
|
+
this.name = "UnauthorizedRequestError";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.UnauthorizedRequestError = UnauthorizedRequestError;
|
|
38
|
+
class ForbiddenRequestError extends Error {
|
|
39
|
+
constructor(message) {
|
|
40
|
+
super(message);
|
|
41
|
+
Object.setPrototypeOf(this, ForbiddenRequestError.prototype);
|
|
42
|
+
this.name = "ForbiddenRequestError";
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.ForbiddenRequestError = ForbiddenRequestError;
|
|
31
46
|
const errorHandler = (err, req, res, next) => {
|
|
32
|
-
let statusCode = 500;
|
|
33
|
-
let errorMessage =
|
|
47
|
+
let statusCode = 500;
|
|
48
|
+
let errorMessage = "Internal Server Error";
|
|
34
49
|
if (err instanceof BadRequestError) {
|
|
35
50
|
statusCode = 400;
|
|
36
51
|
errorMessage = err.message;
|
|
@@ -39,17 +54,24 @@ const errorHandler = (err, req, res, next) => {
|
|
|
39
54
|
statusCode = 404;
|
|
40
55
|
errorMessage = err.message;
|
|
41
56
|
}
|
|
57
|
+
else if (err instanceof UnauthorizedRequestError) {
|
|
58
|
+
statusCode = 401;
|
|
59
|
+
errorMessage = err.message;
|
|
60
|
+
}
|
|
61
|
+
else if (err instanceof ForbiddenRequestError) {
|
|
62
|
+
statusCode = 403;
|
|
63
|
+
errorMessage = err.message;
|
|
64
|
+
}
|
|
42
65
|
else if (err instanceof CustomRequestError) {
|
|
43
66
|
statusCode = 422;
|
|
44
67
|
errorMessage = err.message;
|
|
45
68
|
}
|
|
46
69
|
else {
|
|
47
|
-
console.error(err.stack);
|
|
70
|
+
console.error(err.stack);
|
|
48
71
|
}
|
|
49
|
-
// Send an error response
|
|
50
72
|
res.status(statusCode).json({
|
|
51
73
|
message: errorMessage,
|
|
52
|
-
error: err.name
|
|
74
|
+
error: err.name,
|
|
53
75
|
});
|
|
54
76
|
};
|
|
55
77
|
exports.errorHandler = errorHandler;
|
|
@@ -35,6 +35,7 @@ export declare enum FEATURE_TYPE {
|
|
|
35
35
|
DELETE_TEMPLATE = "DELETE_TEMPLATE",
|
|
36
36
|
SHARE_TEMPLATE = "SHARE_TEMPLATE",
|
|
37
37
|
UPDATE_TEAMPLATE = "UPDATE_TEAMPLATE",
|
|
38
|
-
LIST_TEMPLATE = "LIST_TEMPLATE"
|
|
38
|
+
LIST_TEMPLATE = "LIST_TEMPLATE",
|
|
39
|
+
SEND_EMAIL = "SEND_EMAIL"
|
|
39
40
|
}
|
|
40
41
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AAEjC,oBAAY,KAAK;IACf,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,oBAAY,WAAW;IACrB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,WAAW,gBAAgB;CAC5B;AAED,oBAAY,cAAc;IACxB,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED,oBAAY,YAAY;IAEtB,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AAEjC,oBAAY,KAAK;IACf,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAED,oBAAY,WAAW;IACrB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,WAAW,gBAAgB;CAC5B;AAED,oBAAY,cAAc;IACxB,KAAK,UAAU;IACf,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED,oBAAY,YAAY;IAEtB,QAAQ,aAAa;IACrB,WAAW,gBAAgB;IAC3B,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IAGvB,cAAc,mBAAmB;IACjC,iBAAiB,sBAAsB;IACvC,iBAAiB,sBAAsB;IACvC,eAAe,oBAAoB;IACnC,cAAc,mBAAmB;IAGjC,0BAA0B,+BAA+B;IACzD,cAAc,mBAAmB;IACjC,eAAe,oBAAoB;IACnC,YAAY,iBAAiB;IAC7B,eAAe,oBAAoB;IACnC,cAAc,mBAAmB;IACjC,gBAAgB,qBAAqB;IACrC,aAAa,kBAAkB;IAC/B,UAAU,eAAe;CAC1B"}
|
package/dist/utilities/index.js
CHANGED
|
@@ -60,4 +60,5 @@ var FEATURE_TYPE;
|
|
|
60
60
|
FEATURE_TYPE["SHARE_TEMPLATE"] = "SHARE_TEMPLATE";
|
|
61
61
|
FEATURE_TYPE["UPDATE_TEAMPLATE"] = "UPDATE_TEAMPLATE";
|
|
62
62
|
FEATURE_TYPE["LIST_TEMPLATE"] = "LIST_TEMPLATE";
|
|
63
|
+
FEATURE_TYPE["SEND_EMAIL"] = "SEND_EMAIL";
|
|
63
64
|
})(FEATURE_TYPE || (exports.FEATURE_TYPE = FEATURE_TYPE = {}));
|
package/package.json
CHANGED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { IEmailTemplateLayout } from "../types";
|
|
2
|
-
export declare const EmailTemplate: import("mongoose").Model<IEmailTemplateLayout, {}, {}, {}, import("mongoose").Document<unknown, {}, IEmailTemplateLayout> & Omit<IEmailTemplateLayout & {
|
|
3
|
-
_id: import("mongoose").Types.ObjectId;
|
|
4
|
-
}, never>, any>;
|
|
5
|
-
//# sourceMappingURL=emailTemplate.entity.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"emailTemplate.entity.d.ts","sourceRoot":"","sources":["../../src/entity/emailTemplate.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAwD3D,eAAO,MAAM,aAAa;;eAAqE,CAAC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EmailTemplate = void 0;
|
|
4
|
-
const mongoose_1 = require("mongoose");
|
|
5
|
-
const types_1 = require("../types");
|
|
6
|
-
const BlockDataPropsSchema = new mongoose_1.Schema({
|
|
7
|
-
imageUrl: { type: String, default: "" },
|
|
8
|
-
text: { type: String, default: "" },
|
|
9
|
-
rows: { type: Number, default: 0 },
|
|
10
|
-
columns: { type: Number, default: 0 },
|
|
11
|
-
navigateToUrl: { type: String, default: "" },
|
|
12
|
-
altText: { type: String, default: "" },
|
|
13
|
-
cellWidths: { type: [Number], default: [] },
|
|
14
|
-
}, { _id: false });
|
|
15
|
-
const BlockDataSchema = new mongoose_1.Schema({
|
|
16
|
-
style: { type: mongoose_1.Schema.Types.Mixed },
|
|
17
|
-
props: { type: BlockDataPropsSchema },
|
|
18
|
-
childrenIds: { type: [String], default: [] },
|
|
19
|
-
}, { _id: false });
|
|
20
|
-
const BlockSchema = new mongoose_1.Schema({
|
|
21
|
-
type: {
|
|
22
|
-
type: String,
|
|
23
|
-
required: true,
|
|
24
|
-
enum: Object.values(types_1.BlockType),
|
|
25
|
-
},
|
|
26
|
-
data: BlockDataSchema,
|
|
27
|
-
}, { _id: false });
|
|
28
|
-
const EmailTemplateSchema = new mongoose_1.Schema({
|
|
29
|
-
name: {
|
|
30
|
-
type: String,
|
|
31
|
-
required: true
|
|
32
|
-
},
|
|
33
|
-
layout: {
|
|
34
|
-
type: Map,
|
|
35
|
-
of: BlockSchema,
|
|
36
|
-
required: true,
|
|
37
|
-
},
|
|
38
|
-
isDeleted: {
|
|
39
|
-
type: Boolean,
|
|
40
|
-
default: false,
|
|
41
|
-
},
|
|
42
|
-
user: { type: mongoose_1.Schema.Types.ObjectId, ref: 'user' },
|
|
43
|
-
deletedAt: Date
|
|
44
|
-
}, { timestamps: true });
|
|
45
|
-
exports.EmailTemplate = (0, mongoose_1.model)("email-template", EmailTemplateSchema);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Types } from "mongoose";
|
|
2
|
-
interface IRole {
|
|
3
|
-
name: string;
|
|
4
|
-
isDeleted: boolean;
|
|
5
|
-
createdAt: Date;
|
|
6
|
-
updatedAt: Date;
|
|
7
|
-
deletedAt: Date;
|
|
8
|
-
features: Types.ObjectId[];
|
|
9
|
-
}
|
|
10
|
-
export declare const RoleModel: import("mongoose").Model<IRole, {}, {}, {}, import("mongoose").Document<unknown, {}, IRole> & Omit<IRole & {
|
|
11
|
-
_id: Types.ObjectId;
|
|
12
|
-
}, never>, any>;
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=role.entitty.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"role.entitty.d.ts","sourceRoot":"","sources":["../../src/entity/role.entitty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,EAAE,MAAM,UAAU,CAAC;AAEhD,UAAU,KAAK;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;CAC5B;AAcD,eAAO,MAAM,SAAS;SAC4mI,MAAO,QAAQ;eADxlI,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RoleModel = void 0;
|
|
4
|
-
const mongoose_1 = require("mongoose");
|
|
5
|
-
const RoleSchema = new mongoose_1.Schema({
|
|
6
|
-
name: { type: String, unique: true, sparse: true },
|
|
7
|
-
isDeleted: { type: Boolean, default: false },
|
|
8
|
-
deletedAt: { type: Date, default: null },
|
|
9
|
-
features: { type: [{ type: mongoose_1.Schema.Types.ObjectId, ref: 'feature' }], default: [], _id: false },
|
|
10
|
-
}, {
|
|
11
|
-
timestamps: true,
|
|
12
|
-
});
|
|
13
|
-
exports.RoleModel = (0, mongoose_1.model)("role", RoleSchema);
|