@zauru-sdk/graphql 1.0.93 → 1.0.105
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.d.ts +30 -30
- package/dist/cjs/GraphQL.queries.js +117 -102
- package/dist/esm/GraphQL.queries.js +117 -102
- package/package.json +2 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export declare const getLast100ReceptionsStringQuery
|
|
2
|
-
export declare const getPurchaseOrderByIdNumberStringQuery
|
|
3
|
-
export declare const getPurchaseOrderStringQuery: (config?: {
|
|
1
|
+
export declare const getLast100ReceptionsStringQuery: (agency_id: number) => string;
|
|
2
|
+
export declare const getPurchaseOrderByIdNumberStringQuery: (id_number: string) => string;
|
|
3
|
+
export declare const getPurchaseOrderStringQuery: (id: number, config?: {
|
|
4
4
|
withLotStocks: boolean;
|
|
5
5
|
}) => string;
|
|
6
|
-
export declare const getShipmentsByToAgencyLast100StringQuery
|
|
7
|
-
export declare const getLotsByNameStringQuery
|
|
8
|
-
export declare const getLotStocksByAgencyIdStringQuery
|
|
9
|
-
export declare const getPurchaseOrdersBetweenDatesStringQuery: (config: {
|
|
6
|
+
export declare const getShipmentsByToAgencyLast100StringQuery: (agency_to_id: number) => string;
|
|
7
|
+
export declare const getLotsByNameStringQuery: (name: string, entity_id: number) => string;
|
|
8
|
+
export declare const getLotStocksByAgencyIdStringQuery: (agency_id: number) => string;
|
|
9
|
+
export declare const getPurchaseOrdersBetweenDatesStringQuery: (startDate: string, endDate: string, config: {
|
|
10
10
|
agencyId?: number | string;
|
|
11
11
|
itemId?: number | string;
|
|
12
12
|
payeeCategoryId?: number | string;
|
|
@@ -27,40 +27,40 @@ export declare const getPurchaseOrdersBetweenDatesStringQuery: (config: {
|
|
|
27
27
|
export declare const getPayeesStringQuery = "\nquery getPayees {\n payees {\n id\n id_number\n name\n tin\n vendor\n address_line_1\n }\n}\n";
|
|
28
28
|
export declare const getProvidersStringQuery = "\nquery getProviders {\n payees (where: {vendor: {_eq: true}}) {\n id\n id_number\n name\n tin\n address_line_1\n }\n}\n";
|
|
29
29
|
export declare const getAgenciesStringQuery = "\nquery getAgencies {\n agencies {\n id\n name\n }\n}\n";
|
|
30
|
-
export declare const getWebAppRowStringQuery
|
|
31
|
-
export declare const getWebAppRowsByWebAppTableIdStringQuery
|
|
32
|
-
export declare const getPayeeCategoryByIdStringQuery
|
|
30
|
+
export declare const getWebAppRowStringQuery: (id: number) => string;
|
|
31
|
+
export declare const getWebAppRowsByWebAppTableIdStringQuery: (webapp_table_id: number) => string;
|
|
32
|
+
export declare const getPayeeCategoryByIdStringQuery: (id: number) => string;
|
|
33
33
|
export declare const getPayeeCategoriesByNotesMatchStringQuery: (match: string) => string;
|
|
34
34
|
export declare const getPayeeCategoriesStringQuery = "\nquery getPayeeCategories {\n payee_categories {\n id\n name\n notes\n payees_count\n price_list_id\n }\n}\n";
|
|
35
35
|
export declare const getProviderCategoriesStringQuery = "\nquery getProviderCategories {\n payee_categories (where: {vendor: {_eq: true}}) {\n id\n name\n notes\n payees_count\n price_list_id\n }\n}\n";
|
|
36
36
|
export declare const getClientCategoriesStringQuery = "\nquery getClientCategories {\n payee_categories (where: {vendor: {_eq: false}}) {\n id\n name\n notes\n payees_count\n price_list_id\n }\n}\n";
|
|
37
|
-
export declare const getPayeeByIdStringQuery
|
|
38
|
-
export declare const getSuperCategoryByIdStringQuery
|
|
39
|
-
export declare const getItemCategoryByIdStringQuery
|
|
40
|
-
export declare const getItemsByCategoryStringQuery
|
|
37
|
+
export declare const getPayeeByIdStringQuery: (id: number) => string;
|
|
38
|
+
export declare const getSuperCategoryByIdStringQuery: (id: number) => string;
|
|
39
|
+
export declare const getItemCategoryByIdStringQuery: (id: number) => string;
|
|
40
|
+
export declare const getItemsByCategoryStringQuery: (id: number) => string;
|
|
41
41
|
export declare const getItemsStringQuery = "\nquery getItems {\n items (where: {active: {_eq: true }}) {\n id,\n name,\n code\n }\n}\n";
|
|
42
|
-
export declare const getItemsBySuperCategoryStringQuery
|
|
43
|
-
export declare const getConsolidatesBetweenDatesStringQuery
|
|
44
|
-
export declare const getEmployeeProfileStringQuery
|
|
45
|
-
export declare const getEmployeesByAgencyIdStringQuery
|
|
46
|
-
export declare const getBundlesByItemCategoryIdStringQuery
|
|
47
|
-
export declare const getBundleByNameStringQuery
|
|
48
|
-
export declare const getItemByNameStringQuery
|
|
42
|
+
export declare const getItemsBySuperCategoryStringQuery: (id: number, agency_id: number) => string;
|
|
43
|
+
export declare const getConsolidatesBetweenDatesStringQuery: (startDate: string, endDate: string) => string;
|
|
44
|
+
export declare const getEmployeeProfileStringQuery: (id: number) => string;
|
|
45
|
+
export declare const getEmployeesByAgencyIdStringQuery: (id: number) => string;
|
|
46
|
+
export declare const getBundlesByItemCategoryIdStringQuery: (id: number) => string;
|
|
47
|
+
export declare const getBundleByNameStringQuery: (name: string) => string;
|
|
48
|
+
export declare const getItemByNameStringQuery: (name: string) => string;
|
|
49
49
|
export declare const getShipmentsStringQuery: (wheres?: string[]) => string;
|
|
50
50
|
export declare const getAllFormsStringQuery: (config?: {
|
|
51
51
|
withSubmissions: boolean;
|
|
52
52
|
}) => string;
|
|
53
|
-
export declare const getFormByNameStringQuery
|
|
53
|
+
export declare const getFormByNameStringQuery: (name: string) => string;
|
|
54
54
|
export declare const getFormsStringQuery = "\nquery getForms {\n settings_forms (\n order_by: {zid: desc, version: desc}\n ) {\n id\n zid\n name\n description\n version\n active\n settings_form_fields (order_by: {position: asc}) {\n id\n name\n field_type\n hint\n required\n default_value\n position\n print_var_name\n form_id\n settings_form_field_options {\n id\n label\n position\n value\n }\n }\n }\n}\n";
|
|
55
|
-
export declare const getFormsByDocumentTypeStringQuery: (filters?: {
|
|
55
|
+
export declare const getFormsByDocumentTypeStringQuery: (document_type: string, filters?: {
|
|
56
56
|
formZid?: number;
|
|
57
57
|
}) => string;
|
|
58
|
-
export declare const getMyCaseFormSubmissionsStringQuery: (filters?: {
|
|
58
|
+
export declare const getMyCaseFormSubmissionsStringQuery: (responsible_id: number, filters?: {
|
|
59
59
|
formZid?: number;
|
|
60
60
|
caseId?: number;
|
|
61
61
|
}) => string;
|
|
62
|
-
export declare const getFormSubmissionByIdStringQuery
|
|
63
|
-
export declare const getInvoiceFormSubmissionsByAgencyIdStringQuery: (filters?: {
|
|
62
|
+
export declare const getFormSubmissionByIdStringQuery: (formId: number) => string;
|
|
63
|
+
export declare const getInvoiceFormSubmissionsByAgencyIdStringQuery: (agency_id: number, filters?: {
|
|
64
64
|
seller_id?: number | string;
|
|
65
65
|
payee_id_number_search?: string;
|
|
66
66
|
some_field_value?: string;
|
|
@@ -73,7 +73,7 @@ export declare const getInvoiceFormSubmissionsByAgencyIdStringQuery: (filters?:
|
|
|
73
73
|
export declare const getLastInvoiceFormSubmissionStringQuery: (filters?: {
|
|
74
74
|
formZid?: number;
|
|
75
75
|
}) => string;
|
|
76
|
-
export declare const getInvoiceFormSubmissionsByInvoiceIdStringQuery: (filters?: {
|
|
76
|
+
export declare const getInvoiceFormSubmissionsByInvoiceIdStringQuery: (invoice_id: number, filters?: {
|
|
77
77
|
formZid?: number;
|
|
78
78
|
}) => string;
|
|
79
79
|
export declare const getCurrenciesStringQuery = "\nquery getCurrencies {\n currencies {\n id\n name\n prefix\n code\n country\n plural_name\n }\n}\n";
|
|
@@ -89,7 +89,7 @@ export declare const getPaymentTermsStringQuery: (config?: {
|
|
|
89
89
|
export declare const getPaymentMethodsStringQuery: (config: {
|
|
90
90
|
onlyActives: boolean;
|
|
91
91
|
}) => string;
|
|
92
|
-
export declare const getPaymentTermByIdStringQuery
|
|
93
|
-
export declare const getInvoicesByAgencyIdStringQuery
|
|
94
|
-
export declare const getCasesByResponsibleIdStringQuery: (wheres?: string[]) => string;
|
|
92
|
+
export declare const getPaymentTermByIdStringQuery: (id: number) => string;
|
|
93
|
+
export declare const getInvoicesByAgencyIdStringQuery: (id: number) => string;
|
|
94
|
+
export declare const getCasesByResponsibleIdStringQuery: (responsible_id: number, wheres?: string[]) => string;
|
|
95
95
|
export declare const getPrintTemplatesStringQuery = "\nquery getPrintTemplates {\n print_templates {\n id\n name\n }\n}\n";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getPrintTemplatesStringQuery = exports.getCasesByResponsibleIdStringQuery = exports.getInvoicesByAgencyIdStringQuery = exports.getPaymentTermByIdStringQuery = exports.getPaymentMethodsStringQuery = exports.getPaymentTermsStringQuery = exports.getSuggestedPricesStringQuery = exports.getCurrenciesStringQuery = exports.getInvoiceFormSubmissionsByInvoiceIdStringQuery = exports.getLastInvoiceFormSubmissionStringQuery = exports.getInvoiceFormSubmissionsByAgencyIdStringQuery = exports.getFormSubmissionByIdStringQuery = exports.getMyCaseFormSubmissionsStringQuery = exports.getFormsByDocumentTypeStringQuery = exports.getFormsStringQuery = exports.getFormByNameStringQuery = exports.getAllFormsStringQuery = 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
|
-
|
|
5
|
-
query getLast100Receptions
|
|
6
|
-
purchase_orders(limit: 100, order_by: {created_at: desc}, where: {voided: {_eq: false}, agency_id: {_eq: $
|
|
4
|
+
const getLast100ReceptionsStringQuery = (agency_id) => `
|
|
5
|
+
query getLast100Receptions {
|
|
6
|
+
purchase_orders(limit: 100, order_by: {created_at: desc}, where: {voided: {_eq: false}, agency_id: {_eq: ${agency_id}}}) {
|
|
7
7
|
id
|
|
8
8
|
created_at
|
|
9
9
|
due
|
|
@@ -32,9 +32,10 @@ query getLast100Receptions($agencyId: Int) @cached {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
`;
|
|
35
|
-
exports.
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
exports.getLast100ReceptionsStringQuery = getLast100ReceptionsStringQuery;
|
|
36
|
+
const getPurchaseOrderByIdNumberStringQuery = (id_number) => `
|
|
37
|
+
query getPurchaseOrderByIdNumber {
|
|
38
|
+
purchase_orders(where: {id_number: {_eq: "${id_number}"}}) {
|
|
38
39
|
id
|
|
39
40
|
created_at
|
|
40
41
|
due
|
|
@@ -76,9 +77,10 @@ query getPurchaseOrderByIdNumber($id_number: String) @cached {
|
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
79
|
`;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
exports.getPurchaseOrderByIdNumberStringQuery = getPurchaseOrderByIdNumberStringQuery;
|
|
81
|
+
const getPurchaseOrderStringQuery = (id, config = { withLotStocks: false }) => `
|
|
82
|
+
query getPurchaseOrder($id: bigint) @cached {
|
|
83
|
+
purchase_orders(where: {id: {_eq: ${id}}}) {
|
|
82
84
|
id
|
|
83
85
|
agency_id
|
|
84
86
|
entity_id
|
|
@@ -147,11 +149,9 @@ query getPurchaseOrder($id: Int) @cached {
|
|
|
147
149
|
}
|
|
148
150
|
`;
|
|
149
151
|
exports.getPurchaseOrderStringQuery = getPurchaseOrderStringQuery;
|
|
150
|
-
|
|
151
|
-
query getShipmentsByToAgencyLast100
|
|
152
|
-
|
|
153
|
-
){
|
|
154
|
-
shipments(limit: 100, order_by: {id: desc}, where: {voided: {_eq: false}, shipped: {_eq: false}, delivered: {_eq: false}, agency_to_id: {_eq: $agency_to_id}}) {
|
|
152
|
+
const getShipmentsByToAgencyLast100StringQuery = (agency_to_id) => `
|
|
153
|
+
query getShipmentsByToAgencyLast100 {
|
|
154
|
+
shipments(limit: 100, order_by: {id: desc}, where: {voided: {_eq: false}, shipped: {_eq: false}, delivered: {_eq: false}, agency_to_id: {_eq: ${agency_to_id}}}) {
|
|
155
155
|
id
|
|
156
156
|
zid
|
|
157
157
|
id_number
|
|
@@ -178,20 +178,22 @@ query getShipmentsByToAgencyLast100(
|
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
`;
|
|
181
|
-
exports.
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
exports.getShipmentsByToAgencyLast100StringQuery = getShipmentsByToAgencyLast100StringQuery;
|
|
182
|
+
const getLotsByNameStringQuery = (name, entity_id) => `
|
|
183
|
+
query getLots {
|
|
184
|
+
lots (limit: 100, order_by: {id: desc}, where: {entity_id: {_eq: ${entity_id}}, name: {_eq: "${name}"}}) {
|
|
184
185
|
id
|
|
185
186
|
name
|
|
186
187
|
description
|
|
187
188
|
}
|
|
188
189
|
}
|
|
189
190
|
`;
|
|
190
|
-
exports.
|
|
191
|
-
|
|
191
|
+
exports.getLotsByNameStringQuery = getLotsByNameStringQuery;
|
|
192
|
+
const getLotStocksByAgencyIdStringQuery = (agency_id) => `
|
|
193
|
+
query getLotStocksByAgencyId {
|
|
192
194
|
lot_stocks (
|
|
193
195
|
order_by: { id: desc },
|
|
194
|
-
where: { agency_id: { _eq: $agency_id }}
|
|
196
|
+
where: { agency_id: { _eq: ${agency_id} } }
|
|
195
197
|
){
|
|
196
198
|
id
|
|
197
199
|
available
|
|
@@ -204,7 +206,8 @@ query getLotStocksByAgencyId($agency_id: Int){
|
|
|
204
206
|
}
|
|
205
207
|
}
|
|
206
208
|
`;
|
|
207
|
-
|
|
209
|
+
exports.getLotStocksByAgencyIdStringQuery = getLotStocksByAgencyIdStringQuery;
|
|
210
|
+
const getPurchaseOrdersBetweenDatesStringQuery = (startDate, endDate, config) => {
|
|
208
211
|
const conditions = [];
|
|
209
212
|
if (config.agencyId) {
|
|
210
213
|
conditions.push(`agency_id: { _eq: ${config.agencyId} }`);
|
|
@@ -236,8 +239,8 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config) => {
|
|
|
236
239
|
}
|
|
237
240
|
if (!config.id_number) {
|
|
238
241
|
conditions.push(config.betweenIssueDate
|
|
239
|
-
?
|
|
240
|
-
:
|
|
242
|
+
? `issue_date: { _gte: "${startDate}", _lte: "${endDate}" }`
|
|
243
|
+
: `created_at: { _gte: "${startDate}", _lte: "${endDate}"}`);
|
|
241
244
|
}
|
|
242
245
|
if (config.payeeCategoryIds && config.payeeCategoryIds.length > 0) {
|
|
243
246
|
conditions.push(`payee: { payee_category: { id: { _in: [${config.payeeCategoryIds.join(",")}] } } }`);
|
|
@@ -249,12 +252,6 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config) => {
|
|
|
249
252
|
const whereClause = conditions.length
|
|
250
253
|
? `where: { ${conditions.join(", ")} }`
|
|
251
254
|
: "";
|
|
252
|
-
const dateVariables = config.id_number
|
|
253
|
-
? ""
|
|
254
|
-
: `(
|
|
255
|
-
$startDate: ${config.betweenIssueDate ? "date" : "timestamp"},
|
|
256
|
-
$endDate: ${config.betweenIssueDate ? "date" : "timestamp"}
|
|
257
|
-
)`;
|
|
258
255
|
const lotStocksFragment = config.withLotStocks
|
|
259
256
|
? `
|
|
260
257
|
lot_stocks {
|
|
@@ -307,7 +304,7 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config) => {
|
|
|
307
304
|
}`
|
|
308
305
|
: "";
|
|
309
306
|
return `
|
|
310
|
-
query getPurchaseOrdersBetweenDates
|
|
307
|
+
query getPurchaseOrdersBetweenDates {
|
|
311
308
|
purchase_orders (
|
|
312
309
|
order_by: { id: desc },
|
|
313
310
|
${whereClause}
|
|
@@ -363,19 +360,22 @@ query getAgencies {
|
|
|
363
360
|
}
|
|
364
361
|
}
|
|
365
362
|
`;
|
|
366
|
-
|
|
367
|
-
query getWebAppRow
|
|
368
|
-
webapp_rows(where: {id: {_eq: $id}}) {
|
|
363
|
+
const getWebAppRowStringQuery = (id) => `
|
|
364
|
+
query getWebAppRow {
|
|
365
|
+
webapp_rows(where: {id: {_eq: ${id}}}) {
|
|
366
|
+
id
|
|
369
367
|
data
|
|
368
|
+
created_at
|
|
370
369
|
}
|
|
371
370
|
}
|
|
372
371
|
`;
|
|
373
|
-
exports.
|
|
374
|
-
|
|
372
|
+
exports.getWebAppRowStringQuery = getWebAppRowStringQuery;
|
|
373
|
+
const getWebAppRowsByWebAppTableIdStringQuery = (webapp_table_id) => `
|
|
374
|
+
query getWebAppRowsByWebAppTableId {
|
|
375
375
|
webapp_rows (
|
|
376
376
|
where: {
|
|
377
377
|
webapp_table_id: {
|
|
378
|
-
_eq: $webapp_table_id
|
|
378
|
+
_eq: ${webapp_table_id}
|
|
379
379
|
}
|
|
380
380
|
},
|
|
381
381
|
order_by: {
|
|
@@ -388,9 +388,10 @@ query getWebAppRowsByWebAppTableId ($webapp_table_id: Int) {
|
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
390
|
`;
|
|
391
|
-
exports.
|
|
392
|
-
|
|
393
|
-
|
|
391
|
+
exports.getWebAppRowsByWebAppTableIdStringQuery = getWebAppRowsByWebAppTableIdStringQuery;
|
|
392
|
+
const getPayeeCategoryByIdStringQuery = (id) => `
|
|
393
|
+
query getPayeeCategoryById {
|
|
394
|
+
payee_categories (where: {id: {_eq: ${id} }}) {
|
|
394
395
|
payees (order_by: { id: desc }) {
|
|
395
396
|
id
|
|
396
397
|
name
|
|
@@ -405,6 +406,7 @@ query getPayeeCategoryById ($id: Int) {
|
|
|
405
406
|
}
|
|
406
407
|
}
|
|
407
408
|
`;
|
|
409
|
+
exports.getPayeeCategoryByIdStringQuery = getPayeeCategoryByIdStringQuery;
|
|
408
410
|
const getPayeeCategoriesByNotesMatchStringQuery = (match) => `
|
|
409
411
|
query getPayeeCategoriesByNotesMatch {
|
|
410
412
|
payee_categories(where: {notes: {_ilike: "%${match}%" }}) {
|
|
@@ -467,9 +469,9 @@ query getClientCategories {
|
|
|
467
469
|
}
|
|
468
470
|
}
|
|
469
471
|
`;
|
|
470
|
-
|
|
471
|
-
query getPayeeById
|
|
472
|
-
payees (where: {id: {_eq: $id }}) {
|
|
472
|
+
const getPayeeByIdStringQuery = (id) => `
|
|
473
|
+
query getPayeeById {
|
|
474
|
+
payees (where: {id: {_eq: ${id} }}) {
|
|
473
475
|
id
|
|
474
476
|
name
|
|
475
477
|
id_number
|
|
@@ -481,9 +483,10 @@ query getPayeeById ($id: Int) {
|
|
|
481
483
|
}
|
|
482
484
|
}
|
|
483
485
|
`;
|
|
484
|
-
exports.
|
|
485
|
-
|
|
486
|
-
|
|
486
|
+
exports.getPayeeByIdStringQuery = getPayeeByIdStringQuery;
|
|
487
|
+
const getSuperCategoryByIdStringQuery = (id) => `
|
|
488
|
+
query getSuperCategoryById {
|
|
489
|
+
item_super_categories (where: {id: {_eq: ${id} }}) {
|
|
487
490
|
item_categories {
|
|
488
491
|
id
|
|
489
492
|
name
|
|
@@ -493,9 +496,10 @@ query getSuperCategoryById ($id: bigint) {
|
|
|
493
496
|
}
|
|
494
497
|
}
|
|
495
498
|
`;
|
|
496
|
-
exports.
|
|
497
|
-
|
|
498
|
-
|
|
499
|
+
exports.getSuperCategoryByIdStringQuery = getSuperCategoryByIdStringQuery;
|
|
500
|
+
const getItemCategoryByIdStringQuery = (id) => `
|
|
501
|
+
query getItemCategoryById {
|
|
502
|
+
item_categories (where: {id: {_eq: ${id} }}) {
|
|
499
503
|
id
|
|
500
504
|
name
|
|
501
505
|
notes
|
|
@@ -503,9 +507,10 @@ query getItemCategoryById ($id: Int) {
|
|
|
503
507
|
}
|
|
504
508
|
}
|
|
505
509
|
`;
|
|
506
|
-
exports.
|
|
507
|
-
|
|
508
|
-
|
|
510
|
+
exports.getItemCategoryByIdStringQuery = getItemCategoryByIdStringQuery;
|
|
511
|
+
const getItemsByCategoryStringQuery = (id) => `
|
|
512
|
+
query getItemsByCategory {
|
|
513
|
+
item_categories (where: {id: {_eq: ${id} }}) {
|
|
509
514
|
items (where: {active: {_eq: true }}) {
|
|
510
515
|
id,
|
|
511
516
|
name,
|
|
@@ -516,6 +521,7 @@ query getItemsByCategory ($id: Int) {
|
|
|
516
521
|
}
|
|
517
522
|
}
|
|
518
523
|
`;
|
|
524
|
+
exports.getItemsByCategoryStringQuery = getItemsByCategoryStringQuery;
|
|
519
525
|
exports.getItemsStringQuery = `
|
|
520
526
|
query getItems {
|
|
521
527
|
items (where: {active: {_eq: true }}) {
|
|
@@ -525,9 +531,9 @@ query getItems {
|
|
|
525
531
|
}
|
|
526
532
|
}
|
|
527
533
|
`;
|
|
528
|
-
|
|
529
|
-
query getItemsBySuperCategory
|
|
530
|
-
item_super_categories (where: {id: {_eq: $id }}, order_by: {id: desc}) {
|
|
534
|
+
const getItemsBySuperCategoryStringQuery = (id, agency_id) => `
|
|
535
|
+
query getItemsBySuperCategory {
|
|
536
|
+
item_super_categories (where: {id: {_eq: ${id} }}, order_by: {id: desc}) {
|
|
531
537
|
item_categories {
|
|
532
538
|
items (where: {active: {_eq: true }}) {
|
|
533
539
|
id,
|
|
@@ -538,7 +544,7 @@ query getItemsBySuperCategory ($id: bigint, $agency_id: Int) {
|
|
|
538
544
|
measurement_unit,
|
|
539
545
|
description
|
|
540
546
|
product_type
|
|
541
|
-
stocks(where: {agency_id: {_eq: $agency_id}}, order_by: {id: desc}) {
|
|
547
|
+
stocks(where: {agency_id: {_eq: ${agency_id}}}, order_by: {id: desc}) {
|
|
542
548
|
available
|
|
543
549
|
id
|
|
544
550
|
incoming
|
|
@@ -549,9 +555,10 @@ query getItemsBySuperCategory ($id: bigint, $agency_id: Int) {
|
|
|
549
555
|
}
|
|
550
556
|
}
|
|
551
557
|
`;
|
|
552
|
-
exports.
|
|
553
|
-
|
|
554
|
-
|
|
558
|
+
exports.getItemsBySuperCategoryStringQuery = getItemsBySuperCategoryStringQuery;
|
|
559
|
+
const getConsolidatesBetweenDatesStringQuery = (startDate, endDate) => `
|
|
560
|
+
query getConsolidatesBetweenDates {
|
|
561
|
+
consolidates (order_by: {id: desc}, where: {created_at: {_gte: "${startDate}", _lte: "${endDate}"}}) {
|
|
555
562
|
id
|
|
556
563
|
id_number
|
|
557
564
|
created_at
|
|
@@ -563,9 +570,10 @@ query getConsolidatesBetweenDates ($startDate: timestamp, $endDate: timestamp) {
|
|
|
563
570
|
}
|
|
564
571
|
}
|
|
565
572
|
`;
|
|
566
|
-
exports.
|
|
567
|
-
|
|
568
|
-
|
|
573
|
+
exports.getConsolidatesBetweenDatesStringQuery = getConsolidatesBetweenDatesStringQuery;
|
|
574
|
+
const getEmployeeProfileStringQuery = (id) => `
|
|
575
|
+
query getEmployeeProfile {
|
|
576
|
+
employees(where: {id: {_eq: ${id}}}) {
|
|
569
577
|
agency_id
|
|
570
578
|
email
|
|
571
579
|
entity_id
|
|
@@ -581,9 +589,10 @@ query getEmployeeProfile ($id: Int) {
|
|
|
581
589
|
}
|
|
582
590
|
}
|
|
583
591
|
`;
|
|
584
|
-
exports.
|
|
585
|
-
|
|
586
|
-
|
|
592
|
+
exports.getEmployeeProfileStringQuery = getEmployeeProfileStringQuery;
|
|
593
|
+
const getEmployeesByAgencyIdStringQuery = (id) => `
|
|
594
|
+
query getEmployeesByAgencyId {
|
|
595
|
+
employees(where: {agency_id: {_eq: ${id}}}) {
|
|
587
596
|
name
|
|
588
597
|
id
|
|
589
598
|
user_id
|
|
@@ -597,9 +606,10 @@ query getEmployeesByAgencyId ($id: Int) {
|
|
|
597
606
|
}
|
|
598
607
|
}
|
|
599
608
|
`;
|
|
600
|
-
exports.
|
|
601
|
-
|
|
602
|
-
|
|
609
|
+
exports.getEmployeesByAgencyIdStringQuery = getEmployeesByAgencyIdStringQuery;
|
|
610
|
+
const getBundlesByItemCategoryIdStringQuery = (id) => `
|
|
611
|
+
query getBundlesByItemCategoryId {
|
|
612
|
+
bundles(where: {active: {_eq: true}, item_category_id: {_eq: ${id}}}) {
|
|
603
613
|
id
|
|
604
614
|
code
|
|
605
615
|
description
|
|
@@ -615,16 +625,18 @@ query getBundlesByItemCategoryId ($id: Int) {
|
|
|
615
625
|
}
|
|
616
626
|
}
|
|
617
627
|
`;
|
|
618
|
-
exports.
|
|
619
|
-
|
|
620
|
-
|
|
628
|
+
exports.getBundlesByItemCategoryIdStringQuery = getBundlesByItemCategoryIdStringQuery;
|
|
629
|
+
const getBundleByNameStringQuery = (name) => `
|
|
630
|
+
query getBundleByName {
|
|
631
|
+
bundles (where: {name: {_eq: "${name}" }}) {
|
|
621
632
|
id
|
|
622
633
|
}
|
|
623
634
|
}
|
|
624
635
|
`;
|
|
625
|
-
exports.
|
|
626
|
-
|
|
627
|
-
|
|
636
|
+
exports.getBundleByNameStringQuery = getBundleByNameStringQuery;
|
|
637
|
+
const getItemByNameStringQuery = (name) => `
|
|
638
|
+
query getItemByName {
|
|
639
|
+
items (where: {active: {_eq: true }, name: {_eq: "${name}" }}) {
|
|
628
640
|
id
|
|
629
641
|
name
|
|
630
642
|
stocks_only_integer
|
|
@@ -633,6 +645,7 @@ query getItemByName ($name: String) {
|
|
|
633
645
|
}
|
|
634
646
|
}
|
|
635
647
|
`;
|
|
648
|
+
exports.getItemByNameStringQuery = getItemByNameStringQuery;
|
|
636
649
|
const getShipmentsStringQuery = (wheres = []) => {
|
|
637
650
|
const additionalWheres = wheres.join(",");
|
|
638
651
|
return `query getShipments {
|
|
@@ -716,10 +729,10 @@ query getAllForms {
|
|
|
716
729
|
}
|
|
717
730
|
`;
|
|
718
731
|
exports.getAllFormsStringQuery = getAllFormsStringQuery;
|
|
719
|
-
|
|
720
|
-
query getFormByName
|
|
732
|
+
const getFormByNameStringQuery = (name) => `
|
|
733
|
+
query getFormByName {
|
|
721
734
|
settings_forms (
|
|
722
|
-
where: {name: {_eq: $name }},
|
|
735
|
+
where: {name: {_eq: "${name}" }},
|
|
723
736
|
order_by: {zid: desc, version: desc}
|
|
724
737
|
) {
|
|
725
738
|
id
|
|
@@ -748,6 +761,7 @@ query getFormByName ($name: String) {
|
|
|
748
761
|
}
|
|
749
762
|
}
|
|
750
763
|
`;
|
|
764
|
+
exports.getFormByNameStringQuery = getFormByNameStringQuery;
|
|
751
765
|
exports.getFormsStringQuery = `
|
|
752
766
|
query getForms {
|
|
753
767
|
settings_forms (
|
|
@@ -779,12 +793,12 @@ query getForms {
|
|
|
779
793
|
}
|
|
780
794
|
}
|
|
781
795
|
`;
|
|
782
|
-
const getFormsByDocumentTypeStringQuery = (filters = {}) => `
|
|
783
|
-
query getFormsByDocumentType
|
|
796
|
+
const getFormsByDocumentTypeStringQuery = (document_type, filters = {}) => `
|
|
797
|
+
query getFormsByDocumentType {
|
|
784
798
|
settings_forms (
|
|
785
799
|
where: {
|
|
786
800
|
${filters?.formZid ? `zid: {_eq: ${filters?.formZid}},` : ""}
|
|
787
|
-
document_type: {_eq: $document_type}
|
|
801
|
+
document_type: {_eq: "${document_type}"}
|
|
788
802
|
},
|
|
789
803
|
order_by: {zid: desc, version: desc}
|
|
790
804
|
) {
|
|
@@ -821,8 +835,8 @@ query getFormsByDocumentType ($document_type: String) {
|
|
|
821
835
|
}
|
|
822
836
|
`;
|
|
823
837
|
exports.getFormsByDocumentTypeStringQuery = getFormsByDocumentTypeStringQuery;
|
|
824
|
-
const getMyCaseFormSubmissionsStringQuery = (filters = {}) => `
|
|
825
|
-
query getMyCaseFormSubmissions
|
|
838
|
+
const getMyCaseFormSubmissionsStringQuery = (responsible_id, filters = {}) => `
|
|
839
|
+
query getMyCaseFormSubmissions {
|
|
826
840
|
submission_cases (
|
|
827
841
|
limit: 500,
|
|
828
842
|
where: {
|
|
@@ -834,7 +848,7 @@ query getMyCaseFormSubmissions ($responsible_id: Int) {
|
|
|
834
848
|
},
|
|
835
849
|
case: {
|
|
836
850
|
${filters?.caseId ? `id: {_eq: ${filters?.caseId}},` : ""}
|
|
837
|
-
responsible_id: {_eq: $responsible_id}
|
|
851
|
+
responsible_id: {_eq: ${responsible_id}}
|
|
838
852
|
}
|
|
839
853
|
},
|
|
840
854
|
order_by: {id: desc})
|
|
@@ -893,9 +907,9 @@ query getMyCaseFormSubmissions ($responsible_id: Int) {
|
|
|
893
907
|
}
|
|
894
908
|
`;
|
|
895
909
|
exports.getMyCaseFormSubmissionsStringQuery = getMyCaseFormSubmissionsStringQuery;
|
|
896
|
-
|
|
897
|
-
query getFormSubmissionById
|
|
898
|
-
settings_form_submissions (where: {id: { _eq: $formId }}) {
|
|
910
|
+
const getFormSubmissionByIdStringQuery = (formId) => `
|
|
911
|
+
query getFormSubmissionById {
|
|
912
|
+
settings_form_submissions (where: {id: { _eq: ${formId} }}) {
|
|
899
913
|
id
|
|
900
914
|
zid
|
|
901
915
|
reference
|
|
@@ -927,11 +941,10 @@ query getFormSubmissionById ($formId: bigint) {
|
|
|
927
941
|
}
|
|
928
942
|
}
|
|
929
943
|
`;
|
|
930
|
-
|
|
944
|
+
exports.getFormSubmissionByIdStringQuery = getFormSubmissionByIdStringQuery;
|
|
945
|
+
const getInvoiceFormSubmissionsByAgencyIdStringQuery = (agency_id, filters) => {
|
|
931
946
|
return `
|
|
932
|
-
query getInvoiceFormSubmissionsByAgencyId
|
|
933
|
-
$agency_id: Int
|
|
934
|
-
) {
|
|
947
|
+
query getInvoiceFormSubmissionsByAgencyId {
|
|
935
948
|
submission_invoices(
|
|
936
949
|
where: {
|
|
937
950
|
settings_form_submission: {
|
|
@@ -949,7 +962,7 @@ query getInvoiceFormSubmissionsByAgencyId (
|
|
|
949
962
|
? `created_at: { _gte: "${filters?.startDate}T00:00:00", _lte: "${filters?.endDate}T00:00:00" },`
|
|
950
963
|
: ""}
|
|
951
964
|
invoice: {
|
|
952
|
-
agency_id: {_eq: $agency_id},
|
|
965
|
+
agency_id: {_eq: ${agency_id}},
|
|
953
966
|
${filters?.seller_id ? `seller_id: {_eq: ${filters?.seller_id} },` : ""}
|
|
954
967
|
${filters?.payee_id_number_search
|
|
955
968
|
? `payee: {
|
|
@@ -1043,11 +1056,11 @@ query getLastInvoiceFormSubmission {
|
|
|
1043
1056
|
}
|
|
1044
1057
|
`;
|
|
1045
1058
|
exports.getLastInvoiceFormSubmissionStringQuery = getLastInvoiceFormSubmissionStringQuery;
|
|
1046
|
-
const getInvoiceFormSubmissionsByInvoiceIdStringQuery = (filters = {}) => `
|
|
1047
|
-
query getInvoiceFormSubmissionsByInvoiceId
|
|
1059
|
+
const getInvoiceFormSubmissionsByInvoiceIdStringQuery = (invoice_id, filters = {}) => `
|
|
1060
|
+
query getInvoiceFormSubmissionsByInvoiceId {
|
|
1048
1061
|
submission_invoices(
|
|
1049
1062
|
where: {
|
|
1050
|
-
invoice_id: {_eq: $invoice_id},
|
|
1063
|
+
invoice_id: {_eq: ${invoice_id}},
|
|
1051
1064
|
settings_form_submission: {
|
|
1052
1065
|
${filters?.formZid
|
|
1053
1066
|
? `settings_form: {zid: {_eq: ${filters?.formZid}}},`
|
|
@@ -1207,9 +1220,9 @@ const getPaymentMethodsStringQuery = (config) => {
|
|
|
1207
1220
|
`;
|
|
1208
1221
|
};
|
|
1209
1222
|
exports.getPaymentMethodsStringQuery = getPaymentMethodsStringQuery;
|
|
1210
|
-
|
|
1211
|
-
query getPaymentTermById
|
|
1212
|
-
payment_terms (where: {id: {_eq: $id }}) {
|
|
1223
|
+
const getPaymentTermByIdStringQuery = (id) => `
|
|
1224
|
+
query getPaymentTermById {
|
|
1225
|
+
payment_terms (where: {id: {_eq: ${id} }}) {
|
|
1213
1226
|
active
|
|
1214
1227
|
id
|
|
1215
1228
|
memo
|
|
@@ -1222,9 +1235,10 @@ query getPaymentTermById ($id: Int) {
|
|
|
1222
1235
|
}
|
|
1223
1236
|
}
|
|
1224
1237
|
`;
|
|
1225
|
-
exports.
|
|
1226
|
-
|
|
1227
|
-
|
|
1238
|
+
exports.getPaymentTermByIdStringQuery = getPaymentTermByIdStringQuery;
|
|
1239
|
+
const getInvoicesByAgencyIdStringQuery = (id) => `
|
|
1240
|
+
query getInvoicesByAgencyId {
|
|
1241
|
+
invoices(limit: 1000, where: {agency_id: {_eq: ${id}}, voided: {_eq: false}}, order_by: {id: desc}) {
|
|
1228
1242
|
id
|
|
1229
1243
|
zid
|
|
1230
1244
|
id_number
|
|
@@ -1269,11 +1283,12 @@ query getInvoicesByAgencyId($id: Int) {
|
|
|
1269
1283
|
}
|
|
1270
1284
|
}
|
|
1271
1285
|
`;
|
|
1272
|
-
|
|
1286
|
+
exports.getInvoicesByAgencyIdStringQuery = getInvoicesByAgencyIdStringQuery;
|
|
1287
|
+
const getCasesByResponsibleIdStringQuery = (responsible_id, wheres = []) => {
|
|
1273
1288
|
const additionalWheres = wheres.join(",");
|
|
1274
1289
|
return `
|
|
1275
|
-
query getCasesByResponsibleId
|
|
1276
|
-
cases(where: {responsible_id: {_eq: $responsible_id}${additionalWheres.length > 0 ? "," : ""}${additionalWheres}}, order_by: {id: desc}) {
|
|
1290
|
+
query getCasesByResponsibleId {
|
|
1291
|
+
cases(where: {responsible_id: {_eq: ${responsible_id}}${additionalWheres.length > 0 ? "," : ""}${additionalWheres}}, order_by: {id: desc}) {
|
|
1277
1292
|
id
|
|
1278
1293
|
id_number
|
|
1279
1294
|
serial_id
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getPrintTemplatesStringQuery = exports.getCasesByResponsibleIdStringQuery = exports.getInvoicesByAgencyIdStringQuery = exports.getPaymentTermByIdStringQuery = exports.getPaymentMethodsStringQuery = exports.getPaymentTermsStringQuery = exports.getSuggestedPricesStringQuery = exports.getCurrenciesStringQuery = exports.getInvoiceFormSubmissionsByInvoiceIdStringQuery = exports.getLastInvoiceFormSubmissionStringQuery = exports.getInvoiceFormSubmissionsByAgencyIdStringQuery = exports.getFormSubmissionByIdStringQuery = exports.getMyCaseFormSubmissionsStringQuery = exports.getFormsByDocumentTypeStringQuery = exports.getFormsStringQuery = exports.getFormByNameStringQuery = exports.getAllFormsStringQuery = 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
|
-
|
|
5
|
-
query getLast100Receptions
|
|
6
|
-
purchase_orders(limit: 100, order_by: {created_at: desc}, where: {voided: {_eq: false}, agency_id: {_eq: $
|
|
4
|
+
const getLast100ReceptionsStringQuery = (agency_id) => `
|
|
5
|
+
query getLast100Receptions {
|
|
6
|
+
purchase_orders(limit: 100, order_by: {created_at: desc}, where: {voided: {_eq: false}, agency_id: {_eq: ${agency_id}}}) {
|
|
7
7
|
id
|
|
8
8
|
created_at
|
|
9
9
|
due
|
|
@@ -32,9 +32,10 @@ query getLast100Receptions($agencyId: Int) @cached {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
`;
|
|
35
|
-
exports.
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
exports.getLast100ReceptionsStringQuery = getLast100ReceptionsStringQuery;
|
|
36
|
+
const getPurchaseOrderByIdNumberStringQuery = (id_number) => `
|
|
37
|
+
query getPurchaseOrderByIdNumber {
|
|
38
|
+
purchase_orders(where: {id_number: {_eq: "${id_number}"}}) {
|
|
38
39
|
id
|
|
39
40
|
created_at
|
|
40
41
|
due
|
|
@@ -76,9 +77,10 @@ query getPurchaseOrderByIdNumber($id_number: String) @cached {
|
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
79
|
`;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
exports.getPurchaseOrderByIdNumberStringQuery = getPurchaseOrderByIdNumberStringQuery;
|
|
81
|
+
const getPurchaseOrderStringQuery = (id, config = { withLotStocks: false }) => `
|
|
82
|
+
query getPurchaseOrder($id: bigint) @cached {
|
|
83
|
+
purchase_orders(where: {id: {_eq: ${id}}}) {
|
|
82
84
|
id
|
|
83
85
|
agency_id
|
|
84
86
|
entity_id
|
|
@@ -147,11 +149,9 @@ query getPurchaseOrder($id: Int) @cached {
|
|
|
147
149
|
}
|
|
148
150
|
`;
|
|
149
151
|
exports.getPurchaseOrderStringQuery = getPurchaseOrderStringQuery;
|
|
150
|
-
|
|
151
|
-
query getShipmentsByToAgencyLast100
|
|
152
|
-
|
|
153
|
-
){
|
|
154
|
-
shipments(limit: 100, order_by: {id: desc}, where: {voided: {_eq: false}, shipped: {_eq: false}, delivered: {_eq: false}, agency_to_id: {_eq: $agency_to_id}}) {
|
|
152
|
+
const getShipmentsByToAgencyLast100StringQuery = (agency_to_id) => `
|
|
153
|
+
query getShipmentsByToAgencyLast100 {
|
|
154
|
+
shipments(limit: 100, order_by: {id: desc}, where: {voided: {_eq: false}, shipped: {_eq: false}, delivered: {_eq: false}, agency_to_id: {_eq: ${agency_to_id}}}) {
|
|
155
155
|
id
|
|
156
156
|
zid
|
|
157
157
|
id_number
|
|
@@ -178,20 +178,22 @@ query getShipmentsByToAgencyLast100(
|
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
`;
|
|
181
|
-
exports.
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
exports.getShipmentsByToAgencyLast100StringQuery = getShipmentsByToAgencyLast100StringQuery;
|
|
182
|
+
const getLotsByNameStringQuery = (name, entity_id) => `
|
|
183
|
+
query getLots {
|
|
184
|
+
lots (limit: 100, order_by: {id: desc}, where: {entity_id: {_eq: ${entity_id}}, name: {_eq: "${name}"}}) {
|
|
184
185
|
id
|
|
185
186
|
name
|
|
186
187
|
description
|
|
187
188
|
}
|
|
188
189
|
}
|
|
189
190
|
`;
|
|
190
|
-
exports.
|
|
191
|
-
|
|
191
|
+
exports.getLotsByNameStringQuery = getLotsByNameStringQuery;
|
|
192
|
+
const getLotStocksByAgencyIdStringQuery = (agency_id) => `
|
|
193
|
+
query getLotStocksByAgencyId {
|
|
192
194
|
lot_stocks (
|
|
193
195
|
order_by: { id: desc },
|
|
194
|
-
where: { agency_id: { _eq: $agency_id }}
|
|
196
|
+
where: { agency_id: { _eq: ${agency_id} } }
|
|
195
197
|
){
|
|
196
198
|
id
|
|
197
199
|
available
|
|
@@ -204,7 +206,8 @@ query getLotStocksByAgencyId($agency_id: Int){
|
|
|
204
206
|
}
|
|
205
207
|
}
|
|
206
208
|
`;
|
|
207
|
-
|
|
209
|
+
exports.getLotStocksByAgencyIdStringQuery = getLotStocksByAgencyIdStringQuery;
|
|
210
|
+
const getPurchaseOrdersBetweenDatesStringQuery = (startDate, endDate, config) => {
|
|
208
211
|
const conditions = [];
|
|
209
212
|
if (config.agencyId) {
|
|
210
213
|
conditions.push(`agency_id: { _eq: ${config.agencyId} }`);
|
|
@@ -236,8 +239,8 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config) => {
|
|
|
236
239
|
}
|
|
237
240
|
if (!config.id_number) {
|
|
238
241
|
conditions.push(config.betweenIssueDate
|
|
239
|
-
?
|
|
240
|
-
:
|
|
242
|
+
? `issue_date: { _gte: "${startDate}", _lte: "${endDate}" }`
|
|
243
|
+
: `created_at: { _gte: "${startDate}", _lte: "${endDate}"}`);
|
|
241
244
|
}
|
|
242
245
|
if (config.payeeCategoryIds && config.payeeCategoryIds.length > 0) {
|
|
243
246
|
conditions.push(`payee: { payee_category: { id: { _in: [${config.payeeCategoryIds.join(",")}] } } }`);
|
|
@@ -249,12 +252,6 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config) => {
|
|
|
249
252
|
const whereClause = conditions.length
|
|
250
253
|
? `where: { ${conditions.join(", ")} }`
|
|
251
254
|
: "";
|
|
252
|
-
const dateVariables = config.id_number
|
|
253
|
-
? ""
|
|
254
|
-
: `(
|
|
255
|
-
$startDate: ${config.betweenIssueDate ? "date" : "timestamp"},
|
|
256
|
-
$endDate: ${config.betweenIssueDate ? "date" : "timestamp"}
|
|
257
|
-
)`;
|
|
258
255
|
const lotStocksFragment = config.withLotStocks
|
|
259
256
|
? `
|
|
260
257
|
lot_stocks {
|
|
@@ -307,7 +304,7 @@ const getPurchaseOrdersBetweenDatesStringQuery = (config) => {
|
|
|
307
304
|
}`
|
|
308
305
|
: "";
|
|
309
306
|
return `
|
|
310
|
-
query getPurchaseOrdersBetweenDates
|
|
307
|
+
query getPurchaseOrdersBetweenDates {
|
|
311
308
|
purchase_orders (
|
|
312
309
|
order_by: { id: desc },
|
|
313
310
|
${whereClause}
|
|
@@ -363,19 +360,22 @@ query getAgencies {
|
|
|
363
360
|
}
|
|
364
361
|
}
|
|
365
362
|
`;
|
|
366
|
-
|
|
367
|
-
query getWebAppRow
|
|
368
|
-
webapp_rows(where: {id: {_eq: $id}}) {
|
|
363
|
+
const getWebAppRowStringQuery = (id) => `
|
|
364
|
+
query getWebAppRow {
|
|
365
|
+
webapp_rows(where: {id: {_eq: ${id}}}) {
|
|
366
|
+
id
|
|
369
367
|
data
|
|
368
|
+
created_at
|
|
370
369
|
}
|
|
371
370
|
}
|
|
372
371
|
`;
|
|
373
|
-
exports.
|
|
374
|
-
|
|
372
|
+
exports.getWebAppRowStringQuery = getWebAppRowStringQuery;
|
|
373
|
+
const getWebAppRowsByWebAppTableIdStringQuery = (webapp_table_id) => `
|
|
374
|
+
query getWebAppRowsByWebAppTableId {
|
|
375
375
|
webapp_rows (
|
|
376
376
|
where: {
|
|
377
377
|
webapp_table_id: {
|
|
378
|
-
_eq: $webapp_table_id
|
|
378
|
+
_eq: ${webapp_table_id}
|
|
379
379
|
}
|
|
380
380
|
},
|
|
381
381
|
order_by: {
|
|
@@ -388,9 +388,10 @@ query getWebAppRowsByWebAppTableId ($webapp_table_id: Int) {
|
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
390
|
`;
|
|
391
|
-
exports.
|
|
392
|
-
|
|
393
|
-
|
|
391
|
+
exports.getWebAppRowsByWebAppTableIdStringQuery = getWebAppRowsByWebAppTableIdStringQuery;
|
|
392
|
+
const getPayeeCategoryByIdStringQuery = (id) => `
|
|
393
|
+
query getPayeeCategoryById {
|
|
394
|
+
payee_categories (where: {id: {_eq: ${id} }}) {
|
|
394
395
|
payees (order_by: { id: desc }) {
|
|
395
396
|
id
|
|
396
397
|
name
|
|
@@ -405,6 +406,7 @@ query getPayeeCategoryById ($id: Int) {
|
|
|
405
406
|
}
|
|
406
407
|
}
|
|
407
408
|
`;
|
|
409
|
+
exports.getPayeeCategoryByIdStringQuery = getPayeeCategoryByIdStringQuery;
|
|
408
410
|
const getPayeeCategoriesByNotesMatchStringQuery = (match) => `
|
|
409
411
|
query getPayeeCategoriesByNotesMatch {
|
|
410
412
|
payee_categories(where: {notes: {_ilike: "%${match}%" }}) {
|
|
@@ -467,9 +469,9 @@ query getClientCategories {
|
|
|
467
469
|
}
|
|
468
470
|
}
|
|
469
471
|
`;
|
|
470
|
-
|
|
471
|
-
query getPayeeById
|
|
472
|
-
payees (where: {id: {_eq: $id }}) {
|
|
472
|
+
const getPayeeByIdStringQuery = (id) => `
|
|
473
|
+
query getPayeeById {
|
|
474
|
+
payees (where: {id: {_eq: ${id} }}) {
|
|
473
475
|
id
|
|
474
476
|
name
|
|
475
477
|
id_number
|
|
@@ -481,9 +483,10 @@ query getPayeeById ($id: Int) {
|
|
|
481
483
|
}
|
|
482
484
|
}
|
|
483
485
|
`;
|
|
484
|
-
exports.
|
|
485
|
-
|
|
486
|
-
|
|
486
|
+
exports.getPayeeByIdStringQuery = getPayeeByIdStringQuery;
|
|
487
|
+
const getSuperCategoryByIdStringQuery = (id) => `
|
|
488
|
+
query getSuperCategoryById {
|
|
489
|
+
item_super_categories (where: {id: {_eq: ${id} }}) {
|
|
487
490
|
item_categories {
|
|
488
491
|
id
|
|
489
492
|
name
|
|
@@ -493,9 +496,10 @@ query getSuperCategoryById ($id: bigint) {
|
|
|
493
496
|
}
|
|
494
497
|
}
|
|
495
498
|
`;
|
|
496
|
-
exports.
|
|
497
|
-
|
|
498
|
-
|
|
499
|
+
exports.getSuperCategoryByIdStringQuery = getSuperCategoryByIdStringQuery;
|
|
500
|
+
const getItemCategoryByIdStringQuery = (id) => `
|
|
501
|
+
query getItemCategoryById {
|
|
502
|
+
item_categories (where: {id: {_eq: ${id} }}) {
|
|
499
503
|
id
|
|
500
504
|
name
|
|
501
505
|
notes
|
|
@@ -503,9 +507,10 @@ query getItemCategoryById ($id: Int) {
|
|
|
503
507
|
}
|
|
504
508
|
}
|
|
505
509
|
`;
|
|
506
|
-
exports.
|
|
507
|
-
|
|
508
|
-
|
|
510
|
+
exports.getItemCategoryByIdStringQuery = getItemCategoryByIdStringQuery;
|
|
511
|
+
const getItemsByCategoryStringQuery = (id) => `
|
|
512
|
+
query getItemsByCategory {
|
|
513
|
+
item_categories (where: {id: {_eq: ${id} }}) {
|
|
509
514
|
items (where: {active: {_eq: true }}) {
|
|
510
515
|
id,
|
|
511
516
|
name,
|
|
@@ -516,6 +521,7 @@ query getItemsByCategory ($id: Int) {
|
|
|
516
521
|
}
|
|
517
522
|
}
|
|
518
523
|
`;
|
|
524
|
+
exports.getItemsByCategoryStringQuery = getItemsByCategoryStringQuery;
|
|
519
525
|
exports.getItemsStringQuery = `
|
|
520
526
|
query getItems {
|
|
521
527
|
items (where: {active: {_eq: true }}) {
|
|
@@ -525,9 +531,9 @@ query getItems {
|
|
|
525
531
|
}
|
|
526
532
|
}
|
|
527
533
|
`;
|
|
528
|
-
|
|
529
|
-
query getItemsBySuperCategory
|
|
530
|
-
item_super_categories (where: {id: {_eq: $id }}, order_by: {id: desc}) {
|
|
534
|
+
const getItemsBySuperCategoryStringQuery = (id, agency_id) => `
|
|
535
|
+
query getItemsBySuperCategory {
|
|
536
|
+
item_super_categories (where: {id: {_eq: ${id} }}, order_by: {id: desc}) {
|
|
531
537
|
item_categories {
|
|
532
538
|
items (where: {active: {_eq: true }}) {
|
|
533
539
|
id,
|
|
@@ -538,7 +544,7 @@ query getItemsBySuperCategory ($id: bigint, $agency_id: Int) {
|
|
|
538
544
|
measurement_unit,
|
|
539
545
|
description
|
|
540
546
|
product_type
|
|
541
|
-
stocks(where: {agency_id: {_eq: $agency_id}}, order_by: {id: desc}) {
|
|
547
|
+
stocks(where: {agency_id: {_eq: ${agency_id}}}, order_by: {id: desc}) {
|
|
542
548
|
available
|
|
543
549
|
id
|
|
544
550
|
incoming
|
|
@@ -549,9 +555,10 @@ query getItemsBySuperCategory ($id: bigint, $agency_id: Int) {
|
|
|
549
555
|
}
|
|
550
556
|
}
|
|
551
557
|
`;
|
|
552
|
-
exports.
|
|
553
|
-
|
|
554
|
-
|
|
558
|
+
exports.getItemsBySuperCategoryStringQuery = getItemsBySuperCategoryStringQuery;
|
|
559
|
+
const getConsolidatesBetweenDatesStringQuery = (startDate, endDate) => `
|
|
560
|
+
query getConsolidatesBetweenDates {
|
|
561
|
+
consolidates (order_by: {id: desc}, where: {created_at: {_gte: "${startDate}", _lte: "${endDate}"}}) {
|
|
555
562
|
id
|
|
556
563
|
id_number
|
|
557
564
|
created_at
|
|
@@ -563,9 +570,10 @@ query getConsolidatesBetweenDates ($startDate: timestamp, $endDate: timestamp) {
|
|
|
563
570
|
}
|
|
564
571
|
}
|
|
565
572
|
`;
|
|
566
|
-
exports.
|
|
567
|
-
|
|
568
|
-
|
|
573
|
+
exports.getConsolidatesBetweenDatesStringQuery = getConsolidatesBetweenDatesStringQuery;
|
|
574
|
+
const getEmployeeProfileStringQuery = (id) => `
|
|
575
|
+
query getEmployeeProfile {
|
|
576
|
+
employees(where: {id: {_eq: ${id}}}) {
|
|
569
577
|
agency_id
|
|
570
578
|
email
|
|
571
579
|
entity_id
|
|
@@ -581,9 +589,10 @@ query getEmployeeProfile ($id: Int) {
|
|
|
581
589
|
}
|
|
582
590
|
}
|
|
583
591
|
`;
|
|
584
|
-
exports.
|
|
585
|
-
|
|
586
|
-
|
|
592
|
+
exports.getEmployeeProfileStringQuery = getEmployeeProfileStringQuery;
|
|
593
|
+
const getEmployeesByAgencyIdStringQuery = (id) => `
|
|
594
|
+
query getEmployeesByAgencyId {
|
|
595
|
+
employees(where: {agency_id: {_eq: ${id}}}) {
|
|
587
596
|
name
|
|
588
597
|
id
|
|
589
598
|
user_id
|
|
@@ -597,9 +606,10 @@ query getEmployeesByAgencyId ($id: Int) {
|
|
|
597
606
|
}
|
|
598
607
|
}
|
|
599
608
|
`;
|
|
600
|
-
exports.
|
|
601
|
-
|
|
602
|
-
|
|
609
|
+
exports.getEmployeesByAgencyIdStringQuery = getEmployeesByAgencyIdStringQuery;
|
|
610
|
+
const getBundlesByItemCategoryIdStringQuery = (id) => `
|
|
611
|
+
query getBundlesByItemCategoryId {
|
|
612
|
+
bundles(where: {active: {_eq: true}, item_category_id: {_eq: ${id}}}) {
|
|
603
613
|
id
|
|
604
614
|
code
|
|
605
615
|
description
|
|
@@ -615,16 +625,18 @@ query getBundlesByItemCategoryId ($id: Int) {
|
|
|
615
625
|
}
|
|
616
626
|
}
|
|
617
627
|
`;
|
|
618
|
-
exports.
|
|
619
|
-
|
|
620
|
-
|
|
628
|
+
exports.getBundlesByItemCategoryIdStringQuery = getBundlesByItemCategoryIdStringQuery;
|
|
629
|
+
const getBundleByNameStringQuery = (name) => `
|
|
630
|
+
query getBundleByName {
|
|
631
|
+
bundles (where: {name: {_eq: "${name}" }}) {
|
|
621
632
|
id
|
|
622
633
|
}
|
|
623
634
|
}
|
|
624
635
|
`;
|
|
625
|
-
exports.
|
|
626
|
-
|
|
627
|
-
|
|
636
|
+
exports.getBundleByNameStringQuery = getBundleByNameStringQuery;
|
|
637
|
+
const getItemByNameStringQuery = (name) => `
|
|
638
|
+
query getItemByName {
|
|
639
|
+
items (where: {active: {_eq: true }, name: {_eq: "${name}" }}) {
|
|
628
640
|
id
|
|
629
641
|
name
|
|
630
642
|
stocks_only_integer
|
|
@@ -633,6 +645,7 @@ query getItemByName ($name: String) {
|
|
|
633
645
|
}
|
|
634
646
|
}
|
|
635
647
|
`;
|
|
648
|
+
exports.getItemByNameStringQuery = getItemByNameStringQuery;
|
|
636
649
|
const getShipmentsStringQuery = (wheres = []) => {
|
|
637
650
|
const additionalWheres = wheres.join(",");
|
|
638
651
|
return `query getShipments {
|
|
@@ -716,10 +729,10 @@ query getAllForms {
|
|
|
716
729
|
}
|
|
717
730
|
`;
|
|
718
731
|
exports.getAllFormsStringQuery = getAllFormsStringQuery;
|
|
719
|
-
|
|
720
|
-
query getFormByName
|
|
732
|
+
const getFormByNameStringQuery = (name) => `
|
|
733
|
+
query getFormByName {
|
|
721
734
|
settings_forms (
|
|
722
|
-
where: {name: {_eq: $name }},
|
|
735
|
+
where: {name: {_eq: "${name}" }},
|
|
723
736
|
order_by: {zid: desc, version: desc}
|
|
724
737
|
) {
|
|
725
738
|
id
|
|
@@ -748,6 +761,7 @@ query getFormByName ($name: String) {
|
|
|
748
761
|
}
|
|
749
762
|
}
|
|
750
763
|
`;
|
|
764
|
+
exports.getFormByNameStringQuery = getFormByNameStringQuery;
|
|
751
765
|
exports.getFormsStringQuery = `
|
|
752
766
|
query getForms {
|
|
753
767
|
settings_forms (
|
|
@@ -779,12 +793,12 @@ query getForms {
|
|
|
779
793
|
}
|
|
780
794
|
}
|
|
781
795
|
`;
|
|
782
|
-
const getFormsByDocumentTypeStringQuery = (filters = {}) => `
|
|
783
|
-
query getFormsByDocumentType
|
|
796
|
+
const getFormsByDocumentTypeStringQuery = (document_type, filters = {}) => `
|
|
797
|
+
query getFormsByDocumentType {
|
|
784
798
|
settings_forms (
|
|
785
799
|
where: {
|
|
786
800
|
${filters?.formZid ? `zid: {_eq: ${filters?.formZid}},` : ""}
|
|
787
|
-
document_type: {_eq: $document_type}
|
|
801
|
+
document_type: {_eq: "${document_type}"}
|
|
788
802
|
},
|
|
789
803
|
order_by: {zid: desc, version: desc}
|
|
790
804
|
) {
|
|
@@ -821,8 +835,8 @@ query getFormsByDocumentType ($document_type: String) {
|
|
|
821
835
|
}
|
|
822
836
|
`;
|
|
823
837
|
exports.getFormsByDocumentTypeStringQuery = getFormsByDocumentTypeStringQuery;
|
|
824
|
-
const getMyCaseFormSubmissionsStringQuery = (filters = {}) => `
|
|
825
|
-
query getMyCaseFormSubmissions
|
|
838
|
+
const getMyCaseFormSubmissionsStringQuery = (responsible_id, filters = {}) => `
|
|
839
|
+
query getMyCaseFormSubmissions {
|
|
826
840
|
submission_cases (
|
|
827
841
|
limit: 500,
|
|
828
842
|
where: {
|
|
@@ -834,7 +848,7 @@ query getMyCaseFormSubmissions ($responsible_id: Int) {
|
|
|
834
848
|
},
|
|
835
849
|
case: {
|
|
836
850
|
${filters?.caseId ? `id: {_eq: ${filters?.caseId}},` : ""}
|
|
837
|
-
responsible_id: {_eq: $responsible_id}
|
|
851
|
+
responsible_id: {_eq: ${responsible_id}}
|
|
838
852
|
}
|
|
839
853
|
},
|
|
840
854
|
order_by: {id: desc})
|
|
@@ -893,9 +907,9 @@ query getMyCaseFormSubmissions ($responsible_id: Int) {
|
|
|
893
907
|
}
|
|
894
908
|
`;
|
|
895
909
|
exports.getMyCaseFormSubmissionsStringQuery = getMyCaseFormSubmissionsStringQuery;
|
|
896
|
-
|
|
897
|
-
query getFormSubmissionById
|
|
898
|
-
settings_form_submissions (where: {id: { _eq: $formId }}) {
|
|
910
|
+
const getFormSubmissionByIdStringQuery = (formId) => `
|
|
911
|
+
query getFormSubmissionById {
|
|
912
|
+
settings_form_submissions (where: {id: { _eq: ${formId} }}) {
|
|
899
913
|
id
|
|
900
914
|
zid
|
|
901
915
|
reference
|
|
@@ -927,11 +941,10 @@ query getFormSubmissionById ($formId: bigint) {
|
|
|
927
941
|
}
|
|
928
942
|
}
|
|
929
943
|
`;
|
|
930
|
-
|
|
944
|
+
exports.getFormSubmissionByIdStringQuery = getFormSubmissionByIdStringQuery;
|
|
945
|
+
const getInvoiceFormSubmissionsByAgencyIdStringQuery = (agency_id, filters) => {
|
|
931
946
|
return `
|
|
932
|
-
query getInvoiceFormSubmissionsByAgencyId
|
|
933
|
-
$agency_id: Int
|
|
934
|
-
) {
|
|
947
|
+
query getInvoiceFormSubmissionsByAgencyId {
|
|
935
948
|
submission_invoices(
|
|
936
949
|
where: {
|
|
937
950
|
settings_form_submission: {
|
|
@@ -949,7 +962,7 @@ query getInvoiceFormSubmissionsByAgencyId (
|
|
|
949
962
|
? `created_at: { _gte: "${filters?.startDate}T00:00:00", _lte: "${filters?.endDate}T00:00:00" },`
|
|
950
963
|
: ""}
|
|
951
964
|
invoice: {
|
|
952
|
-
agency_id: {_eq: $agency_id},
|
|
965
|
+
agency_id: {_eq: ${agency_id}},
|
|
953
966
|
${filters?.seller_id ? `seller_id: {_eq: ${filters?.seller_id} },` : ""}
|
|
954
967
|
${filters?.payee_id_number_search
|
|
955
968
|
? `payee: {
|
|
@@ -1043,11 +1056,11 @@ query getLastInvoiceFormSubmission {
|
|
|
1043
1056
|
}
|
|
1044
1057
|
`;
|
|
1045
1058
|
exports.getLastInvoiceFormSubmissionStringQuery = getLastInvoiceFormSubmissionStringQuery;
|
|
1046
|
-
const getInvoiceFormSubmissionsByInvoiceIdStringQuery = (filters = {}) => `
|
|
1047
|
-
query getInvoiceFormSubmissionsByInvoiceId
|
|
1059
|
+
const getInvoiceFormSubmissionsByInvoiceIdStringQuery = (invoice_id, filters = {}) => `
|
|
1060
|
+
query getInvoiceFormSubmissionsByInvoiceId {
|
|
1048
1061
|
submission_invoices(
|
|
1049
1062
|
where: {
|
|
1050
|
-
invoice_id: {_eq: $invoice_id},
|
|
1063
|
+
invoice_id: {_eq: ${invoice_id}},
|
|
1051
1064
|
settings_form_submission: {
|
|
1052
1065
|
${filters?.formZid
|
|
1053
1066
|
? `settings_form: {zid: {_eq: ${filters?.formZid}}},`
|
|
@@ -1207,9 +1220,9 @@ const getPaymentMethodsStringQuery = (config) => {
|
|
|
1207
1220
|
`;
|
|
1208
1221
|
};
|
|
1209
1222
|
exports.getPaymentMethodsStringQuery = getPaymentMethodsStringQuery;
|
|
1210
|
-
|
|
1211
|
-
query getPaymentTermById
|
|
1212
|
-
payment_terms (where: {id: {_eq: $id }}) {
|
|
1223
|
+
const getPaymentTermByIdStringQuery = (id) => `
|
|
1224
|
+
query getPaymentTermById {
|
|
1225
|
+
payment_terms (where: {id: {_eq: ${id} }}) {
|
|
1213
1226
|
active
|
|
1214
1227
|
id
|
|
1215
1228
|
memo
|
|
@@ -1222,9 +1235,10 @@ query getPaymentTermById ($id: Int) {
|
|
|
1222
1235
|
}
|
|
1223
1236
|
}
|
|
1224
1237
|
`;
|
|
1225
|
-
exports.
|
|
1226
|
-
|
|
1227
|
-
|
|
1238
|
+
exports.getPaymentTermByIdStringQuery = getPaymentTermByIdStringQuery;
|
|
1239
|
+
const getInvoicesByAgencyIdStringQuery = (id) => `
|
|
1240
|
+
query getInvoicesByAgencyId {
|
|
1241
|
+
invoices(limit: 1000, where: {agency_id: {_eq: ${id}}, voided: {_eq: false}}, order_by: {id: desc}) {
|
|
1228
1242
|
id
|
|
1229
1243
|
zid
|
|
1230
1244
|
id_number
|
|
@@ -1269,11 +1283,12 @@ query getInvoicesByAgencyId($id: Int) {
|
|
|
1269
1283
|
}
|
|
1270
1284
|
}
|
|
1271
1285
|
`;
|
|
1272
|
-
|
|
1286
|
+
exports.getInvoicesByAgencyIdStringQuery = getInvoicesByAgencyIdStringQuery;
|
|
1287
|
+
const getCasesByResponsibleIdStringQuery = (responsible_id, wheres = []) => {
|
|
1273
1288
|
const additionalWheres = wheres.join(",");
|
|
1274
1289
|
return `
|
|
1275
|
-
query getCasesByResponsibleId
|
|
1276
|
-
cases(where: {responsible_id: {_eq: $responsible_id}${additionalWheres.length > 0 ? "," : ""}${additionalWheres}}, order_by: {id: desc}) {
|
|
1290
|
+
query getCasesByResponsibleId {
|
|
1291
|
+
cases(where: {responsible_id: {_eq: ${responsible_id}}${additionalWheres.length > 0 ? "," : ""}${additionalWheres}}, order_by: {id: desc}) {
|
|
1277
1292
|
id
|
|
1278
1293
|
id_number
|
|
1279
1294
|
serial_id
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/graphql",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.105",
|
|
4
4
|
"description": "Queries de uso común para las aplicación de Zauru.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"typescript": "^5.1.6"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "57fb17e6d485c1d661432a1517fe8c4e8d354e78"
|
|
26
26
|
}
|