@zauru-sdk/graphql 1.0.33 → 1.0.48
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/dist/{GraphQL.queries.js → cjs/GraphQL.queries.js} +58 -44
- package/dist/cjs/index.js +17 -0
- package/{src/GraphQL.queries.ts → dist/esm/GraphQL.queries.js} +186 -292
- package/dist/esm/index.js +17 -0
- package/package.json +11 -9
- package/CHANGELOG.md +0 -64
- package/dist/index.js +0 -1
- package/src/index.ts +0 -1
- package/tsconfig.json +0 -23
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCasesByResponsibleIdStringQuery = exports.getInvoicesByAgencyIdStringQuery = exports.getPaymentTermByIdStringQuery = exports.getPaymentTermsStringQuery = exports.getSuggestedPricesStringQuery = exports.getCurrenciesStringQuery = exports.getInvoiceFormSubmissionsByInvoiceIdStringQuery = exports.getLastInvoiceFormSubmissionStringQuery = exports.getInvoiceFormSubmissionsByAgencyIdStringQuery = exports.getFormSubmissionByIdStringQuery = exports.getMyCaseFormSubmissionsStringQuery = exports.getFormsByDocumentTypeStringQuery = exports.getFormsStringQuery = exports.getFormByNameStringQuery = exports.getShipmentsStringQuery = exports.getItemByNameStringQuery = exports.getBundleByNameStringQuery = exports.getBundlesByItemCategoryIdStringQuery = exports.getEmployeesByAgencyIdStringQuery = exports.getEmployeeProfileStringQuery = exports.getConsolidatesBetweenDatesStringQuery = exports.getItemsBySuperCategoryStringQuery = exports.getItemsStringQuery = exports.getItemsByCategoryStringQuery = exports.getItemCategoryByIdStringQuery = exports.getSuperCategoryByIdStringQuery = exports.getPayeeByIdStringQuery = exports.getClientCategoriesStringQuery = exports.getProviderCategoriesStringQuery = exports.getPayeeCategoriesStringQuery = exports.getPayeeCategoriesByNotesMatchStringQuery = exports.getPayeeCategoryByIdStringQuery = exports.getWebAppRowsByWebAppTableIdStringQuery = exports.getWebAppRowStringQuery = exports.getAgenciesStringQuery = exports.getProvidersStringQuery = exports.getPayeesStringQuery = exports.getPurchaseOrdersBetweenDatesStringQuery = exports.getLotStocksByAgencyIdStringQuery = exports.getLotsByNameStringQuery = exports.getShipmentsByToAgencyLast100StringQuery = exports.getPurchaseOrderStringQuery = exports.getPurchaseOrderByIdNumberStringQuery = exports.getLast100ReceptionsStringQuery = void 0;
|
|
4
|
+
exports.getLast100ReceptionsStringQuery = `
|
|
2
5
|
query getLast100Receptions($agencyId: Int) @cached {
|
|
3
6
|
purchase_orders(limit: 100, order_by: {created_at: desc}, where: {voided: {_eq: false}, agency_id: {_eq: $agencyId}}) {
|
|
4
7
|
id
|
|
@@ -27,9 +30,8 @@ query getLast100Receptions($agencyId: Int) @cached {
|
|
|
27
30
|
}
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
export const getPurchaseOrderByIdNumberStringQuery = `
|
|
33
|
+
`;
|
|
34
|
+
exports.getPurchaseOrderByIdNumberStringQuery = `
|
|
33
35
|
query getPurchaseOrderByIdNumber($id_number: String) @cached {
|
|
34
36
|
purchase_orders(where: {id_number: {_eq: $id_number}}) {
|
|
35
37
|
id
|
|
@@ -72,11 +74,8 @@ query getPurchaseOrderByIdNumber($id_number: String) @cached {
|
|
|
72
74
|
}
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
|
-
`;
|
|
76
|
-
|
|
77
|
-
export const getPurchaseOrderStringQuery = (
|
|
78
|
-
config: { withLotStocks: boolean } = { withLotStocks: false }
|
|
79
|
-
) => `
|
|
77
|
+
`;
|
|
78
|
+
const getPurchaseOrderStringQuery = (config = { withLotStocks: false }) => `
|
|
80
79
|
query getPurchaseOrder($id: Int) @cached {
|
|
81
80
|
purchase_orders(where: {id: {_eq: $id}}) {
|
|
82
81
|
id
|
|
@@ -115,17 +114,15 @@ query getPurchaseOrder($id: Int) @cached {
|
|
|
115
114
|
id
|
|
116
115
|
name
|
|
117
116
|
description
|
|
118
|
-
${
|
|
119
|
-
|
|
120
|
-
? `lot_stocks {
|
|
117
|
+
${config.withLotStocks
|
|
118
|
+
? `lot_stocks {
|
|
121
119
|
id
|
|
122
120
|
available
|
|
123
121
|
incoming
|
|
124
122
|
outgoing
|
|
125
123
|
agency_id
|
|
126
|
-
}`
|
|
127
|
-
|
|
128
|
-
}
|
|
124
|
+
}`
|
|
125
|
+
: ""}
|
|
129
126
|
}
|
|
130
127
|
receptions {
|
|
131
128
|
id
|
|
@@ -147,9 +144,9 @@ query getPurchaseOrder($id: Int) @cached {
|
|
|
147
144
|
}
|
|
148
145
|
}
|
|
149
146
|
}
|
|
150
|
-
`;
|
|
151
|
-
|
|
152
|
-
|
|
147
|
+
`;
|
|
148
|
+
exports.getPurchaseOrderStringQuery = getPurchaseOrderStringQuery;
|
|
149
|
+
exports.getShipmentsByToAgencyLast100StringQuery = `
|
|
153
150
|
query getShipmentsByToAgencyLast100(
|
|
154
151
|
$agency_to_id: Int
|
|
155
152
|
){
|
|
@@ -179,9 +176,8 @@ query getShipmentsByToAgencyLast100(
|
|
|
179
176
|
}
|
|
180
177
|
}
|
|
181
178
|
}
|
|
182
|
-
`;
|
|
183
|
-
|
|
184
|
-
export const getLotsByNameStringQuery = `
|
|
179
|
+
`;
|
|
180
|
+
exports.getLotsByNameStringQuery = `
|
|
185
181
|
query getLots($name: String, $entity_id: Int){
|
|
186
182
|
lots (limit: 100, order_by: {id: desc}, where: {entity_id: {_eq: $entity_id}, name: {_eq: $name}}) {
|
|
187
183
|
id
|
|
@@ -189,9 +185,8 @@ query getLots($name: String, $entity_id: Int){
|
|
|
189
185
|
description
|
|
190
186
|
}
|
|
191
187
|
}
|
|
192
|
-
`;
|
|
193
|
-
|
|
194
|
-
export const getLotStocksByAgencyIdStringQuery = `
|
|
188
|
+
`;
|
|
189
|
+
exports.getLotStocksByAgencyIdStringQuery = `
|
|
195
190
|
query getLotStocksByAgencyId($agency_id: Int){
|
|
196
191
|
lot_stocks (
|
|
197
192
|
order_by: { id: desc },
|
|
@@ -207,25 +202,14 @@ query getLotStocksByAgencyId($agency_id: Int){
|
|
|
207
202
|
}
|
|
208
203
|
}
|
|
209
204
|
}
|
|
210
|
-
`;
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
lotItemIdExclusion?: number;
|
|
219
|
-
poDetailTagId?: number;
|
|
220
|
-
withLotStocks?: boolean;
|
|
221
|
-
} = {
|
|
222
|
-
agencyFilter: false,
|
|
223
|
-
payeeCategoryFilter: false,
|
|
224
|
-
itemIdFilter: false,
|
|
225
|
-
consolidateIdFilter: false,
|
|
226
|
-
withLotStocks: false,
|
|
227
|
-
}
|
|
228
|
-
) => `
|
|
205
|
+
`;
|
|
206
|
+
const getPurchaseOrdersBetweenDatesStringQuery = (config = {
|
|
207
|
+
agencyFilter: false,
|
|
208
|
+
payeeCategoryFilter: false,
|
|
209
|
+
itemIdFilter: false,
|
|
210
|
+
consolidateIdFilter: false,
|
|
211
|
+
withLotStocks: false,
|
|
212
|
+
}) => `
|
|
229
213
|
query getPurchaseOrdersBetweenDates(
|
|
230
214
|
$agencyId: Int,
|
|
231
215
|
$startDate: timestamp,
|
|
@@ -238,26 +222,18 @@ query getPurchaseOrdersBetweenDates(
|
|
|
238
222
|
order_by: {id: desc},
|
|
239
223
|
where: {
|
|
240
224
|
${config.agencyFilter ? "agency_id: {_eq: $agencyId}," : ""}
|
|
241
|
-
${
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
? "lots: {item_id: {_neq: $lotItemIdExclusion}},"
|
|
254
|
-
: ""
|
|
255
|
-
}
|
|
256
|
-
${
|
|
257
|
-
config.poDetailTagId
|
|
258
|
-
? "purchase_order_details: {tag_id: {_eq: $poDetailTagId}},"
|
|
259
|
-
: ""
|
|
260
|
-
}
|
|
225
|
+
${config.payeeCategoryFilter
|
|
226
|
+
? "payee: {payee_category: {id: {_eq: $payeeCategoryId}}}},"
|
|
227
|
+
: ""}
|
|
228
|
+
${config.itemIdFilter
|
|
229
|
+
? "purchase_order_details: {item_id: {_eq: 10}},"
|
|
230
|
+
: ""}
|
|
231
|
+
${config.lotItemIdExclusion
|
|
232
|
+
? "lots: {item_id: {_neq: $lotItemIdExclusion}},"
|
|
233
|
+
: ""}
|
|
234
|
+
${config.poDetailTagId
|
|
235
|
+
? "purchase_order_details: {tag_id: {_eq: $poDetailTagId}},"
|
|
236
|
+
: ""}
|
|
261
237
|
${config.consolidateIdFilter ? "consolidate_id: {_is_null: true}," : ""}
|
|
262
238
|
created_at: {_gte: $startDate, _lte: $endDate}
|
|
263
239
|
}
|
|
@@ -283,17 +259,15 @@ query getPurchaseOrdersBetweenDates(
|
|
|
283
259
|
id
|
|
284
260
|
name
|
|
285
261
|
description
|
|
286
|
-
${
|
|
287
|
-
|
|
288
|
-
? `lot_stocks {
|
|
262
|
+
${config.withLotStocks
|
|
263
|
+
? `lot_stocks {
|
|
289
264
|
id
|
|
290
265
|
available
|
|
291
266
|
incoming
|
|
292
267
|
outgoing
|
|
293
268
|
agency_id
|
|
294
|
-
}`
|
|
295
|
-
|
|
296
|
-
}
|
|
269
|
+
}`
|
|
270
|
+
: ""}
|
|
297
271
|
}
|
|
298
272
|
shipment_purchase_orders {
|
|
299
273
|
shipment {
|
|
@@ -311,9 +285,9 @@ query getPurchaseOrdersBetweenDates(
|
|
|
311
285
|
}
|
|
312
286
|
}
|
|
313
287
|
}
|
|
314
|
-
`;
|
|
315
|
-
|
|
316
|
-
|
|
288
|
+
`;
|
|
289
|
+
exports.getPurchaseOrdersBetweenDatesStringQuery = getPurchaseOrdersBetweenDatesStringQuery;
|
|
290
|
+
exports.getPayeesStringQuery = `
|
|
317
291
|
query getPayees {
|
|
318
292
|
payees {
|
|
319
293
|
id
|
|
@@ -324,9 +298,8 @@ query getPayees {
|
|
|
324
298
|
address_line_1
|
|
325
299
|
}
|
|
326
300
|
}
|
|
327
|
-
`;
|
|
328
|
-
|
|
329
|
-
export const getProvidersStringQuery = `
|
|
301
|
+
`;
|
|
302
|
+
exports.getProvidersStringQuery = `
|
|
330
303
|
query getProviders {
|
|
331
304
|
payees (where: {vendor: {_eq: true}}) {
|
|
332
305
|
id
|
|
@@ -336,26 +309,23 @@ query getProviders {
|
|
|
336
309
|
address_line_1
|
|
337
310
|
}
|
|
338
311
|
}
|
|
339
|
-
`;
|
|
340
|
-
|
|
341
|
-
export const getAgenciesStringQuery = `
|
|
312
|
+
`;
|
|
313
|
+
exports.getAgenciesStringQuery = `
|
|
342
314
|
query getAgencies {
|
|
343
315
|
agencies {
|
|
344
316
|
id
|
|
345
317
|
name
|
|
346
318
|
}
|
|
347
319
|
}
|
|
348
|
-
`;
|
|
349
|
-
|
|
350
|
-
export const getWebAppRowStringQuery = `
|
|
320
|
+
`;
|
|
321
|
+
exports.getWebAppRowStringQuery = `
|
|
351
322
|
query getWebAppRow($id: Int){
|
|
352
323
|
webapp_rows(where: {id: {_eq: $id}}) {
|
|
353
324
|
data
|
|
354
325
|
}
|
|
355
326
|
}
|
|
356
|
-
`;
|
|
357
|
-
|
|
358
|
-
export const getWebAppRowsByWebAppTableIdStringQuery = `
|
|
327
|
+
`;
|
|
328
|
+
exports.getWebAppRowsByWebAppTableIdStringQuery = `
|
|
359
329
|
query getWebAppRowsByWebAppTableId ($webapp_table_id: Int) {
|
|
360
330
|
webapp_rows (where: {webapp_table_id: {_eq: $webapp_table_id }}) {
|
|
361
331
|
id
|
|
@@ -363,9 +333,8 @@ query getWebAppRowsByWebAppTableId ($webapp_table_id: Int) {
|
|
|
363
333
|
created_at
|
|
364
334
|
}
|
|
365
335
|
}
|
|
366
|
-
`;
|
|
367
|
-
|
|
368
|
-
export const getPayeeCategoryByIdStringQuery = `
|
|
336
|
+
`;
|
|
337
|
+
exports.getPayeeCategoryByIdStringQuery = `
|
|
369
338
|
query getPayeeCategoryById ($id: Int) {
|
|
370
339
|
payee_categories (where: {id: {_eq: $id }}) {
|
|
371
340
|
payees (order_by: { id: desc }) {
|
|
@@ -380,9 +349,8 @@ query getPayeeCategoryById ($id: Int) {
|
|
|
380
349
|
}
|
|
381
350
|
}
|
|
382
351
|
}
|
|
383
|
-
`;
|
|
384
|
-
|
|
385
|
-
export const getPayeeCategoriesByNotesMatchStringQuery = (match: string) => `
|
|
352
|
+
`;
|
|
353
|
+
const getPayeeCategoriesByNotesMatchStringQuery = (match) => `
|
|
386
354
|
query getPayeeCategoriesByNotesMatch {
|
|
387
355
|
payee_categories(where: {notes: {_ilike: "%${match}%" }}) {
|
|
388
356
|
id
|
|
@@ -409,9 +377,9 @@ query getPayeeCategoriesByNotesMatch {
|
|
|
409
377
|
}
|
|
410
378
|
}
|
|
411
379
|
}
|
|
412
|
-
`;
|
|
413
|
-
|
|
414
|
-
|
|
380
|
+
`;
|
|
381
|
+
exports.getPayeeCategoriesByNotesMatchStringQuery = getPayeeCategoriesByNotesMatchStringQuery;
|
|
382
|
+
exports.getPayeeCategoriesStringQuery = `
|
|
415
383
|
query getPayeeCategories {
|
|
416
384
|
payee_categories {
|
|
417
385
|
id
|
|
@@ -421,9 +389,8 @@ query getPayeeCategories {
|
|
|
421
389
|
price_list_id
|
|
422
390
|
}
|
|
423
391
|
}
|
|
424
|
-
`;
|
|
425
|
-
|
|
426
|
-
export const getProviderCategoriesStringQuery = `
|
|
392
|
+
`;
|
|
393
|
+
exports.getProviderCategoriesStringQuery = `
|
|
427
394
|
query getProviderCategories {
|
|
428
395
|
payee_categories (where: {vendor: {_eq: true}}) {
|
|
429
396
|
id
|
|
@@ -433,9 +400,8 @@ query getProviderCategories {
|
|
|
433
400
|
price_list_id
|
|
434
401
|
}
|
|
435
402
|
}
|
|
436
|
-
`;
|
|
437
|
-
|
|
438
|
-
export const getClientCategoriesStringQuery = `
|
|
403
|
+
`;
|
|
404
|
+
exports.getClientCategoriesStringQuery = `
|
|
439
405
|
query getClientCategories {
|
|
440
406
|
payee_categories (where: {vendor: {_eq: false}}) {
|
|
441
407
|
id
|
|
@@ -445,9 +411,8 @@ query getClientCategories {
|
|
|
445
411
|
price_list_id
|
|
446
412
|
}
|
|
447
413
|
}
|
|
448
|
-
`;
|
|
449
|
-
|
|
450
|
-
export const getPayeeByIdStringQuery = `
|
|
414
|
+
`;
|
|
415
|
+
exports.getPayeeByIdStringQuery = `
|
|
451
416
|
query getPayeeById ($id: Int) {
|
|
452
417
|
payees (where: {id: {_eq: $id }}) {
|
|
453
418
|
id
|
|
@@ -460,9 +425,8 @@ query getPayeeById ($id: Int) {
|
|
|
460
425
|
address_line_1
|
|
461
426
|
}
|
|
462
427
|
}
|
|
463
|
-
`;
|
|
464
|
-
|
|
465
|
-
export const getSuperCategoryByIdStringQuery = `
|
|
428
|
+
`;
|
|
429
|
+
exports.getSuperCategoryByIdStringQuery = `
|
|
466
430
|
query getSuperCategoryById ($id: Int) {
|
|
467
431
|
item_super_categories (where: {id: {_eq: $id }}) {
|
|
468
432
|
item_categories {
|
|
@@ -473,9 +437,8 @@ query getSuperCategoryById ($id: Int) {
|
|
|
473
437
|
}
|
|
474
438
|
}
|
|
475
439
|
}
|
|
476
|
-
`;
|
|
477
|
-
|
|
478
|
-
export const getItemCategoryByIdStringQuery = `
|
|
440
|
+
`;
|
|
441
|
+
exports.getItemCategoryByIdStringQuery = `
|
|
479
442
|
query getItemCategoryById ($id: Int) {
|
|
480
443
|
item_categories (where: {id: {_eq: $id }}) {
|
|
481
444
|
id
|
|
@@ -484,9 +447,8 @@ query getItemCategoryById ($id: Int) {
|
|
|
484
447
|
items_count
|
|
485
448
|
}
|
|
486
449
|
}
|
|
487
|
-
`;
|
|
488
|
-
|
|
489
|
-
export const getItemsByCategoryStringQuery = `
|
|
450
|
+
`;
|
|
451
|
+
exports.getItemsByCategoryStringQuery = `
|
|
490
452
|
query getItemsByCategory ($id: Int) {
|
|
491
453
|
item_categories (where: {id: {_eq: $id }}) {
|
|
492
454
|
items (where: {active: {_eq: true }}) {
|
|
@@ -498,18 +460,16 @@ query getItemsByCategory ($id: Int) {
|
|
|
498
460
|
}
|
|
499
461
|
}
|
|
500
462
|
}
|
|
501
|
-
`;
|
|
502
|
-
|
|
503
|
-
export const getItemsStringQuery = `
|
|
463
|
+
`;
|
|
464
|
+
exports.getItemsStringQuery = `
|
|
504
465
|
query getItems {
|
|
505
466
|
items (where: {active: {_eq: true }}) {
|
|
506
467
|
id,
|
|
507
468
|
name
|
|
508
469
|
}
|
|
509
470
|
}
|
|
510
|
-
`;
|
|
511
|
-
|
|
512
|
-
export const getItemsBySuperCategoryStringQuery = `
|
|
471
|
+
`;
|
|
472
|
+
exports.getItemsBySuperCategoryStringQuery = `
|
|
513
473
|
query getItemsBySuperCategory ($id: Int, $agency_id: Int) {
|
|
514
474
|
item_super_categories (where: {id: {_eq: $id }}, order_by: {id: desc}) {
|
|
515
475
|
item_categories {
|
|
@@ -532,9 +492,8 @@ query getItemsBySuperCategory ($id: Int, $agency_id: Int) {
|
|
|
532
492
|
}
|
|
533
493
|
}
|
|
534
494
|
}
|
|
535
|
-
`;
|
|
536
|
-
|
|
537
|
-
export const getConsolidatesBetweenDatesStringQuery = `
|
|
495
|
+
`;
|
|
496
|
+
exports.getConsolidatesBetweenDatesStringQuery = `
|
|
538
497
|
query getConsolidatesBetweenDates ($startDate: timestamp, $endDate: timestamp) {
|
|
539
498
|
consolidates (order_by: {id: desc}, where: {created_at: {_gte: $startDate, _lte: $endDate}}) {
|
|
540
499
|
id
|
|
@@ -547,9 +506,8 @@ query getConsolidatesBetweenDates ($startDate: timestamp, $endDate: timestamp) {
|
|
|
547
506
|
}
|
|
548
507
|
}
|
|
549
508
|
}
|
|
550
|
-
`;
|
|
551
|
-
|
|
552
|
-
export const getEmployeeProfileStringQuery = `
|
|
509
|
+
`;
|
|
510
|
+
exports.getEmployeeProfileStringQuery = `
|
|
553
511
|
query getEmployeeProfile ($id: Int) {
|
|
554
512
|
employees(where: {id: {_eq: $id}}) {
|
|
555
513
|
agency_id
|
|
@@ -560,9 +518,8 @@ query getEmployeeProfile ($id: Int) {
|
|
|
560
518
|
user_id
|
|
561
519
|
}
|
|
562
520
|
}
|
|
563
|
-
`;
|
|
564
|
-
|
|
565
|
-
export const getEmployeesByAgencyIdStringQuery = `
|
|
521
|
+
`;
|
|
522
|
+
exports.getEmployeesByAgencyIdStringQuery = `
|
|
566
523
|
query getEmployeesByAgencyId ($id: Int) {
|
|
567
524
|
employees(where: {agency_id: {_eq: $id}}) {
|
|
568
525
|
name
|
|
@@ -570,9 +527,8 @@ query getEmployeesByAgencyId ($id: Int) {
|
|
|
570
527
|
user_id
|
|
571
528
|
}
|
|
572
529
|
}
|
|
573
|
-
`;
|
|
574
|
-
|
|
575
|
-
export const getBundlesByItemCategoryIdStringQuery = `
|
|
530
|
+
`;
|
|
531
|
+
exports.getBundlesByItemCategoryIdStringQuery = `
|
|
576
532
|
query getBundlesByItemCategoryId ($id: Int) {
|
|
577
533
|
bundles(where: {active: {_eq: true}, item_category_id: {_eq: $id}}) {
|
|
578
534
|
id
|
|
@@ -589,17 +545,15 @@ query getBundlesByItemCategoryId ($id: Int) {
|
|
|
589
545
|
}
|
|
590
546
|
}
|
|
591
547
|
}
|
|
592
|
-
`;
|
|
593
|
-
|
|
594
|
-
export const getBundleByNameStringQuery = `
|
|
548
|
+
`;
|
|
549
|
+
exports.getBundleByNameStringQuery = `
|
|
595
550
|
query getBundleByName ($name: String) {
|
|
596
551
|
bundles (where: {name: {_eq: $name }}) {
|
|
597
552
|
id
|
|
598
553
|
}
|
|
599
554
|
}
|
|
600
|
-
`;
|
|
601
|
-
|
|
602
|
-
export const getItemByNameStringQuery = `
|
|
555
|
+
`;
|
|
556
|
+
exports.getItemByNameStringQuery = `
|
|
603
557
|
query getItemByName ($name: String) {
|
|
604
558
|
items (where: {active: {_eq: true }, name: {_eq: $name }}) {
|
|
605
559
|
id
|
|
@@ -609,14 +563,11 @@ query getItemByName ($name: String) {
|
|
|
609
563
|
product_type
|
|
610
564
|
}
|
|
611
565
|
}
|
|
612
|
-
`;
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
shipments (${
|
|
618
|
-
additionalWheres.length > 0 ? `where: {${additionalWheres}},` : ""
|
|
619
|
-
} order_by: {id: desc}) {
|
|
566
|
+
`;
|
|
567
|
+
const getShipmentsStringQuery = (wheres = []) => {
|
|
568
|
+
const additionalWheres = wheres.join(",");
|
|
569
|
+
return `query getShipments {
|
|
570
|
+
shipments (${additionalWheres.length > 0 ? `where: {${additionalWheres}},` : ""} order_by: {id: desc}) {
|
|
620
571
|
id
|
|
621
572
|
id_number
|
|
622
573
|
reference
|
|
@@ -633,10 +584,10 @@ export const getShipmentsStringQuery = (wheres: string[] = []) => {
|
|
|
633
584
|
planned_delivery
|
|
634
585
|
}
|
|
635
586
|
}
|
|
636
|
-
`;
|
|
637
|
-
};
|
|
638
|
-
|
|
639
|
-
|
|
587
|
+
`;
|
|
588
|
+
};
|
|
589
|
+
exports.getShipmentsStringQuery = getShipmentsStringQuery;
|
|
590
|
+
exports.getFormByNameStringQuery = `
|
|
640
591
|
query getFormByName ($name: String) {
|
|
641
592
|
settings_forms (
|
|
642
593
|
where: {name: {_eq: $name }},
|
|
@@ -667,9 +618,8 @@ query getFormByName ($name: String) {
|
|
|
667
618
|
}
|
|
668
619
|
}
|
|
669
620
|
}
|
|
670
|
-
`;
|
|
671
|
-
|
|
672
|
-
export const getFormsStringQuery = `
|
|
621
|
+
`;
|
|
622
|
+
exports.getFormsStringQuery = `
|
|
673
623
|
query getForms {
|
|
674
624
|
settings_forms (
|
|
675
625
|
order_by: {zid: desc, version: desc}
|
|
@@ -699,11 +649,8 @@ query getForms {
|
|
|
699
649
|
}
|
|
700
650
|
}
|
|
701
651
|
}
|
|
702
|
-
`;
|
|
703
|
-
|
|
704
|
-
export const getFormsByDocumentTypeStringQuery = (
|
|
705
|
-
filters: { formZid?: number } = {}
|
|
706
|
-
) => `
|
|
652
|
+
`;
|
|
653
|
+
const getFormsByDocumentTypeStringQuery = (filters = {}) => `
|
|
707
654
|
query getFormsByDocumentType ($document_type: String) {
|
|
708
655
|
settings_forms (
|
|
709
656
|
where: {
|
|
@@ -743,21 +690,17 @@ query getFormsByDocumentType ($document_type: String) {
|
|
|
743
690
|
}
|
|
744
691
|
}
|
|
745
692
|
}
|
|
746
|
-
`;
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
filters: { formZid?: number; caseId?: number } = {}
|
|
750
|
-
) => `
|
|
693
|
+
`;
|
|
694
|
+
exports.getFormsByDocumentTypeStringQuery = getFormsByDocumentTypeStringQuery;
|
|
695
|
+
const getMyCaseFormSubmissionsStringQuery = (filters = {}) => `
|
|
751
696
|
query getMyCaseFormSubmissions ($responsible_id: Int) {
|
|
752
697
|
submission_cases (
|
|
753
698
|
limit: 500,
|
|
754
699
|
where: {
|
|
755
700
|
settings_form_submission: {
|
|
756
|
-
${
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
: ""
|
|
760
|
-
}
|
|
701
|
+
${filters?.formZid
|
|
702
|
+
? `settings_form: {zid: {_eq: ${filters?.formZid}}},`
|
|
703
|
+
: ""}
|
|
761
704
|
voided: {_eq: false}
|
|
762
705
|
},
|
|
763
706
|
case: {
|
|
@@ -819,9 +762,9 @@ query getMyCaseFormSubmissions ($responsible_id: Int) {
|
|
|
819
762
|
}
|
|
820
763
|
}
|
|
821
764
|
}
|
|
822
|
-
`;
|
|
823
|
-
|
|
824
|
-
|
|
765
|
+
`;
|
|
766
|
+
exports.getMyCaseFormSubmissionsStringQuery = getMyCaseFormSubmissionsStringQuery;
|
|
767
|
+
exports.getFormSubmissionByIdStringQuery = `
|
|
825
768
|
query getFormSubmissionById ($formId: bigint) {
|
|
826
769
|
settings_form_submissions (where: {id: { _eq: $formId }}) {
|
|
827
770
|
id
|
|
@@ -854,60 +797,37 @@ query getFormSubmissionById ($formId: bigint) {
|
|
|
854
797
|
}
|
|
855
798
|
}
|
|
856
799
|
}
|
|
857
|
-
`;
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
seller_id?: number | string;
|
|
861
|
-
payee_id_number_search?: string;
|
|
862
|
-
some_field_value?: string;
|
|
863
|
-
item_ids?: number[];
|
|
864
|
-
bundle_ids?: number[];
|
|
865
|
-
startDate?: string;
|
|
866
|
-
endDate?: string;
|
|
867
|
-
}) => {
|
|
868
|
-
return `
|
|
800
|
+
`;
|
|
801
|
+
const getInvoiceFormSubmissionsByAgencyIdStringQuery = (filters) => {
|
|
802
|
+
return `
|
|
869
803
|
query getInvoiceFormSubmissionsByAgencyId (
|
|
870
804
|
$agency_id: Int
|
|
871
805
|
) {
|
|
872
806
|
submission_invoices(
|
|
873
807
|
where: {
|
|
874
808
|
settings_form_submission: {
|
|
875
|
-
${
|
|
876
|
-
|
|
877
|
-
? `settings_form_submission_values: {
|
|
809
|
+
${filters?.some_field_value
|
|
810
|
+
? `settings_form_submission_values: {
|
|
878
811
|
value: { _eq: "${filters?.some_field_value}" }
|
|
879
|
-
},`
|
|
880
|
-
|
|
881
|
-
}
|
|
812
|
+
},`
|
|
813
|
+
: ""}
|
|
882
814
|
voided: {_eq: false}
|
|
883
815
|
},
|
|
884
|
-
${
|
|
885
|
-
filters?.startDate
|
|
886
|
-
|
|
887
|
-
: ""
|
|
888
|
-
}
|
|
816
|
+
${filters?.startDate?.length && filters?.endDate?.length
|
|
817
|
+
? `created_at: { _gte: "${filters?.startDate}", _lte: "${filters?.endDate}" },`
|
|
818
|
+
: ""}
|
|
889
819
|
invoice: {
|
|
890
820
|
agency_id: {_eq: $agency_id},
|
|
891
821
|
${filters?.seller_id ? `seller_id: {_eq: ${filters?.seller_id} },` : ""}
|
|
892
|
-
${
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
)}]}}`
|
|
902
|
-
: ""
|
|
903
|
-
}
|
|
904
|
-
${
|
|
905
|
-
filters?.bundle_ids?.length
|
|
906
|
-
? `invoice_details: {bundle_id: {_in: [${filters?.bundle_ids?.join(
|
|
907
|
-
","
|
|
908
|
-
)}]}}`
|
|
909
|
-
: ""
|
|
910
|
-
}
|
|
822
|
+
${filters?.payee_id_number_search
|
|
823
|
+
? `payee: { id_number: { _ilike: "%${filters?.payee_id_number_search}%"} },`
|
|
824
|
+
: ""}
|
|
825
|
+
${filters?.item_ids?.length
|
|
826
|
+
? `invoice_details: {item_id: {_in: [${filters?.item_ids?.join(",")}]}}`
|
|
827
|
+
: ""}
|
|
828
|
+
${filters?.bundle_ids?.length
|
|
829
|
+
? `invoice_details: {bundle_id: {_in: [${filters?.bundle_ids?.join(",")}]}}`
|
|
830
|
+
: ""}
|
|
911
831
|
voided: {_eq: false}
|
|
912
832
|
}
|
|
913
833
|
},
|
|
@@ -964,21 +884,17 @@ query getInvoiceFormSubmissionsByAgencyId (
|
|
|
964
884
|
}
|
|
965
885
|
}
|
|
966
886
|
}
|
|
967
|
-
`;
|
|
968
|
-
};
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
filters: { formZid?: number } = {}
|
|
972
|
-
) => `
|
|
887
|
+
`;
|
|
888
|
+
};
|
|
889
|
+
exports.getInvoiceFormSubmissionsByAgencyIdStringQuery = getInvoiceFormSubmissionsByAgencyIdStringQuery;
|
|
890
|
+
const getLastInvoiceFormSubmissionStringQuery = (filters = {}) => `
|
|
973
891
|
query getLastInvoiceFormSubmission {
|
|
974
892
|
submission_invoices(
|
|
975
893
|
where: {
|
|
976
894
|
settings_form_submission: {
|
|
977
|
-
${
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
: ""
|
|
981
|
-
}
|
|
895
|
+
${filters?.formZid
|
|
896
|
+
? `settings_form: {zid: {_eq: ${filters?.formZid}}},`
|
|
897
|
+
: ""}
|
|
982
898
|
voided: {_eq: false}
|
|
983
899
|
}
|
|
984
900
|
},
|
|
@@ -991,21 +907,17 @@ query getLastInvoiceFormSubmission {
|
|
|
991
907
|
}
|
|
992
908
|
}
|
|
993
909
|
}
|
|
994
|
-
`;
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
filters: { formZid?: number } = {}
|
|
998
|
-
) => `
|
|
910
|
+
`;
|
|
911
|
+
exports.getLastInvoiceFormSubmissionStringQuery = getLastInvoiceFormSubmissionStringQuery;
|
|
912
|
+
const getInvoiceFormSubmissionsByInvoiceIdStringQuery = (filters = {}) => `
|
|
999
913
|
query getInvoiceFormSubmissionsByInvoiceId ($invoice_id: bigint) {
|
|
1000
914
|
submission_invoices(
|
|
1001
915
|
where: {
|
|
1002
916
|
invoice_id: {_eq: $invoice_id},
|
|
1003
917
|
settings_form_submission: {
|
|
1004
|
-
${
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
: ""
|
|
1008
|
-
}
|
|
918
|
+
${filters?.formZid
|
|
919
|
+
? `settings_form: {zid: {_eq: ${filters?.formZid}}},`
|
|
920
|
+
: ""}
|
|
1009
921
|
voided: {_eq: false}
|
|
1010
922
|
}
|
|
1011
923
|
},
|
|
@@ -1049,9 +961,9 @@ query getInvoiceFormSubmissionsByInvoiceId ($invoice_id: bigint) {
|
|
|
1049
961
|
}
|
|
1050
962
|
}
|
|
1051
963
|
}
|
|
1052
|
-
`;
|
|
1053
|
-
|
|
1054
|
-
|
|
964
|
+
`;
|
|
965
|
+
exports.getInvoiceFormSubmissionsByInvoiceIdStringQuery = getInvoiceFormSubmissionsByInvoiceIdStringQuery;
|
|
966
|
+
exports.getCurrenciesStringQuery = `
|
|
1055
967
|
query getCurrencies {
|
|
1056
968
|
currencies {
|
|
1057
969
|
id
|
|
@@ -1062,35 +974,25 @@ query getCurrencies {
|
|
|
1062
974
|
plural_name
|
|
1063
975
|
}
|
|
1064
976
|
}
|
|
1065
|
-
`;
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
onlyCurrent: boolean;
|
|
1073
|
-
} = {
|
|
1074
|
-
notNullPriceList: false,
|
|
1075
|
-
withItems: false,
|
|
1076
|
-
withItemCategories: false,
|
|
1077
|
-
onlyCurrent: false,
|
|
1078
|
-
}
|
|
1079
|
-
) => `
|
|
977
|
+
`;
|
|
978
|
+
const getSuggestedPricesStringQuery = (config = {
|
|
979
|
+
notNullPriceList: false,
|
|
980
|
+
withItems: false,
|
|
981
|
+
withItemCategories: false,
|
|
982
|
+
onlyCurrent: false,
|
|
983
|
+
}) => `
|
|
1080
984
|
query getSuggestedPrices {
|
|
1081
|
-
suggested_prices ${
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
.join(", ")}
|
|
985
|
+
suggested_prices ${config?.notNullPriceList || config?.onlyCurrent
|
|
986
|
+
? `(
|
|
987
|
+
where: {${[
|
|
988
|
+
config?.onlyCurrent ? "current: { _eq: true }" : "",
|
|
989
|
+
config?.notNullPriceList ? "price_list_id: { _is_null: false }" : "",
|
|
990
|
+
]
|
|
991
|
+
.filter(Boolean)
|
|
992
|
+
.join(", ")}
|
|
1090
993
|
}
|
|
1091
|
-
)`
|
|
1092
|
-
|
|
1093
|
-
} {
|
|
994
|
+
)`
|
|
995
|
+
: ""} {
|
|
1094
996
|
id
|
|
1095
997
|
current
|
|
1096
998
|
currency_id
|
|
@@ -1105,34 +1007,30 @@ query getSuggestedPrices {
|
|
|
1105
1007
|
id
|
|
1106
1008
|
}
|
|
1107
1009
|
}
|
|
1108
|
-
${
|
|
1109
|
-
|
|
1110
|
-
? `item {
|
|
1010
|
+
${config?.withItems
|
|
1011
|
+
? `item {
|
|
1111
1012
|
id
|
|
1112
1013
|
name
|
|
1113
1014
|
stocks_only_integer
|
|
1114
1015
|
code
|
|
1115
1016
|
product_type
|
|
1116
|
-
${
|
|
1117
|
-
|
|
1118
|
-
? `
|
|
1017
|
+
${config?.withItemCategories
|
|
1018
|
+
? `
|
|
1119
1019
|
item_category {
|
|
1120
1020
|
id
|
|
1121
1021
|
name
|
|
1122
1022
|
notes
|
|
1123
1023
|
items_count
|
|
1124
1024
|
}
|
|
1125
|
-
`
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
: ""
|
|
1130
|
-
}
|
|
1025
|
+
`
|
|
1026
|
+
: ""}
|
|
1027
|
+
}`
|
|
1028
|
+
: ""}
|
|
1131
1029
|
}
|
|
1132
1030
|
}
|
|
1133
|
-
`;
|
|
1134
|
-
|
|
1135
|
-
|
|
1031
|
+
`;
|
|
1032
|
+
exports.getSuggestedPricesStringQuery = getSuggestedPricesStringQuery;
|
|
1033
|
+
exports.getPaymentTermsStringQuery = `
|
|
1136
1034
|
query getPaymentTerms {
|
|
1137
1035
|
payment_terms {
|
|
1138
1036
|
active
|
|
@@ -1141,9 +1039,8 @@ query getPaymentTerms {
|
|
|
1141
1039
|
name
|
|
1142
1040
|
}
|
|
1143
1041
|
}
|
|
1144
|
-
`;
|
|
1145
|
-
|
|
1146
|
-
export const getPaymentTermByIdStringQuery = `
|
|
1042
|
+
`;
|
|
1043
|
+
exports.getPaymentTermByIdStringQuery = `
|
|
1147
1044
|
query getPaymentTermById ($id: Int) {
|
|
1148
1045
|
payment_terms (where: {id: {_eq: $id }}) {
|
|
1149
1046
|
active
|
|
@@ -1157,9 +1054,8 @@ query getPaymentTermById ($id: Int) {
|
|
|
1157
1054
|
}
|
|
1158
1055
|
}
|
|
1159
1056
|
}
|
|
1160
|
-
`;
|
|
1161
|
-
|
|
1162
|
-
export const getInvoicesByAgencyIdStringQuery = `
|
|
1057
|
+
`;
|
|
1058
|
+
exports.getInvoicesByAgencyIdStringQuery = `
|
|
1163
1059
|
query getInvoicesByAgencyId($id: Int) {
|
|
1164
1060
|
invoices(limit: 1000, where: {agency_id: {_eq: $id}, voided: {_eq: false}}, order_by: {id: desc}) {
|
|
1165
1061
|
id
|
|
@@ -1205,15 +1101,12 @@ query getInvoicesByAgencyId($id: Int) {
|
|
|
1205
1101
|
}
|
|
1206
1102
|
}
|
|
1207
1103
|
}
|
|
1208
|
-
`;
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
return `
|
|
1104
|
+
`;
|
|
1105
|
+
const getCasesByResponsibleIdStringQuery = (wheres = []) => {
|
|
1106
|
+
const additionalWheres = wheres.join(",");
|
|
1107
|
+
return `
|
|
1213
1108
|
query getCasesByResponsibleId($responsible_id: Int) {
|
|
1214
|
-
cases(where: {responsible_id: {_eq: $responsible_id}${
|
|
1215
|
-
additionalWheres.length > 0 ? "," : ""
|
|
1216
|
-
}${additionalWheres}}, order_by: {id: desc}) {
|
|
1109
|
+
cases(where: {responsible_id: {_eq: $responsible_id}${additionalWheres.length > 0 ? "," : ""}${additionalWheres}}, order_by: {id: desc}) {
|
|
1217
1110
|
id
|
|
1218
1111
|
id_number
|
|
1219
1112
|
serial_id
|
|
@@ -1248,5 +1141,6 @@ export const getCasesByResponsibleIdStringQuery = (wheres: string[] = []) => {
|
|
|
1248
1141
|
}
|
|
1249
1142
|
}
|
|
1250
1143
|
}
|
|
1251
|
-
`;
|
|
1252
|
-
};
|
|
1144
|
+
`;
|
|
1145
|
+
};
|
|
1146
|
+
exports.getCasesByResponsibleIdStringQuery = getCasesByResponsibleIdStringQuery;
|