@b2y/ecommerce-common 1.1.7 → 1.1.9
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.
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const AppUtil = require('../utility/AppUtil');
|
|
2
|
+
const StatusMessage = require('../constants/StatusMessageConstants');
|
|
3
|
+
|
|
4
|
+
getAllPermissions = (Permission, logger) => {
|
|
5
|
+
return async (req, res) => {
|
|
6
|
+
const { pageNumber, pageSize } = req.query;
|
|
7
|
+
try {
|
|
8
|
+
const { limit, offset } = AppUtil.getPagination(pageNumber, pageSize);
|
|
9
|
+
|
|
10
|
+
const { rows, count } = await Permission.findAndCountAll({
|
|
11
|
+
attributes: ["PermissionID", "Module", "Name", "IsChecked"],
|
|
12
|
+
limit,
|
|
13
|
+
offset,
|
|
14
|
+
});
|
|
15
|
+
return AppUtil.generateResponse(
|
|
16
|
+
200,
|
|
17
|
+
StatusMessage.SUCCESS,
|
|
18
|
+
null,
|
|
19
|
+
{ rows, count, pageNumber, limit },
|
|
20
|
+
res,
|
|
21
|
+
);
|
|
22
|
+
} catch (error) {
|
|
23
|
+
logger.error("Error fetching permissions:", error);
|
|
24
|
+
return AppUtil.generateResponse(
|
|
25
|
+
500,
|
|
26
|
+
StatusMessage.FAILURE,
|
|
27
|
+
StatusMessage.SERVER_ERROR,
|
|
28
|
+
null,
|
|
29
|
+
res,
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
module.exports = {getAllPermissions}
|
|
@@ -8,6 +8,7 @@ const updateTenant = (
|
|
|
8
8
|
Tenant,
|
|
9
9
|
TenantSubscription,
|
|
10
10
|
SubscriptionPlan,
|
|
11
|
+
UpdatedBy,
|
|
11
12
|
sequelize,
|
|
12
13
|
logger,
|
|
13
14
|
) => {
|
|
@@ -202,7 +203,7 @@ const updateTenant = (
|
|
|
202
203
|
});
|
|
203
204
|
|
|
204
205
|
updatePayload.UpdatedBy =
|
|
205
|
-
|
|
206
|
+
UpdatedBy;
|
|
206
207
|
updatePayload.UpdatedAt = new Date();
|
|
207
208
|
|
|
208
209
|
await existing.update(updatePayload, { transaction });
|
|
@@ -224,7 +225,7 @@ const updateTenant = (
|
|
|
224
225
|
updateSubscriptionPayload[k] = updateSubscriptionfields[k];
|
|
225
226
|
});
|
|
226
227
|
if (Object.keys(updateSubscriptionPayload).length !== 0) {
|
|
227
|
-
updateSubscriptionPayload.UpdatedBy =
|
|
228
|
+
updateSubscriptionPayload.UpdatedBy = UpdatedBy;
|
|
228
229
|
updateSubscriptionPayload.UpdatedAt = new Date();
|
|
229
230
|
|
|
230
231
|
// find the existing subscription
|
|
@@ -243,8 +244,10 @@ const updateTenant = (
|
|
|
243
244
|
{
|
|
244
245
|
TenantID: tenantId,
|
|
245
246
|
...updateSubscriptionPayload,
|
|
246
|
-
CreatedBy:
|
|
247
|
+
CreatedBy:UpdatedBy,
|
|
248
|
+
UpdatedBy: UpdatedBy,
|
|
247
249
|
CreatedAt: new Date(),
|
|
250
|
+
UpdatedAt: new Date()
|
|
248
251
|
},
|
|
249
252
|
{ transaction },
|
|
250
253
|
);
|
package/index.js
CHANGED
|
@@ -5,6 +5,7 @@ const SubscriptionAbstractController = require('./controller/SubscriptionAbstrac
|
|
|
5
5
|
const TenantAbstractController = require('./controller/TenantAbstractController');
|
|
6
6
|
const TenantSettingsAbstractController = require('./controller/TenantSettingsAbstractController');
|
|
7
7
|
const LocationController = require('./controller/LocationController');
|
|
8
|
+
const PermissionAbstractController = require('./controller/PermissionAbstractController');
|
|
8
9
|
const enums = {};
|
|
9
10
|
const enumDir = path.join(__dirname, 'enum');
|
|
10
11
|
fs.readdirSync(enumDir).forEach((file) => {
|
|
@@ -22,4 +23,4 @@ fs.readdirSync(utilDir).forEach((file) => {
|
|
|
22
23
|
}
|
|
23
24
|
})
|
|
24
25
|
|
|
25
|
-
module.exports = {initializeModels, enums, utils, SubscriptionAbstractController, TenantAbstractController, TenantSettingsAbstractController, LocationController}
|
|
26
|
+
module.exports = {initializeModels, enums, utils, SubscriptionAbstractController, TenantAbstractController, TenantSettingsAbstractController, LocationController, PermissionAbstractController};
|