@obisey/nest 0.1.27 → 0.1.28

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obisey/nest",
3
- "version": "0.1.27",
3
+ "version": "0.1.28",
4
4
  "description": "NestJS utilities and base classes by Obisey",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -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(new repository.sequelize.models[(0, lodash_1.capitalize)(modelo)](JSON.parse(cache)));
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 instance = new repository.sequelize.models[(0, lodash_1.capitalize)(modelo)](parsed);
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,