@goweekdays/core 2.1.0 → 2.1.1
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/CHANGELOG.md +6 -0
- package/dist/index.js +16 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -7226,7 +7226,7 @@ function usePermissionRepo() {
|
|
|
7226
7226
|
return cached;
|
|
7227
7227
|
}
|
|
7228
7228
|
const result = await collection.countDocuments({
|
|
7229
|
-
|
|
7229
|
+
group
|
|
7230
7230
|
});
|
|
7231
7231
|
setCache(cacheKey, result, 300).then(() => {
|
|
7232
7232
|
import_utils42.logger.log({
|
|
@@ -7727,6 +7727,7 @@ function usePermissionGroupRepo() {
|
|
|
7727
7727
|
}
|
|
7728
7728
|
|
|
7729
7729
|
// src/resources/permission/permission.group.service.ts
|
|
7730
|
+
var import_utils46 = require("@goweekdays/utils");
|
|
7730
7731
|
function usePermissionGroupService() {
|
|
7731
7732
|
const {
|
|
7732
7733
|
updateById: _updateById,
|
|
@@ -7741,7 +7742,7 @@ function usePermissionGroupService() {
|
|
|
7741
7742
|
}
|
|
7742
7743
|
const associatedPermissionsCount = await countByGroup(permission.key);
|
|
7743
7744
|
if (associatedPermissionsCount > 0) {
|
|
7744
|
-
throw new
|
|
7745
|
+
throw new import_utils46.BadRequestError(
|
|
7745
7746
|
"Cannot delete Permission Group with associated Permissions."
|
|
7746
7747
|
);
|
|
7747
7748
|
}
|
|
@@ -7749,7 +7750,11 @@ function usePermissionGroupService() {
|
|
|
7749
7750
|
await _deleteById(id);
|
|
7750
7751
|
return "Permission deleted successfully.";
|
|
7751
7752
|
} catch (error) {
|
|
7752
|
-
|
|
7753
|
+
if (error instanceof import_utils46.AppError) {
|
|
7754
|
+
throw error;
|
|
7755
|
+
} else {
|
|
7756
|
+
throw new import_utils46.InternalServerError("Failed to delete Permission Group.");
|
|
7757
|
+
}
|
|
7753
7758
|
}
|
|
7754
7759
|
}
|
|
7755
7760
|
return {
|
|
@@ -7758,7 +7763,7 @@ function usePermissionGroupService() {
|
|
|
7758
7763
|
}
|
|
7759
7764
|
|
|
7760
7765
|
// src/resources/permission/permission.group.controller.ts
|
|
7761
|
-
var
|
|
7766
|
+
var import_utils47 = require("@goweekdays/utils");
|
|
7762
7767
|
var import_joi24 = __toESM(require("joi"));
|
|
7763
7768
|
function usePermissionGroupController() {
|
|
7764
7769
|
const {
|
|
@@ -7772,8 +7777,8 @@ function usePermissionGroupController() {
|
|
|
7772
7777
|
const value = req.body;
|
|
7773
7778
|
const { error } = schemaPermissionGroup.validate(value);
|
|
7774
7779
|
if (error) {
|
|
7775
|
-
next(new
|
|
7776
|
-
|
|
7780
|
+
next(new import_utils47.BadRequestError(error.message));
|
|
7781
|
+
import_utils47.logger.info(`Controller: ${error.message}`);
|
|
7777
7782
|
return;
|
|
7778
7783
|
}
|
|
7779
7784
|
try {
|
|
@@ -7795,7 +7800,7 @@ function usePermissionGroupController() {
|
|
|
7795
7800
|
});
|
|
7796
7801
|
const { error } = validation.validate(query);
|
|
7797
7802
|
if (error) {
|
|
7798
|
-
next(new
|
|
7803
|
+
next(new import_utils47.BadRequestError(error.message));
|
|
7799
7804
|
return;
|
|
7800
7805
|
}
|
|
7801
7806
|
const page = parseInt(req.query.page) ?? 1;
|
|
@@ -7834,7 +7839,7 @@ function usePermissionGroupController() {
|
|
|
7834
7839
|
});
|
|
7835
7840
|
const { error } = validation.validate({ id });
|
|
7836
7841
|
if (error) {
|
|
7837
|
-
next(new
|
|
7842
|
+
next(new import_utils47.BadRequestError(error.message));
|
|
7838
7843
|
return;
|
|
7839
7844
|
}
|
|
7840
7845
|
try {
|
|
@@ -7855,7 +7860,7 @@ function usePermissionGroupController() {
|
|
|
7855
7860
|
});
|
|
7856
7861
|
const { error } = validation.validate({ id });
|
|
7857
7862
|
if (error) {
|
|
7858
|
-
next(new
|
|
7863
|
+
next(new import_utils47.BadRequestError(error.message));
|
|
7859
7864
|
return;
|
|
7860
7865
|
}
|
|
7861
7866
|
try {
|
|
@@ -7870,13 +7875,13 @@ function usePermissionGroupController() {
|
|
|
7870
7875
|
const id = req.params.id;
|
|
7871
7876
|
const { error: errorId } = import_joi24.default.string().hex().required().validate(id);
|
|
7872
7877
|
if (errorId) {
|
|
7873
|
-
next(new
|
|
7878
|
+
next(new import_utils47.BadRequestError(errorId.message));
|
|
7874
7879
|
return;
|
|
7875
7880
|
}
|
|
7876
7881
|
const payload = req.body;
|
|
7877
7882
|
const { error } = schemaPermissionGroupUpdate.validate(payload);
|
|
7878
7883
|
if (error) {
|
|
7879
|
-
next(new
|
|
7884
|
+
next(new import_utils47.BadRequestError(error.message));
|
|
7880
7885
|
return;
|
|
7881
7886
|
}
|
|
7882
7887
|
try {
|