@digione/node-custom-api 0.0.1 → 0.1.0
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/database/redis.js +0 -1
- package/package.json +1 -1
- package/utils/stream.js +11 -2
package/database/redis.js
CHANGED
|
@@ -14,7 +14,6 @@ if ((0, helper_1.getENV)("REDIS_PASSWORD")) {
|
|
|
14
14
|
EventEmitter.setMaxListeners(0);
|
|
15
15
|
const redisClient = new ioredis_1.Redis(option);
|
|
16
16
|
exports.redisClient = redisClient;
|
|
17
|
-
redisClient.connect();
|
|
18
17
|
redisClient.on("error", (err) => {
|
|
19
18
|
exports.redisReady = redisReady = false;
|
|
20
19
|
exports.redisError = redisError = err['code'];
|
package/package.json
CHANGED
package/utils/stream.js
CHANGED
|
@@ -131,13 +131,22 @@ class StreamUtil {
|
|
|
131
131
|
}
|
|
132
132
|
where[sequelize_1.Op.and] = (where[sequelize_1.Op.and] || []).concat({ [sequelize_1.Op.or]: op });
|
|
133
133
|
}
|
|
134
|
+
let attribute = { id: 1, is_required: 1, is_lang: 1, sort_order: 1, field_name: 1, field_slug: 1, field_type: 1, field_data: 1, group: 1, condition: 1, section_id: 1, instructions: 1 };
|
|
135
|
+
if (slug != "fields" && namespace != "data") {
|
|
136
|
+
let fields = yield this.findField("fields", "data", { field_only: true });
|
|
137
|
+
fields.forEach(i => {
|
|
138
|
+
if (!attribute[i['field_slug']]) {
|
|
139
|
+
attribute[i['field_slug']] = 1;
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
134
143
|
let query = yield stream_1.StreamModel.schema(this.ref, '_').findOne({
|
|
135
144
|
where: {
|
|
136
145
|
stream_slug: slug,
|
|
137
146
|
stream_namespace: namespace,
|
|
138
147
|
},
|
|
139
148
|
include: [
|
|
140
|
-
stream_1.StreamAssociation.field.join(this.ref, { where, required: field_required })
|
|
149
|
+
stream_1.StreamAssociation.field.join(this.ref, { attributes: Object.keys(attribute), where, required: field_required })
|
|
141
150
|
],
|
|
142
151
|
order: [[{ model: stream_1.StreamAssociation.field.model, as: stream_1.StreamAssociation.field.alias }, 'sort_order', 'ASC']]
|
|
143
152
|
});
|
|
@@ -250,7 +259,7 @@ class StreamUtil {
|
|
|
250
259
|
}
|
|
251
260
|
}
|
|
252
261
|
}
|
|
253
|
-
if (field['field_type'] == "multiple") {
|
|
262
|
+
if (field['field_type'] == "multiple" || field['field_type'] == "any") {
|
|
254
263
|
delete attributes[field['field_slug']];
|
|
255
264
|
}
|
|
256
265
|
}
|