@digione/node-custom-api 0.2.0-alpha1 → 0.2.0-alpha3
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/file.d.ts +10 -3
- package/utils/file.js +31 -17
- package/utils/helper.d.ts +6 -1
- package/utils/helper.js +20 -2
- package/utils/stream.js +52 -7
package/package.json
CHANGED
package/utils/file.d.ts
CHANGED
|
@@ -62,16 +62,23 @@ export declare class FileUtil {
|
|
|
62
62
|
width?: number;
|
|
63
63
|
height?: number;
|
|
64
64
|
}): Promise<any>;
|
|
65
|
-
beforeFindFile(where?: {}, { tags, group }?: {
|
|
65
|
+
beforeFindFile(where?: {}, { attributes, tags, group, verify }?: {
|
|
66
|
+
attributes?: any;
|
|
66
67
|
tags?: TagFile;
|
|
67
68
|
group?: any;
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
verify?: boolean;
|
|
70
|
+
}): {
|
|
71
|
+
where: {};
|
|
72
|
+
attributes: any;
|
|
73
|
+
order: any[];
|
|
74
|
+
};
|
|
75
|
+
findAllFile({ where, folder, full, file_link, thumb, verify, width, height, parent_folder, attributes, limit, offset, tag, tags, group }?: {
|
|
70
76
|
where?: {};
|
|
71
77
|
folder?: boolean;
|
|
72
78
|
full?: boolean;
|
|
73
79
|
file_link?: boolean;
|
|
74
80
|
thumb?: boolean;
|
|
81
|
+
verify?: boolean;
|
|
75
82
|
width?: number;
|
|
76
83
|
height?: number;
|
|
77
84
|
parent_folder?: string;
|
package/utils/file.js
CHANGED
|
@@ -108,6 +108,7 @@ class FileUtil {
|
|
|
108
108
|
}
|
|
109
109
|
afterQueryFile(data = {}, { tag = {}, file_link = false } = {}) {
|
|
110
110
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
delete data['thumbnail'];
|
|
111
112
|
data['custom'] = data['custom'] || {};
|
|
112
113
|
data['tags'] = data['tags'] || [];
|
|
113
114
|
if (data['filename'] == data['path']) {
|
|
@@ -276,12 +277,12 @@ class FileUtil {
|
|
|
276
277
|
return null;
|
|
277
278
|
where['$folder.parent_id$'] = query['id'];
|
|
278
279
|
}
|
|
279
|
-
|
|
280
|
+
let option = this.beforeFindFile(where, { attributes: ['id', 'extension', 'filename', 'path', 'thumb'], tags, group });
|
|
280
281
|
let result = yield file_1.FileModel.schema(this.ref, "_").findOne({
|
|
281
|
-
raw: true, attributes:
|
|
282
|
-
where: Object.assign({ '$folder.slug$': slug }, where),
|
|
282
|
+
raw: true, attributes: option.attributes,
|
|
283
|
+
where: Object.assign({ '$folder.slug$': slug }, option.where),
|
|
283
284
|
include: [{ as: 'folder', model: folder_1.FolderModel.schema(this.ref, "_"), attributes: [] }],
|
|
284
|
-
order:
|
|
285
|
+
order: option.order
|
|
285
286
|
});
|
|
286
287
|
return this.findImageThumb(result, { width, height });
|
|
287
288
|
}
|
|
@@ -299,7 +300,8 @@ class FileUtil {
|
|
|
299
300
|
return this.findImageThumb(item, { width, height });
|
|
300
301
|
});
|
|
301
302
|
}
|
|
302
|
-
beforeFindFile(where = {}, { tags = [], group = undefined } = {}) {
|
|
303
|
+
beforeFindFile(where = {}, { attributes = undefined, tags = [], group = undefined, verify = false } = {}) {
|
|
304
|
+
let order = [['sort', 'asc'], ['tags', 'desc']], thumbnail = false;
|
|
303
305
|
if (this.option.organ_id) {
|
|
304
306
|
where[sequelize_1.Op.and] = (where[sequelize_1.Op.and] || []).concat({ [sequelize_1.Op.or]: [{ organ_id: this.option.organ_id }, { organ_by: this.option.organ_id }] });
|
|
305
307
|
}
|
|
@@ -310,9 +312,11 @@ class FileUtil {
|
|
|
310
312
|
let op = tags.reduce((total, tag) => {
|
|
311
313
|
let value = Object.keys(tag).reduce((total, key) => total.concat([`'${key}'`, `"${tag[key]}"`]), []).join(',');
|
|
312
314
|
if (value) {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
315
|
+
if (tag['slug'] == "thumbnail" && !verify) {
|
|
316
|
+
thumbnail = true;
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
total = total.concat((0, sequelize_1.literal)(`JSON_CONTAINS(tags,JSON_OBJECT(${value}))`));
|
|
316
320
|
}
|
|
317
321
|
}
|
|
318
322
|
return total;
|
|
@@ -321,9 +325,19 @@ class FileUtil {
|
|
|
321
325
|
where[sequelize_1.Op.and] = (where[sequelize_1.Op.and] || []).concat({ [sequelize_1.Op.or]: op });
|
|
322
326
|
}
|
|
323
327
|
}
|
|
324
|
-
|
|
328
|
+
if (thumbnail) {
|
|
329
|
+
let include = [[(0, sequelize_1.literal)(`IF(JSON_CONTAINS(tags,JSON_OBJECT('slug',"thumbnail")),'yes','no')`), 'thumbnail']];
|
|
330
|
+
if (typeof attributes == "undefined") {
|
|
331
|
+
attributes = { include };
|
|
332
|
+
}
|
|
333
|
+
else if (attributes instanceof Array) {
|
|
334
|
+
attributes = attributes.concat(include);
|
|
335
|
+
}
|
|
336
|
+
order = [['thumbnail', 'desc'], ['sort', 'asc']];
|
|
337
|
+
}
|
|
338
|
+
return { where, attributes, order };
|
|
325
339
|
}
|
|
326
|
-
findAllFile({ where = {}, folder = false, full = false, file_link = false, thumb = false, width = 0, height = 0, parent_folder = "", attributes = undefined, limit = undefined, offset = undefined, tag = {}, tags = [], group = undefined } = {}) {
|
|
340
|
+
findAllFile({ where = {}, folder = false, full = false, file_link = false, thumb = false, verify = true, width = 0, height = 0, parent_folder = "", attributes = undefined, limit = undefined, offset = undefined, tag = {}, tags = [], group = undefined } = {}) {
|
|
327
341
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
328
342
|
try {
|
|
329
343
|
let include = [];
|
|
@@ -335,10 +349,10 @@ class FileUtil {
|
|
|
335
349
|
return [];
|
|
336
350
|
where['$folder.parent_id$'] = query['id'];
|
|
337
351
|
}
|
|
338
|
-
where = this.beforeFindFile(where, { tags, group });
|
|
339
352
|
where['is_hidden'] = where['is_hidden'] || "no";
|
|
353
|
+
let option = this.beforeFindFile(where, { attributes, tags, group, verify });
|
|
340
354
|
let result = yield file_1.FileModel.schema(this.ref, "_").findAll({
|
|
341
|
-
attributes, raw: true, where, limit, offset, include, order:
|
|
355
|
+
attributes: option.attributes, raw: true, where: option.where, limit, offset, include, order: option.order
|
|
342
356
|
});
|
|
343
357
|
result.length && (yield this.getStorage());
|
|
344
358
|
result = yield Promise.all(result.map((item) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -372,9 +386,9 @@ class FileUtil {
|
|
|
372
386
|
if (!folder)
|
|
373
387
|
return { rows: [], count: 0 };
|
|
374
388
|
where['folder_id'] = folder['id'];
|
|
375
|
-
where = this.beforeFindFile(where, { tags, group });
|
|
376
389
|
where['is_hidden'] = where['is_hidden'] || "no";
|
|
377
|
-
let
|
|
390
|
+
let option = this.beforeFindFile(where, { tags, group, verify: true });
|
|
391
|
+
let data = yield Promise.all([this.findAllFile({ where, full: true, file_link, limit, offset, tag, group }), file_1.FileModel.schema(this.ref, "_").count({ where: option.where })]);
|
|
378
392
|
return { rows: data[0], count: data[1] };
|
|
379
393
|
});
|
|
380
394
|
}
|
|
@@ -385,7 +399,7 @@ class FileUtil {
|
|
|
385
399
|
}
|
|
386
400
|
findOneFileByFolder(slug, { where = {}, full = false, file_link = false, parent_folder = "", tags = [], group = null } = {}) {
|
|
387
401
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
388
|
-
return (yield this.findAllFile({ where: Object.assign({ '$folder.slug$': slug }, where), folder: true, full, file_link, parent_folder, limit: 1, tags, group }))[0] || null;
|
|
402
|
+
return (yield this.findAllFile({ where: Object.assign({ '$folder.slug$': slug }, where), folder: true, full, file_link, verify: false, parent_folder, limit: 1, tags, group }))[0] || null;
|
|
389
403
|
});
|
|
390
404
|
}
|
|
391
405
|
findOneFileById(id, { where = {}, full = true, file_link = false, parent_folder = "", tags = [], group = null } = {}) {
|
|
@@ -678,8 +692,8 @@ class FileUtil {
|
|
|
678
692
|
}
|
|
679
693
|
remove({ where = {}, delete_object = false, error = true, tags = [], group = undefined } = {}) {
|
|
680
694
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
681
|
-
|
|
682
|
-
let files = yield file_1.FileModel.schema(this.ref, "_").findAll({ where, attributes: ['id', 'path', 'thumb'], raw: true });
|
|
695
|
+
let option = this.beforeFindFile(where, { tags, group, verify: true });
|
|
696
|
+
let files = yield file_1.FileModel.schema(this.ref, "_").findAll({ where: option.where, attributes: ['id', 'path', 'thumb'], raw: true });
|
|
683
697
|
if (files.length) {
|
|
684
698
|
let paths = [], id = files.map(i => { paths = paths.concat(this.getFilePath(i)); return i['id']; });
|
|
685
699
|
yield file_1.FileModel.schema(this.ref, "_").destroy({ where: { id } });
|
package/utils/helper.d.ts
CHANGED
|
@@ -27,7 +27,12 @@ export declare const getValueFunctionFile: (key: any) => (value: any, { result,
|
|
|
27
27
|
json?: {};
|
|
28
28
|
fileUtil?: any;
|
|
29
29
|
}) => Promise<void>;
|
|
30
|
-
export declare const
|
|
30
|
+
export declare const getValueFunctionArray: (key: any) => (value: any, { result }: {
|
|
31
|
+
result?: {};
|
|
32
|
+
}) => void;
|
|
33
|
+
export declare const getValueFunctionLang: (key: any, { field_type }?: {
|
|
34
|
+
field_type?: string;
|
|
35
|
+
}) => (value?: {}, { result, transform, spread, spread_all, raw, lang_code }?: {
|
|
31
36
|
result?: {};
|
|
32
37
|
transform?: boolean;
|
|
33
38
|
spread?: boolean;
|
package/utils/helper.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertCurrency = exports.xorMerge = exports.xorDecode = exports.xorEncode = exports.getInstanceNumber = exports.getDomain = exports.getParent = exports.replaceColon = exports.stripEmoji = exports.stripHtml = exports.slugifyField = exports.slugify = exports.convertToBigEndian = exports.expandTree = exports.buildTree = exports.treeToArray = exports.randomRef = exports.multiExecArray = exports.isBase64 = exports.isNumber = exports.removeAt = exports.removeSpace = exports.formatMobileNumber = exports.getMobileNumber = exports.removeHyphen = exports.signToken = exports.getTokenDataFromTokenBySecret = exports.getUUID32 = exports.getUUID = exports.sleep = exports.getValueByLang = exports.getValueFunctionLang = exports.getValueFunctionFile = exports.getDateTime = exports.getTimestampMysql = exports.getDateMysql = exports.getSlug = exports.getENVIndex = exports.getENV = exports.Joi_date = exports.getDaysBetweenDates = exports.getDateFromString = exports.getDateRangeFormat = void 0;
|
|
3
|
+
exports.convertCurrency = exports.xorMerge = exports.xorDecode = exports.xorEncode = exports.getInstanceNumber = exports.getDomain = exports.getParent = exports.replaceColon = exports.stripEmoji = exports.stripHtml = exports.slugifyField = exports.slugify = exports.convertToBigEndian = exports.expandTree = exports.buildTree = exports.treeToArray = exports.randomRef = exports.multiExecArray = exports.isBase64 = exports.isNumber = exports.removeAt = exports.removeSpace = exports.formatMobileNumber = exports.getMobileNumber = exports.removeHyphen = exports.signToken = exports.getTokenDataFromTokenBySecret = exports.getUUID32 = exports.getUUID = exports.sleep = exports.getValueByLang = exports.getValueFunctionLang = exports.getValueFunctionArray = exports.getValueFunctionFile = exports.getDateTime = exports.getTimestampMysql = exports.getDateMysql = exports.getSlug = exports.getENVIndex = exports.getENV = exports.Joi_date = exports.getDaysBetweenDates = exports.getDateFromString = exports.getDateRangeFormat = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const crypto = require("crypto");
|
|
6
6
|
const dotenv = require("dotenv");
|
|
@@ -101,7 +101,22 @@ const getValueFunctionFile = (key) => {
|
|
|
101
101
|
});
|
|
102
102
|
};
|
|
103
103
|
exports.getValueFunctionFile = getValueFunctionFile;
|
|
104
|
-
const
|
|
104
|
+
const getValueFunctionArray = (key) => {
|
|
105
|
+
return (value, { result = {} }) => {
|
|
106
|
+
if (value[key]) {
|
|
107
|
+
try {
|
|
108
|
+
result[key] = JSON.parse(value[key]);
|
|
109
|
+
}
|
|
110
|
+
catch (err) { }
|
|
111
|
+
;
|
|
112
|
+
}
|
|
113
|
+
if (!(result[key] instanceof Array)) {
|
|
114
|
+
result[key] = [];
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
exports.getValueFunctionArray = getValueFunctionArray;
|
|
119
|
+
const getValueFunctionLang = (key, { field_type = "" } = {}) => {
|
|
105
120
|
return (value = {}, { result = {}, transform = true, spread = false, spread_all = false, raw = false, lang_code = "" } = {}) => {
|
|
106
121
|
if (raw || typeof value[key] == "undefined")
|
|
107
122
|
return;
|
|
@@ -125,6 +140,9 @@ const getValueFunctionLang = (key) => {
|
|
|
125
140
|
return;
|
|
126
141
|
}
|
|
127
142
|
result[key] = bol ? (obj[lang_code] || obj['en']) : value[key];
|
|
143
|
+
if (field_type == "stream") {
|
|
144
|
+
(0, exports.getValueFunctionArray)(key)({ [key]: result[key] }, { result });
|
|
145
|
+
}
|
|
128
146
|
};
|
|
129
147
|
};
|
|
130
148
|
exports.getValueFunctionLang = getValueFunctionLang;
|
package/utils/stream.js
CHANGED
|
@@ -255,7 +255,7 @@ class StreamUtil {
|
|
|
255
255
|
delete attributes[field['field_slug']];
|
|
256
256
|
}
|
|
257
257
|
if (fetch) {
|
|
258
|
-
if (field['is_lang'] == "yes") {
|
|
258
|
+
if (field['is_lang'] == "yes" && field['field_type'] != "stream") {
|
|
259
259
|
label && fetchLabel.push(field);
|
|
260
260
|
fetchFn.push((0, helper_2.getValueFunctionLang)(field['field_slug']));
|
|
261
261
|
}
|
|
@@ -286,6 +286,15 @@ class StreamUtil {
|
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
break;
|
|
289
|
+
case "stream":
|
|
290
|
+
if (include[field['field_slug']] || include_all) {
|
|
291
|
+
label && fetchLabel.push(field);
|
|
292
|
+
fetchFn.push((field['is_lang'] == "yes") ? (0, helper_2.getValueFunctionLang)(field['field_slug'], { field_type: field['field_type'] }) : (0, helper_2.getValueFunctionArray)(field['field_slug']));
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
delete attributes[field['field_slug']];
|
|
296
|
+
}
|
|
297
|
+
break;
|
|
289
298
|
}
|
|
290
299
|
}
|
|
291
300
|
}
|
|
@@ -404,6 +413,15 @@ class StreamUtil {
|
|
|
404
413
|
else if (typeof default_value[item['field_slug']] !== 'undefined') {
|
|
405
414
|
item['field_value'] = default_value[item['field_slug']];
|
|
406
415
|
}
|
|
416
|
+
if (item['field_type'] == "stream" && item['field_value']) {
|
|
417
|
+
try {
|
|
418
|
+
item['field_value'] = JSON.parse(item['field_value']);
|
|
419
|
+
}
|
|
420
|
+
catch (err) { }
|
|
421
|
+
if (!(item['field_value'] instanceof Array)) {
|
|
422
|
+
item['field_value'] = [];
|
|
423
|
+
}
|
|
424
|
+
}
|
|
407
425
|
if (item['instructions']) {
|
|
408
426
|
(0, helper_2.getValueFunctionLang)('instructions')(item, { result: item, lang_code });
|
|
409
427
|
}
|
|
@@ -661,6 +679,14 @@ class StreamUtil {
|
|
|
661
679
|
field_data['range']['field_value'] = default_value[field_data['range']['field_target']];
|
|
662
680
|
}
|
|
663
681
|
}
|
|
682
|
+
else if (item['field_type'] == "stream") {
|
|
683
|
+
if (field_data['choose_stream']) {
|
|
684
|
+
let stream = yield stream_1.StreamModel.schema(this.ref, "_").findOne({ where: { id: field_data['choose_stream'] }, raw: true, attributes: ['stream_slug', 'stream_namespace'] });
|
|
685
|
+
if (stream) {
|
|
686
|
+
item['stream'] = yield this.findField(stream['stream_slug'], stream['stream_namespace'], { field_only: true, convert_option: true });
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
}
|
|
664
690
|
}
|
|
665
691
|
fields.push(Object.assign(Object.assign({}, item), { field_data }));
|
|
666
692
|
}
|
|
@@ -813,7 +839,7 @@ class StreamUtil {
|
|
|
813
839
|
stream = stream || {};
|
|
814
840
|
let id_stream = stream['id'], stream_prefix = stream['stream_prefix'];
|
|
815
841
|
if (fields && fields.length) {
|
|
816
|
-
fields = fields.filter(({ is_lang, field_type, field_data }) => field_type && (is_lang == "yes" || (field_type == "multiple" && field_data['self_table'] != "yes") || field_type == "image" || field_type == "file" || field_data['field_type'] == "encrypt"));
|
|
842
|
+
fields = fields.filter(({ is_lang, field_type, field_data }) => field_type && (is_lang == "yes" || (field_type == "multiple" && field_data['self_table'] != "yes") || field_type == "image" || field_type == "file" || field_data['field_type'] == "encrypt" || field_type == "stream"));
|
|
817
843
|
}
|
|
818
844
|
if (!Object.keys(raw_input).length) {
|
|
819
845
|
raw_input = input;
|
|
@@ -893,6 +919,9 @@ class StreamUtil {
|
|
|
893
919
|
else if (field_type == "multiple") {
|
|
894
920
|
fields_post.push(fields[index]);
|
|
895
921
|
}
|
|
922
|
+
else if (field_type == "stream" && input[field_slug]) {
|
|
923
|
+
data[field_slug] = JSON.stringify(input[field_slug]);
|
|
924
|
+
}
|
|
896
925
|
})));
|
|
897
926
|
}
|
|
898
927
|
if (id) {
|
|
@@ -956,8 +985,8 @@ class StreamUtil {
|
|
|
956
985
|
}
|
|
957
986
|
let folder = yield fileUtil.createFolder(index, { parent_id: where_folder['parent_id'] });
|
|
958
987
|
let where_file = { folder_id: folder['id'], is_hidden: "yes" };
|
|
959
|
-
|
|
960
|
-
let query = yield file_1.FileModel.schema(ref, "_").findAll({ where:
|
|
988
|
+
let option_file = fileUtil.beforeFindFile(where_file, { tags, group, verify: true });
|
|
989
|
+
let query = yield file_1.FileModel.schema(ref, "_").findAll({ where: option_file.where, attributes: ['id', 'name'], raw: true });
|
|
961
990
|
id_files = query.reduce((total, item) => Object.assign(total, { [item['name']]: item['id'] }), {});
|
|
962
991
|
let input_files = [];
|
|
963
992
|
yield Promise.all(fields.map(({ field_type, field_slug, field_data }) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -1826,6 +1855,9 @@ class StreamUtil {
|
|
|
1826
1855
|
}
|
|
1827
1856
|
field_data = _.pick(field_data, ['range']);
|
|
1828
1857
|
break;
|
|
1858
|
+
case "stream":
|
|
1859
|
+
field_data = _.pick(field_data, ['choose_stream', 'self_table']);
|
|
1860
|
+
break;
|
|
1829
1861
|
default:
|
|
1830
1862
|
field_data = {};
|
|
1831
1863
|
break;
|
|
@@ -1836,7 +1868,8 @@ class StreamUtil {
|
|
|
1836
1868
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
1837
1869
|
let field_lang = [];
|
|
1838
1870
|
let file = req ? ((req.file ? [req.file] : [].concat(req.files || [])).reduce((total, item) => Object.assign(total, { [item['fieldname']]: item }), {})) : {};
|
|
1839
|
-
|
|
1871
|
+
for (let val of streams) {
|
|
1872
|
+
let { field_type, field_slug, is_required, is_lang, field_data, data } = val;
|
|
1840
1873
|
let field;
|
|
1841
1874
|
field_data = field_data || {};
|
|
1842
1875
|
is_required = (is_required == "yes" && (isNew || (!input[field_slug] && typeof input[field_slug] != "undefined")));
|
|
@@ -1969,6 +2002,18 @@ class StreamUtil {
|
|
|
1969
2002
|
}
|
|
1970
2003
|
field = field.regex(/^(\+|-)?(?:90(?:(?:\.0{1,6})?)|(?:[0-9]|[1-8][0-9])(?:(?:\.[0-9]{1,6})?))$/).messages({ 'string.pattern.base': `${field_slug} invalid format` });
|
|
1971
2004
|
break;
|
|
2005
|
+
case "stream":
|
|
2006
|
+
if (field_data['choose_stream']) {
|
|
2007
|
+
let stream = yield stream_1.StreamModel.schema(this.ref, "_").findOne({ where: { id: field_data['choose_stream'] }, raw: true, attributes: ['stream_slug', 'stream_namespace'] });
|
|
2008
|
+
if (stream) {
|
|
2009
|
+
let streams = yield this.findField(stream['stream_slug'], stream['stream_namespace'], { field_only: true, convert_option: true });
|
|
2010
|
+
let validator = yield this.getValidator(streams, { isNew: true, required: is_required, lang, stripUnknown: true });
|
|
2011
|
+
field = Joi.array().items(validator);
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
2014
|
+
field = field || Joi.array();
|
|
2015
|
+
field = is_required ? field.required().min(1) : field.allow(null);
|
|
2016
|
+
break;
|
|
1972
2017
|
}
|
|
1973
2018
|
field = field || Joi.any();
|
|
1974
2019
|
if (is_required)
|
|
@@ -1976,12 +2021,12 @@ class StreamUtil {
|
|
|
1976
2021
|
if (is_lang == "yes") {
|
|
1977
2022
|
if (!lang.length) {
|
|
1978
2023
|
field_lang.push({ field_slug, field });
|
|
1979
|
-
|
|
2024
|
+
continue;
|
|
1980
2025
|
}
|
|
1981
2026
|
field = Joi.object().keys(lang.reduce((total, i) => Object.assign(total, { [i['lang_code']]: field }), {}));
|
|
1982
2027
|
}
|
|
1983
2028
|
schema[field_slug] = field;
|
|
1984
|
-
}
|
|
2029
|
+
}
|
|
1985
2030
|
if (field_lang.length) {
|
|
1986
2031
|
lang = yield this.languageUtil.getLangsLive();
|
|
1987
2032
|
for (let item of field_lang) {
|