biz-email-builder-shared 1.6.62 → 1.6.69
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/entity/campaign.entity.d.ts +19 -0
- package/dist/entity/campaign.entity.d.ts.map +1 -0
- package/dist/entity/campaign.entity.js +15 -0
- package/dist/entity/campaignUsers.entity.d.ts +15 -0
- package/dist/entity/campaignUsers.entity.d.ts.map +1 -0
- package/dist/entity/campaignUsers.entity.js +11 -0
- package/dist/entity/index.d.ts +2 -0
- package/dist/entity/index.d.ts.map +1 -1
- package/dist/entity/index.js +2 -0
- package/dist/middleware/index.d.ts +1 -0
- package/dist/middleware/index.d.ts.map +1 -1
- package/dist/middleware/index.js +1 -0
- package/dist/middleware/methodNotAllowedHanlder.d.ts +2 -0
- package/dist/middleware/methodNotAllowedHanlder.d.ts.map +1 -0
- package/dist/middleware/methodNotAllowedHanlder.js +9 -0
- package/dist/resHandler/errorHandler.d.ts +3 -0
- package/dist/resHandler/errorHandler.d.ts.map +1 -1
- package/dist/resHandler/errorHandler.js +13 -1
- package/dist/utilities/createRouterWith405.d.ts +3 -0
- package/dist/utilities/createRouterWith405.d.ts.map +1 -0
- package/dist/utilities/createRouterWith405.js +36 -0
- package/dist/utilities/index.d.ts +1 -0
- package/dist/utilities/index.d.ts.map +1 -1
- package/dist/utilities/index.js +1 -0
- package/dist/utilities/sendMail.d.ts.map +1 -1
- package/dist/utilities/sendMail.js +3 -2
- package/dist/utilities/serverMessages.d.ts +3 -1
- package/dist/utilities/serverMessages.d.ts.map +1 -1
- package/dist/utilities/serverMessages.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Types, Document } from "mongoose";
|
|
2
|
+
export interface ICampaign extends Document {
|
|
3
|
+
name: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
createdBy?: Types.ObjectId;
|
|
6
|
+
templateId: Types.ObjectId;
|
|
7
|
+
templateVersion: number;
|
|
8
|
+
organisationId: Types.ObjectId;
|
|
9
|
+
isDeleted?: boolean;
|
|
10
|
+
updateBy?: Types.ObjectId;
|
|
11
|
+
createdAt: Date;
|
|
12
|
+
updatedAt: Date;
|
|
13
|
+
}
|
|
14
|
+
export declare const CampaignModel: import("mongoose").Model<ICampaign, {}, {}, {}, Document<unknown, {}, ICampaign> & ICampaign & Required<{
|
|
15
|
+
_id: unknown;
|
|
16
|
+
}> & {
|
|
17
|
+
__v: number;
|
|
18
|
+
}, any>;
|
|
19
|
+
//# sourceMappingURL=campaign.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"campaign.entity.d.ts","sourceRoot":"","sources":["../../src/entity/campaign.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE1D,MAAM,WAAW,SAAU,SAAQ,QAAQ;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC3B,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC1B,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAgBD,eAAO,MAAM,aAAa;;;;OAA+C,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CampaignModel = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const CampaignSchema = new mongoose_1.Schema({
|
|
6
|
+
name: { type: String, required: true },
|
|
7
|
+
description: { type: String, default: null },
|
|
8
|
+
createdBy: { type: mongoose_1.Schema.Types.ObjectId, ref: "user", required: true },
|
|
9
|
+
templateId: { type: mongoose_1.Schema.Types.ObjectId, ref: "template", required: true },
|
|
10
|
+
templateVersion: { type: Number, required: true, default: 0 },
|
|
11
|
+
organisationId: { type: mongoose_1.Schema.Types.ObjectId, ref: "organisation", required: false, default: null },
|
|
12
|
+
isDeleted: { type: Boolean, default: false },
|
|
13
|
+
updateBy: { type: mongoose_1.Schema.Types.ObjectId, ref: "user", default: null },
|
|
14
|
+
}, { timestamps: true });
|
|
15
|
+
exports.CampaignModel = (0, mongoose_1.model)("campaign", CampaignSchema);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Types } from "mongoose";
|
|
2
|
+
export interface ICampaignUsers extends Document {
|
|
3
|
+
campaignId: Types.ObjectId;
|
|
4
|
+
email: string;
|
|
5
|
+
sentAt?: Date;
|
|
6
|
+
createdAt: Date;
|
|
7
|
+
updatedAt: Date;
|
|
8
|
+
isDelivered?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const CampaignUsersModel: import("mongoose").Model<ICampaignUsers, {}, {}, {}, import("mongoose").Document<unknown, {}, ICampaignUsers> & ICampaignUsers & {
|
|
11
|
+
_id: Types.ObjectId;
|
|
12
|
+
} & {
|
|
13
|
+
__v: number;
|
|
14
|
+
}, any>;
|
|
15
|
+
//# sourceMappingURL=campaignUsers.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"campaignUsers.entity.d.ts","sourceRoot":"","sources":["../../src/entity/campaignUsers.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,EAAE,MAAM,UAAU,CAAC;AAEhD,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC9C,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,IAAI,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAYD,eAAO,MAAM,kBAAkB;SACouI,MAAO,QAAQ;;;OADprI,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CampaignUsersModel = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const CampaignUsersSchema = new mongoose_1.Schema({
|
|
6
|
+
campaignId: { type: mongoose_1.Schema.Types.ObjectId, ref: "campaign", required: true },
|
|
7
|
+
email: { type: String, required: true },
|
|
8
|
+
sentAt: { type: Date, default: Date.now },
|
|
9
|
+
isDelivered: { type: Boolean, default: false },
|
|
10
|
+
}, { timestamps: true });
|
|
11
|
+
exports.CampaignUsersModel = (0, mongoose_1.model)("campaign-users", CampaignUsersSchema);
|
package/dist/entity/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entity/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entity/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC"}
|
package/dist/entity/index.js
CHANGED
|
@@ -29,3 +29,5 @@ __exportStar(require("./user-info.entity"), exports);
|
|
|
29
29
|
__exportStar(require("./license.entity"), exports);
|
|
30
30
|
__exportStar(require("./prompt.entity"), exports);
|
|
31
31
|
__exportStar(require("./socket.entity"), exports);
|
|
32
|
+
__exportStar(require("./campaign.entity"), exports);
|
|
33
|
+
__exportStar(require("./campaignUsers.entity"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/middleware/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/middleware/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC"}
|
package/dist/middleware/index.js
CHANGED
|
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./authentication"), exports);
|
|
18
18
|
__exportStar(require("./schemaValidate"), exports);
|
|
19
|
+
__exportStar(require("./methodNotAllowedHanlder"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methodNotAllowedHanlder.d.ts","sourceRoot":"","sources":["../../src/middleware/methodNotAllowedHanlder.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,uBAAuB,QAAS,OAAO,OAAO,QAAQ,UAElE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.methodNotAllowedHandler = void 0;
|
|
4
|
+
const errorHandler_1 = require("../resHandler/errorHandler");
|
|
5
|
+
const serverMessages_1 = require("../utilities/serverMessages");
|
|
6
|
+
const methodNotAllowedHandler = (req, res) => {
|
|
7
|
+
throw new errorHandler_1.MethodNotAllowedError(serverMessages_1.SERVER_MESSAGES.SE_METHOD_NOT_ALLOWED);
|
|
8
|
+
};
|
|
9
|
+
exports.methodNotAllowedHandler = methodNotAllowedHandler;
|
|
@@ -19,5 +19,8 @@ export declare class UnauthorizedRequestError extends Error {
|
|
|
19
19
|
export declare class ForbiddenRequestError extends Error {
|
|
20
20
|
constructor(message: string);
|
|
21
21
|
}
|
|
22
|
+
export declare class MethodNotAllowedError extends Error {
|
|
23
|
+
constructor(message: string);
|
|
24
|
+
}
|
|
22
25
|
export declare const errorHandler: (err: Error, req: Request, res: Response, next: NextFunction) => void;
|
|
23
26
|
//# 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,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,
|
|
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,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,OAAO,EAAE,MAAM;CAK5B;AAED,eAAO,MAAM,YAAY,QAAS,KAAK,OAAO,OAAO,OAAO,QAAQ,QAAQ,YAAY,SA8BvF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.errorHandler = exports.ForbiddenRequestError = exports.UnauthorizedRequestError = exports.CustomRequestError = exports.NotFoundRequestError = exports.BadRequestError = void 0;
|
|
3
|
+
exports.errorHandler = exports.MethodNotAllowedError = 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);
|
|
@@ -43,6 +43,14 @@ class ForbiddenRequestError extends Error {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
exports.ForbiddenRequestError = ForbiddenRequestError;
|
|
46
|
+
class MethodNotAllowedError extends Error {
|
|
47
|
+
constructor(message) {
|
|
48
|
+
super(message);
|
|
49
|
+
Object.setPrototypeOf(this, MethodNotAllowedError.prototype);
|
|
50
|
+
this.name = "MethodNotAllowedError";
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.MethodNotAllowedError = MethodNotAllowedError;
|
|
46
54
|
const errorHandler = (err, req, res, next) => {
|
|
47
55
|
let statusCode = 500;
|
|
48
56
|
let errorMessage = "Internal Server Error";
|
|
@@ -66,6 +74,10 @@ const errorHandler = (err, req, res, next) => {
|
|
|
66
74
|
statusCode = 422;
|
|
67
75
|
errorMessage = err.message;
|
|
68
76
|
}
|
|
77
|
+
else if (err instanceof MethodNotAllowedError) {
|
|
78
|
+
statusCode = 405;
|
|
79
|
+
errorMessage = err.message;
|
|
80
|
+
}
|
|
69
81
|
else {
|
|
70
82
|
console.error(err.stack);
|
|
71
83
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRouterWith405.d.ts","sourceRoot":"","sources":["../../src/utilities/createRouterWith405.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAE,MAAM,EAAoC,MAAM,SAAS,CAAC;AAO5E,wBAAgB,mBAAmB,IAAI,MAAM,CA8B5C"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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.createRouterWith405 = createRouterWith405;
|
|
7
|
+
const express_1 = __importDefault(require("express"));
|
|
8
|
+
const methodNotAllowedHanlder_1 = require("../middleware/methodNotAllowedHanlder");
|
|
9
|
+
const methods = ["get", "post", "put", "patch", "delete"];
|
|
10
|
+
function createRouterWith405() {
|
|
11
|
+
const router = express_1.default.Router();
|
|
12
|
+
const pathMethodMap = new Map();
|
|
13
|
+
// Wrap each HTTP method
|
|
14
|
+
for (const method of methods) {
|
|
15
|
+
const original = router[method].bind(router);
|
|
16
|
+
router[method] = ((path, ...handlers) => {
|
|
17
|
+
if (!pathMethodMap.has(path)) {
|
|
18
|
+
pathMethodMap.set(path, new Set());
|
|
19
|
+
}
|
|
20
|
+
pathMethodMap.get(path).add(method);
|
|
21
|
+
return original(path, ...handlers);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
// After a tick, add fallback handlers
|
|
25
|
+
process.nextTick(() => {
|
|
26
|
+
pathMethodMap.forEach((allowedMethods, path) => {
|
|
27
|
+
router.all(path, (req, res, next) => {
|
|
28
|
+
if (allowedMethods.has(req.method.toLowerCase())) {
|
|
29
|
+
return next();
|
|
30
|
+
}
|
|
31
|
+
return (0, methodNotAllowedHanlder_1.methodNotAllowedHandler)(req, res);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
return router;
|
|
36
|
+
}
|
|
@@ -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;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
|
|
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;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC"}
|
package/dist/utilities/index.js
CHANGED
|
@@ -27,3 +27,4 @@ __exportStar(require("./sendMailViaEnvFallback"), exports);
|
|
|
27
27
|
__exportStar(require("./sendMail"), exports);
|
|
28
28
|
__exportStar(require("./sendFromGmail"), exports);
|
|
29
29
|
__exportStar(require("./getPromptResult"), exports);
|
|
30
|
+
__exportStar(require("./createRouterWith405"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendMail.d.ts","sourceRoot":"","sources":["../../src/utilities/sendMail.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"sendMail.d.ts","sourceRoot":"","sources":["../../src/utilities/sendMail.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAMhD,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EACpC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAC7B,WAAW,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,OAAO,EAC1C,cAAc,CAAC,EAAE,MAAM,oEAqDxB"}
|
|
@@ -8,6 +8,7 @@ const sendMailViaSMTP_1 = require("./sendMailViaSMTP");
|
|
|
8
8
|
const errorHandler_1 = require("../resHandler/errorHandler");
|
|
9
9
|
const sendFromGmail_1 = require("./sendFromGmail");
|
|
10
10
|
const cryptoUtils_1 = require("./cryptoUtils");
|
|
11
|
+
const serverMessages_1 = require("./serverMessages");
|
|
11
12
|
async function sendMail(userId, recipient, subject, body, attachments, isHtml, organisationId) {
|
|
12
13
|
let config = null;
|
|
13
14
|
let isOwner;
|
|
@@ -23,8 +24,8 @@ async function sendMail(userId, recipient, subject, body, attachments, isHtml, o
|
|
|
23
24
|
const org = await entity_1.OrganisationModel.findById(organisationId);
|
|
24
25
|
config = await entity_1.EmailConfigurationModel.findOne({ user: org === null || org === void 0 ? void 0 : org.createdBy, isDeleted: false, }).lean();
|
|
25
26
|
}
|
|
26
|
-
if (!isMember
|
|
27
|
-
throw new errorHandler_1.ForbiddenRequestError(
|
|
27
|
+
if (!isMember && !isOwner) {
|
|
28
|
+
throw new errorHandler_1.ForbiddenRequestError(serverMessages_1.SERVER_MESSAGES.SE_USER_IS_NOT_PART_OF_ORGANISATION);
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
31
|
else {
|
|
@@ -6,6 +6,8 @@ export declare enum SERVER_MESSAGES {
|
|
|
6
6
|
SE_FORBIDDEN_ROLE_ACCESS_DENIED = "SE_FORBIDDEN_ROLE_ACCESS_DENIED",
|
|
7
7
|
SE_FORBIDDEN_FEATURE_ACCESS_DENIED = "SE_FORBIDDEN_FEATURE_ACCESS_DENIED",
|
|
8
8
|
SE_NO_ROLE_ASSIGNED_ROLE_INVALID = "SE_NO_ROLE_ASSIGNED_ROLE_INVALID",
|
|
9
|
-
SE_INVALID_TOKEN = "SE_INVALID_TOKEN"
|
|
9
|
+
SE_INVALID_TOKEN = "SE_INVALID_TOKEN",
|
|
10
|
+
SE_USER_IS_NOT_PART_OF_ORGANISATION = "SE_USER_IS_NOT_PART_OF_ORGANISATION",
|
|
11
|
+
SE_METHOD_NOT_ALLOWED = "SE_METHOD_NOT_ALLOWED"
|
|
10
12
|
}
|
|
11
13
|
//# sourceMappingURL=serverMessages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverMessages.d.ts","sourceRoot":"","sources":["../../src/utilities/serverMessages.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,gBAAgB,qBAAqB;IACrC,eAAe,oBAAoB;IACnC,kBAAkB,uBAAuB;IACzC,iBAAiB,sBAAsB;IACvC,+BAA+B,oCAAoC;IACnE,kCAAkC,uCAAuC;IACzE,gCAAgC,qCAAqC;IACrE,gBAAgB,qBAAqB;
|
|
1
|
+
{"version":3,"file":"serverMessages.d.ts","sourceRoot":"","sources":["../../src/utilities/serverMessages.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IACzB,gBAAgB,qBAAqB;IACrC,eAAe,oBAAoB;IACnC,kBAAkB,uBAAuB;IACzC,iBAAiB,sBAAsB;IACvC,+BAA+B,oCAAoC;IACnE,kCAAkC,uCAAuC;IACzE,gCAAgC,qCAAqC;IACrE,gBAAgB,qBAAqB;IACrC,mCAAmC,wCAAwC;IAC3E,qBAAqB,0BAA0B;CAChD"}
|
|
@@ -11,4 +11,6 @@ var SERVER_MESSAGES;
|
|
|
11
11
|
SERVER_MESSAGES["SE_FORBIDDEN_FEATURE_ACCESS_DENIED"] = "SE_FORBIDDEN_FEATURE_ACCESS_DENIED";
|
|
12
12
|
SERVER_MESSAGES["SE_NO_ROLE_ASSIGNED_ROLE_INVALID"] = "SE_NO_ROLE_ASSIGNED_ROLE_INVALID";
|
|
13
13
|
SERVER_MESSAGES["SE_INVALID_TOKEN"] = "SE_INVALID_TOKEN";
|
|
14
|
+
SERVER_MESSAGES["SE_USER_IS_NOT_PART_OF_ORGANISATION"] = "SE_USER_IS_NOT_PART_OF_ORGANISATION";
|
|
15
|
+
SERVER_MESSAGES["SE_METHOD_NOT_ALLOWED"] = "SE_METHOD_NOT_ALLOWED";
|
|
14
16
|
})(SERVER_MESSAGES || (exports.SERVER_MESSAGES = SERVER_MESSAGES = {}));
|