@obisey/nest 0.1.37 → 0.1.39
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/prototipos/baseResolver.js +11 -7
- package/types.js +2 -2
package/package.json
CHANGED
|
@@ -68,7 +68,7 @@ function BaseResolver(modelo) {
|
|
|
68
68
|
// );
|
|
69
69
|
return servicio
|
|
70
70
|
.findByPk(IdModelo, pagina)
|
|
71
|
-
.then((item) => item.$get(planeta));
|
|
71
|
+
.then((item) => item ? item.$get(planeta) : null);
|
|
72
72
|
},
|
|
73
73
|
ligar: async (servicio, alias, objeto, peticion, borrarSSR = false) => {
|
|
74
74
|
return this.eliminarCache([
|
|
@@ -110,7 +110,7 @@ function BaseResolver(modelo) {
|
|
|
110
110
|
// imprimir(`${modelo} ${IdModelo} hasOne query ${planeta}`);
|
|
111
111
|
return servicio
|
|
112
112
|
.findByPk(IdModelo, pagina)
|
|
113
|
-
.then((item) => item.$get(planeta));
|
|
113
|
+
.then((item) => item ? item.$get(planeta) : null);
|
|
114
114
|
},
|
|
115
115
|
ligar: async (servicio, alias, IdModelo, IdPlaneta, through = null, borrarSSR = false) => this.ligar({
|
|
116
116
|
universo,
|
|
@@ -155,7 +155,7 @@ function BaseResolver(modelo) {
|
|
|
155
155
|
// );
|
|
156
156
|
return servicio
|
|
157
157
|
.findByPk(IdModelo, pagina)
|
|
158
|
-
.then((item) => item.$get(planeta));
|
|
158
|
+
.then((item) => item ? item.$get(planeta) : null);
|
|
159
159
|
},
|
|
160
160
|
ligar: async (servicio, alias, IdModelo, IdPlaneta, through = null, borrarSSR = false) => this.ligar({
|
|
161
161
|
universo,
|
|
@@ -198,7 +198,7 @@ function BaseResolver(modelo) {
|
|
|
198
198
|
// imprimir(`${modelo} ${IdModelo} nodo query ${planeta}`);
|
|
199
199
|
return servicio
|
|
200
200
|
.findByPk(IdModelo, pagina)
|
|
201
|
-
.then((item) => item.$get(planeta));
|
|
201
|
+
.then((item) => item ? item.$get(planeta) : null);
|
|
202
202
|
},
|
|
203
203
|
ligar: async (servicio, alias, IdModelo, IdPlaneta, through, borrarSSR = false) => this.ligar({
|
|
204
204
|
universo,
|
|
@@ -241,7 +241,7 @@ function BaseResolver(modelo) {
|
|
|
241
241
|
// imprimir(`${modelo} ${IdModelo} especial query ${planeta}`);
|
|
242
242
|
return servicio
|
|
243
243
|
.findByPk(IdModelo, pagina)
|
|
244
|
-
.then((item) => item.$get(planeta));
|
|
244
|
+
.then((item) => item ? item.$get(planeta) : null);
|
|
245
245
|
},
|
|
246
246
|
ligar: async (servicio, alias, IdModelo, IdPlaneta, through = null, borrarSSR) => this.ligar({
|
|
247
247
|
universo,
|
|
@@ -289,7 +289,7 @@ function BaseResolver(modelo) {
|
|
|
289
289
|
// );
|
|
290
290
|
return servicio
|
|
291
291
|
.findByPk(IdModelo, pagina)
|
|
292
|
-
.then((item) => item.$get(planeta));
|
|
292
|
+
.then((item) => item ? item.$get(planeta) : null);
|
|
293
293
|
},
|
|
294
294
|
subResolvefield: async (item, where, cacheable, Clase) => this.muchos({
|
|
295
295
|
universo,
|
|
@@ -308,7 +308,7 @@ function BaseResolver(modelo) {
|
|
|
308
308
|
// );
|
|
309
309
|
return servicio
|
|
310
310
|
.findByPk(IdModelo, pagina)
|
|
311
|
-
.then((item) => item.$get(planeta));
|
|
311
|
+
.then((item) => item ? item.$get(planeta) : null);
|
|
312
312
|
},
|
|
313
313
|
ligar: async (IdModelo, IdPlaneta, borrarSSR) => {
|
|
314
314
|
// imprimir(
|
|
@@ -394,6 +394,8 @@ function BaseResolver(modelo) {
|
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
396
|
async uno({ universo, IdEmpresa, planeta, item, cacheable, where, Clase, tipo, relacion, }, pagina = null) {
|
|
397
|
+
if (!item)
|
|
398
|
+
return null;
|
|
397
399
|
let tiempo;
|
|
398
400
|
// if (isDev) tiempo = moment();
|
|
399
401
|
try {
|
|
@@ -460,6 +462,8 @@ function BaseResolver(modelo) {
|
|
|
460
462
|
}
|
|
461
463
|
}
|
|
462
464
|
async muchos({ universo, IdEmpresa, planeta, item, cacheable, where, Clase, tipo, relacion, }, pagina = null) {
|
|
465
|
+
if (!item)
|
|
466
|
+
return [];
|
|
463
467
|
let tiempo;
|
|
464
468
|
// if (isDev) tiempo = moment();
|
|
465
469
|
try {
|
package/types.js
CHANGED
|
@@ -12,8 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.UtilsTypes = exports.OrderInput = exports.ArgsFechas = exports.Status = exports.Conteo = exports.peticion = exports.paginate = void 0;
|
|
13
13
|
const graphql_1 = require("@nestjs/graphql");
|
|
14
14
|
const paginate = ({ where, pagina, limite, order }) => {
|
|
15
|
-
const
|
|
16
|
-
const
|
|
15
|
+
const limit = limite ?? 20;
|
|
16
|
+
const offset = ((pagina ?? 1) - 1) * limit;
|
|
17
17
|
return {
|
|
18
18
|
where,
|
|
19
19
|
offset,
|