@obisey/nest 0.1.27 → 0.1.29
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
CHANGED
|
@@ -53,7 +53,7 @@ function BaseService(modelo) {
|
|
|
53
53
|
// }
|
|
54
54
|
let nkey = `${key.universo ? key.universo : 'pro'}:${key.IdEmpresa}:${key.fragmentos[0].nombre}:${id}`;
|
|
55
55
|
const { resultado, cache } = await (0, cachear_1.cachear)(cacheable, this.cacheManager, (0, keyInterface_1.transformarKey)({ ...key }), (cache) => {
|
|
56
|
-
return Promise.resolve(
|
|
56
|
+
return Promise.resolve(repository.sequelize.models[(0, lodash_1.capitalize)(modelo)](JSON.parse(cache)));
|
|
57
57
|
}, //Revisar
|
|
58
58
|
(resultado) => {
|
|
59
59
|
return Promise.resolve(resultado
|
|
@@ -134,7 +134,8 @@ function BaseService(modelo) {
|
|
|
134
134
|
cached: parsed,
|
|
135
135
|
modelName: (0, lodash_1.capitalize)(modelo),
|
|
136
136
|
});
|
|
137
|
-
const
|
|
137
|
+
const ModelClass = repository.sequelize.models[(0, lodash_1.capitalize)(modelo)];
|
|
138
|
+
const instance = ModelClass.build(parsed, { raw: false, isNewRecord: false });
|
|
138
139
|
console.log(`[OBISEY-NEST DESERIALIZED] ${modelo}:`, {
|
|
139
140
|
id: instance.id,
|
|
140
141
|
hasId: 'id' in instance,
|
|
@@ -165,12 +166,15 @@ function BaseService(modelo) {
|
|
|
165
166
|
const plainData = item.get({ plain: true });
|
|
166
167
|
return this.redis.hSet(pkey(id), 'item', JSON.stringify(plainData));
|
|
167
168
|
});
|
|
168
|
-
Promise.all(savePromises)
|
|
169
|
+
Promise.all(savePromises)
|
|
170
|
+
.then(() => {
|
|
169
171
|
console.log(`[PEDIR-ITEMS-SAVED] ${modelo}: all items saved`);
|
|
170
|
-
|
|
172
|
+
resolve(result);
|
|
173
|
+
})
|
|
174
|
+
.catch(err => {
|
|
171
175
|
console.log(`[PEDIR-SAVE-ERROR] ${modelo}:`, err);
|
|
176
|
+
resolve(result);
|
|
172
177
|
});
|
|
173
|
-
resolve(result);
|
|
174
178
|
});
|
|
175
179
|
}), //Pedir
|
|
176
180
|
() => new Promise(async (resolve) => {
|