biz-email-builder-shared 1.6.24 → 1.6.26
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/organisation.entity.d.ts +1 -1
- package/dist/entity/organisation.entity.d.ts.map +1 -1
- package/dist/entity/organisation.entity.js +1 -1
- package/dist/entity/planHistory.entity.d.ts +1 -1
- package/dist/entity/planHistory.entity.d.ts.map +1 -1
- package/dist/entity/planHistory.entity.js +1 -1
- package/dist/entity/subscriptionPlan.entity.d.ts.map +1 -1
- package/dist/entity/subscriptionPlan.entity.js +1 -1
- package/dist/middleware/authentication.js +4 -5
- package/dist/types/IRequest.d.ts +1 -1
- package/dist/types/IRequest.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organisation.entity.d.ts","sourceRoot":"","sources":["../../src/entity/organisation.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,EAAE,MAAM,UAAU,CAAC;AAEhD,MAAM,WAAW,aAAc,SAAQ,QAAQ;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,
|
|
1
|
+
{"version":3,"file":"organisation.entity.d.ts","sourceRoot":"","sources":["../../src/entity/organisation.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,EAAE,MAAM,UAAU,CAAC;AAEhD,MAAM,WAAW,aAAc,SAAQ,QAAQ;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC1B,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;CACjB;AAaD,eAAO,MAAM,iBAAiB;SACs9H,MAAO,QAAQ;;;OAD16H,CAAC"}
|
|
@@ -7,7 +7,7 @@ const OrganisationSchema = new mongoose_1.Schema({
|
|
|
7
7
|
user: { type: mongoose_1.Schema.Types.ObjectId, ref: "user", required: true },
|
|
8
8
|
websiteURL: { type: String, required: true },
|
|
9
9
|
phoneNumber: { type: String, required: true },
|
|
10
|
-
|
|
10
|
+
industryName: { type: String, required: true },
|
|
11
11
|
isDisable: { type: Boolean, default: false },
|
|
12
12
|
deletedAt: { type: Date, default: null },
|
|
13
13
|
updatedBy: { type: mongoose_1.Schema.Types.ObjectId, ref: "user", required: true },
|
|
@@ -11,7 +11,7 @@ export interface ISubscriptionQuota {
|
|
|
11
11
|
publicTemplateCount: number;
|
|
12
12
|
smtpConfigAllowed: boolean;
|
|
13
13
|
canCreateOrganisation: boolean;
|
|
14
|
-
|
|
14
|
+
userLimit: number;
|
|
15
15
|
}
|
|
16
16
|
export interface IPlanHistory extends Document {
|
|
17
17
|
user: Types.ObjectId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planHistory.entity.d.ts","sourceRoot":"","sources":["../../src/entity/planHistory.entity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"planHistory.entity.d.ts","sourceRoot":"","sources":["../../src/entity/planHistory.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAE1D,MAAM,WAAW,mBAAmB;IAClC,kBAAkB,EAAE,KAAK,CAAC,QAAQ,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,eAAe,EAAE,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAa,SAAQ,QAAQ;IAC5C,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC;IACrB,kBAAkB,EAAE,KAAK,CAAC,QAAQ,CAAC;IACnC,YAAY,EAAE,IAAI,CAAC;IACnB,WAAW,EAAE,IAAI,GAAG,IAAI,CAAC;IACzB,iBAAiB,EAAE,IAAI,GAAG,IAAI,CAAC;IAC/B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,IAAI,CAAC;IACrB,wBAAwB,EAAE,OAAO,CAAC;IAClC,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC1B,kBAAkB,EAAE,mBAAmB,EAAE,CAAC;IAC1C,iBAAiB,EAAE,kBAAkB,CAAC;CACvC;AAED,eAAO,MAAM,wBAAwB;SA+Bg5E,MAAO,QAAQ;;;;SAAf,MAAO,QAAQ;;;EA1Bl7E,CAAC;AAEnB,eAAO,MAAM,uBAAuB;SAwBi5E,MAAO,QAAQ;;;;SAAf,MAAO,QAAQ;;;EAjBl7E,CAAC;AAEnB,eAAO,MAAM,iBAAiB;;;;;;;;EAYN,CAAC;AAEzB,eAAO,MAAM,gBAAgB;;;;OAAyD,CAAC"}
|
|
@@ -14,7 +14,7 @@ exports.SubscriptionQuotaSchema = new mongoose_1.Schema({
|
|
|
14
14
|
privateTemplateCount: { type: Number, required: true },
|
|
15
15
|
smtpConfigAllowed: { type: Boolean, default: false },
|
|
16
16
|
canCreateOrganisation: { type: Boolean, default: false },
|
|
17
|
-
|
|
17
|
+
userLimit: { type: Number, default: 0, }
|
|
18
18
|
}, { _id: false });
|
|
19
19
|
exports.PlanHistorySchema = new mongoose_1.Schema({
|
|
20
20
|
user: { type: mongoose_1.Schema.Types.ObjectId, ref: "user", required: true },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptionPlan.entity.d.ts","sourceRoot":"","sources":["../../src/entity/subscriptionPlan.entity.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"subscriptionPlan.entity.d.ts","sourceRoot":"","sources":["../../src/entity/subscriptionPlan.entity.ts"],"names":[],"mappings":"AAAA,OAAO,QAA2B,MAAM,UAAU,CAAC;AAEnD,MAAM,WAAW,iBAAkB,SAAQ,QAAQ;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;IACnC,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAkBD,eAAO,MAAM,qBAAqB;;;;OAAwE,CAAC"}
|
|
@@ -42,7 +42,7 @@ const SubscriptionPlanSchema = new mongoose_1.Schema({
|
|
|
42
42
|
publicTemplateLimit: { type: Number, required: true },
|
|
43
43
|
smtpConfigAllowed: { type: Boolean, required: true },
|
|
44
44
|
canCreateOrganisation: { type: Boolean, default: false },
|
|
45
|
-
userLimit: { type: Number, default:
|
|
45
|
+
userLimit: { type: Number, default: 0 },
|
|
46
46
|
isDeleted: { type: Boolean, default: false },
|
|
47
47
|
updatedBy: { type: mongoose_1.default.Schema.Types.ObjectId, ref: "user", required: true },
|
|
48
48
|
deletedAt: { type: Date, default: null },
|
|
@@ -38,16 +38,15 @@ const authorize = () => {
|
|
|
38
38
|
if (user.role === undefined || user.role === null || !Object.values(email_builder_utils_1.ROLES).includes(user.role)) {
|
|
39
39
|
throw new resHandler_1.UnauthorizedRequestError(utilities_1.SERVER_MESSAGES.SE_NO_ROLE_ASSIGNED_ROLE_INVALID);
|
|
40
40
|
}
|
|
41
|
-
const { createdAt, updatedAt, deletedAt, password } = user, rest = __rest(user, ["createdAt", "updatedAt", "deletedAt", "password"]);
|
|
41
|
+
const { createdAt, updatedAt, deletedAt, password, verificationToken, __v, updateBy, isVerified } = user, rest = __rest(user, ["createdAt", "updatedAt", "deletedAt", "password", "verificationToken", "__v", "updateBy", "isVerified"]);
|
|
42
42
|
req.user = Object.assign({}, rest);
|
|
43
43
|
if (req.user && user.role === email_builder_utils_1.ROLES.ADMIN) {
|
|
44
44
|
req.user.isAdmin = true;
|
|
45
|
-
req.user.groups.push({ name: "
|
|
45
|
+
req.user.groups.push({ name: "ADMIN_GROUP", features: Object.values(email_builder_utils_1.FEATURE_TYPE).map((value) => ({ name: value })) });
|
|
46
46
|
}
|
|
47
|
-
let currentPlanDetail = await entity_1.PlanHistoryModel.find({ user: user._id.toString() }).lean();
|
|
48
|
-
// req.subExpired
|
|
47
|
+
let currentPlanDetail = await entity_1.PlanHistoryModel.find({ user: user._id.toString(), isTransactionSuccessful: true }).lean().exec();
|
|
49
48
|
if (currentPlanDetail && currentPlanDetail.length && currentPlanDetail[0].renewalDate) {
|
|
50
|
-
req.
|
|
49
|
+
req.userSubsciptionQuota = currentPlanDetail[0].subscriptionQuota;
|
|
51
50
|
req.isSubscriptionActive = !(currentPlanDetail[0].renewalDate < new Date());
|
|
52
51
|
}
|
|
53
52
|
next();
|
package/dist/types/IRequest.d.ts
CHANGED
|
@@ -20,8 +20,8 @@ export interface IRequestUser {
|
|
|
20
20
|
}
|
|
21
21
|
export interface IRequest extends Request {
|
|
22
22
|
user?: IRequestUser;
|
|
23
|
-
userSubscriptionQuota?: ISubscriptionQuota;
|
|
24
23
|
isSubscriptionActive?: boolean;
|
|
24
|
+
userSubsciptionQuota?: ISubscriptionQuota;
|
|
25
25
|
file?: any;
|
|
26
26
|
}
|
|
27
27
|
//# sourceMappingURL=IRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IRequest.d.ts","sourceRoot":"","sources":["../../src/types/IRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,KAAK,CAAC;IACZ,UAAU,EAAE,cAAc,CAAC;IAC3B,MAAM,EAAE,KAAK,CAAC;QACV,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,YAAY,CAAA;SAAE,CAAC,CAAA;KAC1C,CAAC,CAAA;IACF,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,QAAS,SAAQ,OAAO;IACrC,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,
|
|
1
|
+
{"version":3,"file":"IRequest.d.ts","sourceRoot":"","sources":["../../src/types/IRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,WAAW,YAAY;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,KAAK,CAAC;IACZ,UAAU,EAAE,cAAc,CAAC;IAC3B,MAAM,EAAE,KAAK,CAAC;QACV,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,YAAY,CAAA;SAAE,CAAC,CAAA;KAC1C,CAAC,CAAA;IACF,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,QAAS,SAAQ,OAAO;IACrC,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,kBAAkB,CAAC;IAC1C,IAAI,CAAC,EAAE,GAAG,CAAC;CACd"}
|