@b2y/ecommerce-common 1.2.4 → 1.2.6

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.
@@ -21,6 +21,7 @@ const getAllSubscriptionPlans = (
21
21
  "Currency",
22
22
  "TrialPeriodDays",
23
23
  "IsActive",
24
+ "SortOrder"
24
25
  ],
25
26
  include: [
26
27
  {
@@ -402,7 +402,7 @@ const getTenantById = (
402
402
  {
403
403
  model: SubscriptionPlan,
404
404
  as: "SubscriptionPlan",
405
- attributes: ["SubscriptionPlanID", "PlanName", "PlanCode"],
405
+ attributes: ["SubscriptionPlanID", "PlanName", "PlanCode", "BillingCycle"],
406
406
  },
407
407
  ],
408
408
  },
@@ -462,6 +462,7 @@ const getTenantById = (
462
462
  TenantLogo: logo,
463
463
  SubscriptionPlanID: tenant.CurrentSubscription?.SubscriptionPlan?.SubscriptionPlanID,
464
464
  PlanName: tenant.CurrentSubscription?.SubscriptionPlan?.PlanName,
465
+ BillingCycle: tenant.CurrentSubscription?.SubscriptionPlan?.BillingCycle,
465
466
  TenantSubscriptionStatus: tenant.CurrentSubscription?.Status,
466
467
  StartDate: tenant.CurrentSubscription?.StartDate,
467
468
  EndDate: tenant.CurrentSubscription?.EndDate,
@@ -94,7 +94,7 @@ return async (req, res) => {
94
94
  }
95
95
  }}
96
96
 
97
- const updateTenantSettings = (TenantSettings, multer, upload, FileUploadUtil, FILE_PATHS, UpdatedBy, sequelize, logger) => {
97
+ const updateTenantSettings = (TenantSettings, multer, upload, FileUploadUtil, FILE_PATHS, reqUpdatedBy, sequelize, logger) => {
98
98
  return async (req, res) => {
99
99
  upload(req, res, async (err) => {
100
100
  if (err instanceof multer.MulterError || err) {
@@ -171,12 +171,14 @@ return async (req, res) => {
171
171
  // Update tenant settings
172
172
  const updatePayload = {};
173
173
  if (ThemeColour !== undefined) updatePayload.ThemeColour = ThemeColour;
174
- if(UpdatedBy) {
175
- updatePayload.UpdatedBy = UpdatedBy;
174
+ let updatedBy = null
175
+ if(reqUpdatedBy) {
176
+ updatedBy = reqUpdatedBy;
176
177
  }
177
178
  else {
178
- updatePayload.UpdatedBy = req.user.UserID
179
+ updatedBy = req.user.UserID
179
180
  }
181
+ updatePayload.UpdatedBy = updatedBy
180
182
  updatePayload.UpdatedAt = new Date();
181
183
 
182
184
  await existingSettings.update(updatePayload, { transaction });
@@ -190,7 +192,7 @@ return async (req, res) => {
190
192
  EntityTypeEnum.TENANT_SETTINGS,
191
193
  existingSettings.TenantSettingID,
192
194
  existingSettings.TenantID,
193
- UpdatedBy,
195
+ updatedBy,
194
196
  transaction
195
197
  );
196
198
  }
@@ -40,6 +40,10 @@ module.exports = (sequelize) => {
40
40
  type: DataTypes.BOOLEAN,
41
41
  defaultValue: true,
42
42
  },
43
+ SortOrder: {
44
+ type: DataTypes.INTEGER,
45
+ allowNull: false
46
+ },
43
47
  CreatedBy: {
44
48
  type: DataTypes.UUID,
45
49
  allowNull: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b2y/ecommerce-common",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "E-commerce common library",
5
5
  "main": "index.js",
6
6
  "scripts": {