@digione/node-custom-api 0.1.9-beta12 → 0.1.9-beta14
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/package.json +1 -1
- package/utils/user.js +6 -3
- package/utils/validator.js +5 -5
package/package.json
CHANGED
package/utils/user.js
CHANGED
|
@@ -317,9 +317,12 @@ const getGroupSetting = (ref, id, { attributes = ['id', 'shared', 'setting'] } =
|
|
|
317
317
|
exports.getGroupSetting = getGroupSetting;
|
|
318
318
|
const getGroupPermission = (ref, id, module, { permission = {}, group_shared = undefined, organ_id = 0, attributes = ['id', 'shared', 'setting'] } = {}) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
319
319
|
if (typeof group_shared == "undefined") {
|
|
320
|
-
let
|
|
321
|
-
if (
|
|
322
|
-
|
|
320
|
+
let group = yield (0, exports.getGroupSetting)(ref, id, { attributes });
|
|
321
|
+
if (group) {
|
|
322
|
+
permission['group_setting'] = group['setting'] || {};
|
|
323
|
+
permission['admin'] = group['shared'];
|
|
324
|
+
group_shared = group['shared'];
|
|
325
|
+
}
|
|
323
326
|
}
|
|
324
327
|
if (typeof group_shared != "undefined" && group_shared == 0) {
|
|
325
328
|
let query = yield group_permission_1.UserGroupPermissionModel.schema(ref, "_").findOne({
|
package/utils/validator.js
CHANGED
|
@@ -105,7 +105,7 @@ const fileService = (setup, { userfiles = false, required = false, fileSize = 0,
|
|
|
105
105
|
let option = setup(validate);
|
|
106
106
|
let upload = userfiles ? option.array("userfiles", maxCount) : option.any();
|
|
107
107
|
return upload(req, res, (err) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
108
|
-
return (0, exports.validateService)(Joi.object().keys({ tags: Joi.array().allow('', null).items(Joi.object().keys({ slug: Joi.string(), type: Joi.string() })) }).unknown())(req, res, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
108
|
+
return (0, exports.validateService)(Joi.object().keys({ tags: Joi.array().allow('', null).items(Joi.object().keys({ slug: Joi.string(), type: Joi.string() })) }).unknown(), { field_omit: [] })(req, res, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
109
109
|
try {
|
|
110
110
|
let field = userfiles ? "userfiles" : undefined;
|
|
111
111
|
if (err) {
|
|
@@ -180,7 +180,7 @@ const multiService = ({ field = undefined, record = undefined, record_addition =
|
|
|
180
180
|
schema['field'] = Joi.string().valid(...field);
|
|
181
181
|
schema['value'] = value_schema;
|
|
182
182
|
}
|
|
183
|
-
return (0, exports.validateService)(Joi.object().keys(Object.assign(Object.assign({}, schema), { records: Joi.array().items(Joi.object().keys(Object.assign({ id: Joi.number().required() }, record)).options({ stripUnknown: true })).min(1).required() })).options({ stripUnknown: true }));
|
|
183
|
+
return (0, exports.validateService)(Joi.object().keys(Object.assign(Object.assign({}, schema), { records: Joi.array().items(Joi.object().keys(Object.assign({ id: Joi.number().required() }, record)).options({ stripUnknown: true })).min(1).required() })).options({ stripUnknown: true }), { field_omit: [] });
|
|
184
184
|
};
|
|
185
185
|
exports.multiService = multiService;
|
|
186
186
|
const streamService = ({ slug = "", name_space = "", param = "index" } = {}) => (req, res, next) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -207,7 +207,7 @@ const streamService = ({ slug = "", name_space = "", param = "index" } = {}) =>
|
|
|
207
207
|
});
|
|
208
208
|
exports.streamService = streamService;
|
|
209
209
|
const importService = ({ import_type = [], schema = {} } = {}) => (req, res, next) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
210
|
-
return (0, exports.validateService)(Joi.object().keys(Object.assign({ import_type: Joi.string().valid(...import_type) }, schema)).unknown())(req, res, next);
|
|
210
|
+
return (0, exports.validateService)(Joi.object().keys(Object.assign({ import_type: Joi.string().valid(...import_type) }, schema)).unknown(), { field_omit: [] })(req, res, next);
|
|
211
211
|
});
|
|
212
212
|
exports.importService = importService;
|
|
213
213
|
const exportService = ({ file_type = undefined, export_type = [], limit = 200, schema = {} } = {}) => (req, res, next) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -288,11 +288,11 @@ const fieldService = ({ field = [], schema = {} } = {}) => (req, res, next) => t
|
|
|
288
288
|
});
|
|
289
289
|
exports.fieldService = fieldService;
|
|
290
290
|
const convertService = ({ convert_type = [], schema = {} } = {}) => (req, res, next) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
291
|
-
return (0, exports.validateService)(Joi.object().keys(Object.assign({ ids: Joi.array().items(Joi.number()).min(1), convert_type: Joi.string().valid(...convert_type) }, schema)).unknown())(req, res, next);
|
|
291
|
+
return (0, exports.validateService)(Joi.object().keys(Object.assign({ ids: Joi.array().items(Joi.number()).min(1), convert_type: Joi.string().valid(...convert_type) }, schema)).unknown(), { field_omit: [] })(req, res, next);
|
|
292
292
|
});
|
|
293
293
|
exports.convertService = convertService;
|
|
294
294
|
const entryValidateService = ({ module = ['contact'], schema = {} } = {}) => (req, res, next) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
295
|
-
return (0, exports.validateService)(Joi.object().keys(Object.assign({ module: Joi.string().valid(...module), entry_id: Joi.number().required() }, schema)).unknown())(req, res, next);
|
|
295
|
+
return (0, exports.validateService)(Joi.object().keys(Object.assign({ module: Joi.string().valid(...module), entry_id: Joi.number().required() }, schema)).unknown(), { field_omit: [] })(req, res, next);
|
|
296
296
|
});
|
|
297
297
|
exports.entryValidateService = entryValidateService;
|
|
298
298
|
const entryParamService = ({ module = ['contact'], schema = {} } = {}) => (req, res, next) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|