@zauru-sdk/graphql 1.0.93 → 1.0.94
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 +115 -102
- package/dist/esm/GraphQL.queries.js +115 -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,20 @@ 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}}}) {
|
|
369
366
|
data
|
|
370
367
|
}
|
|
371
368
|
}
|
|
372
369
|
`;
|
|
373
|
-
exports.
|
|
374
|
-
|
|
370
|
+
exports.getWebAppRowStringQuery = getWebAppRowStringQuery;
|
|
371
|
+
const getWebAppRowsByWebAppTableIdStringQuery = (webapp_table_id) => `
|
|
372
|
+
query getWebAppRowsByWebAppTableId {
|
|
375
373
|
webapp_rows (
|
|
376
374
|
where: {
|
|
377
375
|
webapp_table_id: {
|
|
378
|
-
_eq: $webapp_table_id
|
|
376
|
+
_eq: ${webapp_table_id}
|
|
379
377
|
}
|
|
380
378
|
},
|
|
381
379
|
order_by: {
|
|
@@ -388,9 +386,10 @@ query getWebAppRowsByWebAppTableId ($webapp_table_id: Int) {
|
|
|
388
386
|
}
|
|
389
387
|
}
|
|
390
388
|
`;
|
|
391
|
-
exports.
|
|
392
|
-
|
|
393
|
-
|
|
389
|
+
exports.getWebAppRowsByWebAppTableIdStringQuery = getWebAppRowsByWebAppTableIdStringQuery;
|
|
390
|
+
const getPayeeCategoryByIdStringQuery = (id) => `
|
|
391
|
+
query getPayeeCategoryById {
|
|
392
|
+
payee_categories (where: {id: {_eq: ${id} }}) {
|
|
394
393
|
payees (order_by: { id: desc }) {
|
|
395
394
|
id
|
|
396
395
|
name
|
|
@@ -405,6 +404,7 @@ query getPayeeCategoryById ($id: Int) {
|
|
|
405
404
|
}
|
|
406
405
|
}
|
|
407
406
|
`;
|
|
407
|
+
exports.getPayeeCategoryByIdStringQuery = getPayeeCategoryByIdStringQuery;
|
|
408
408
|
const getPayeeCategoriesByNotesMatchStringQuery = (match) => `
|
|
409
409
|
query getPayeeCategoriesByNotesMatch {
|
|
410
410
|
payee_categories(where: {notes: {_ilike: "%${match}%" }}) {
|
|
@@ -467,9 +467,9 @@ query getClientCategories {
|
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
469
|
`;
|
|
470
|
-
|
|
471
|
-
query getPayeeById
|
|
472
|
-
payees (where: {id: {_eq: $id }}) {
|
|
470
|
+
const getPayeeByIdStringQuery = (id) => `
|
|
471
|
+
query getPayeeById {
|
|
472
|
+
payees (where: {id: {_eq: ${id} }}) {
|
|
473
473
|
id
|
|
474
474
|
name
|
|
475
475
|
id_number
|
|
@@ -481,9 +481,10 @@ query getPayeeById ($id: Int) {
|
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
483
|
`;
|
|
484
|
-
exports.
|
|
485
|
-
|
|
486
|
-
|
|
484
|
+
exports.getPayeeByIdStringQuery = getPayeeByIdStringQuery;
|
|
485
|
+
const getSuperCategoryByIdStringQuery = (id) => `
|
|
486
|
+
query getSuperCategoryById {
|
|
487
|
+
item_super_categories (where: {id: {_eq: ${id} }}) {
|
|
487
488
|
item_categories {
|
|
488
489
|
id
|
|
489
490
|
name
|
|
@@ -493,9 +494,10 @@ query getSuperCategoryById ($id: bigint) {
|
|
|
493
494
|
}
|
|
494
495
|
}
|
|
495
496
|
`;
|
|
496
|
-
exports.
|
|
497
|
-
|
|
498
|
-
|
|
497
|
+
exports.getSuperCategoryByIdStringQuery = getSuperCategoryByIdStringQuery;
|
|
498
|
+
const getItemCategoryByIdStringQuery = (id) => `
|
|
499
|
+
query getItemCategoryById {
|
|
500
|
+
item_categories (where: {id: {_eq: ${id} }}) {
|
|
499
501
|
id
|
|
500
502
|
name
|
|
501
503
|
notes
|
|
@@ -503,9 +505,10 @@ query getItemCategoryById ($id: Int) {
|
|
|
503
505
|
}
|
|
504
506
|
}
|
|
505
507
|
`;
|
|
506
|
-
exports.
|
|
507
|
-
|
|
508
|
-
|
|
508
|
+
exports.getItemCategoryByIdStringQuery = getItemCategoryByIdStringQuery;
|
|
509
|
+
const getItemsByCategoryStringQuery = (id) => `
|
|
510
|
+
query getItemsByCategory {
|
|
511
|
+
item_categories (where: {id: {_eq: ${id} }}) {
|
|
509
512
|
items (where: {active: {_eq: true }}) {
|
|
510
513
|
id,
|
|
511
514
|
name,
|
|
@@ -516,6 +519,7 @@ query getItemsByCategory ($id: Int) {
|
|
|
516
519
|
}
|
|
517
520
|
}
|
|
518
521
|
`;
|
|
522
|
+
exports.getItemsByCategoryStringQuery = getItemsByCategoryStringQuery;
|
|
519
523
|
exports.getItemsStringQuery = `
|
|
520
524
|
query getItems {
|
|
521
525
|
items (where: {active: {_eq: true }}) {
|
|
@@ -525,9 +529,9 @@ query getItems {
|
|
|
525
529
|
}
|
|
526
530
|
}
|
|
527
531
|
`;
|
|
528
|
-
|
|
529
|
-
query getItemsBySuperCategory
|
|
530
|
-
item_super_categories (where: {id: {_eq: $id }}, order_by: {id: desc}) {
|
|
532
|
+
const getItemsBySuperCategoryStringQuery = (id, agency_id) => `
|
|
533
|
+
query getItemsBySuperCategory {
|
|
534
|
+
item_super_categories (where: {id: {_eq: ${id} }}, order_by: {id: desc}) {
|
|
531
535
|
item_categories {
|
|
532
536
|
items (where: {active: {_eq: true }}) {
|
|
533
537
|
id,
|
|
@@ -538,7 +542,7 @@ query getItemsBySuperCategory ($id: bigint, $agency_id: Int) {
|
|
|
538
542
|
measurement_unit,
|
|
539
543
|
description
|
|
540
544
|
product_type
|
|
541
|
-
stocks(where: {agency_id: {_eq: $agency_id}}, order_by: {id: desc}) {
|
|
545
|
+
stocks(where: {agency_id: {_eq: ${agency_id}}}, order_by: {id: desc}) {
|
|
542
546
|
available
|
|
543
547
|
id
|
|
544
548
|
incoming
|
|
@@ -549,9 +553,10 @@ query getItemsBySuperCategory ($id: bigint, $agency_id: Int) {
|
|
|
549
553
|
}
|
|
550
554
|
}
|
|
551
555
|
`;
|
|
552
|
-
exports.
|
|
553
|
-
|
|
554
|
-
|
|
556
|
+
exports.getItemsBySuperCategoryStringQuery = getItemsBySuperCategoryStringQuery;
|
|
557
|
+
const getConsolidatesBetweenDatesStringQuery = (startDate, endDate) => `
|
|
558
|
+
query getConsolidatesBetweenDates {
|
|
559
|
+
consolidates (order_by: {id: desc}, where: {created_at: {_gte: "${startDate}", _lte: "${endDate}"}}) {
|
|
555
560
|
id
|
|
556
561
|
id_number
|
|
557
562
|
created_at
|
|
@@ -563,9 +568,10 @@ query getConsolidatesBetweenDates ($startDate: timestamp, $endDate: timestamp) {
|
|
|
563
568
|
}
|
|
564
569
|
}
|
|
565
570
|
`;
|
|
566
|
-
exports.
|
|
567
|
-
|
|
568
|
-
|
|
571
|
+
exports.getConsolidatesBetweenDatesStringQuery = getConsolidatesBetweenDatesStringQuery;
|
|
572
|
+
const getEmployeeProfileStringQuery = (id) => `
|
|
573
|
+
query getEmployeeProfile {
|
|
574
|
+
employees(where: {id: {_eq: ${id}}}) {
|
|
569
575
|
agency_id
|
|
570
576
|
email
|
|
571
577
|
entity_id
|
|
@@ -581,9 +587,10 @@ query getEmployeeProfile ($id: Int) {
|
|
|
581
587
|
}
|
|
582
588
|
}
|
|
583
589
|
`;
|
|
584
|
-
exports.
|
|
585
|
-
|
|
586
|
-
|
|
590
|
+
exports.getEmployeeProfileStringQuery = getEmployeeProfileStringQuery;
|
|
591
|
+
const getEmployeesByAgencyIdStringQuery = (id) => `
|
|
592
|
+
query getEmployeesByAgencyId {
|
|
593
|
+
employees(where: {agency_id: {_eq: ${id}}}) {
|
|
587
594
|
name
|
|
588
595
|
id
|
|
589
596
|
user_id
|
|
@@ -597,9 +604,10 @@ query getEmployeesByAgencyId ($id: Int) {
|
|
|
597
604
|
}
|
|
598
605
|
}
|
|
599
606
|
`;
|
|
600
|
-
exports.
|
|
601
|
-
|
|
602
|
-
|
|
607
|
+
exports.getEmployeesByAgencyIdStringQuery = getEmployeesByAgencyIdStringQuery;
|
|
608
|
+
const getBundlesByItemCategoryIdStringQuery = (id) => `
|
|
609
|
+
query getBundlesByItemCategoryId {
|
|
610
|
+
bundles(where: {active: {_eq: true}, item_category_id: {_eq: ${id}}}) {
|
|
603
611
|
id
|
|
604
612
|
code
|
|
605
613
|
description
|
|
@@ -615,16 +623,18 @@ query getBundlesByItemCategoryId ($id: Int) {
|
|
|
615
623
|
}
|
|
616
624
|
}
|
|
617
625
|
`;
|
|
618
|
-
exports.
|
|
619
|
-
|
|
620
|
-
|
|
626
|
+
exports.getBundlesByItemCategoryIdStringQuery = getBundlesByItemCategoryIdStringQuery;
|
|
627
|
+
const getBundleByNameStringQuery = (name) => `
|
|
628
|
+
query getBundleByName {
|
|
629
|
+
bundles (where: {name: {_eq: "${name}" }}) {
|
|
621
630
|
id
|
|
622
631
|
}
|
|
623
632
|
}
|
|
624
633
|
`;
|
|
625
|
-
exports.
|
|
626
|
-
|
|
627
|
-
|
|
634
|
+
exports.getBundleByNameStringQuery = getBundleByNameStringQuery;
|
|
635
|
+
const getItemByNameStringQuery = (name) => `
|
|
636
|
+
query getItemByName {
|
|
637
|
+
items (where: {active: {_eq: true }, name: {_eq: "${name}" }}) {
|
|
628
638
|
id
|
|
629
639
|
name
|
|
630
640
|
stocks_only_integer
|
|
@@ -633,6 +643,7 @@ query getItemByName ($name: String) {
|
|
|
633
643
|
}
|
|
634
644
|
}
|
|
635
645
|
`;
|
|
646
|
+
exports.getItemByNameStringQuery = getItemByNameStringQuery;
|
|
636
647
|
const getShipmentsStringQuery = (wheres = []) => {
|
|
637
648
|
const additionalWheres = wheres.join(",");
|
|
638
649
|
return `query getShipments {
|
|
@@ -716,10 +727,10 @@ query getAllForms {
|
|
|
716
727
|
}
|
|
717
728
|
`;
|
|
718
729
|
exports.getAllFormsStringQuery = getAllFormsStringQuery;
|
|
719
|
-
|
|
720
|
-
query getFormByName
|
|
730
|
+
const getFormByNameStringQuery = (name) => `
|
|
731
|
+
query getFormByName {
|
|
721
732
|
settings_forms (
|
|
722
|
-
where: {name: {_eq: $name }},
|
|
733
|
+
where: {name: {_eq: "${name}" }},
|
|
723
734
|
order_by: {zid: desc, version: desc}
|
|
724
735
|
) {
|
|
725
736
|
id
|
|
@@ -748,6 +759,7 @@ query getFormByName ($name: String) {
|
|
|
748
759
|
}
|
|
749
760
|
}
|
|
750
761
|
`;
|
|
762
|
+
exports.getFormByNameStringQuery = getFormByNameStringQuery;
|
|
751
763
|
exports.getFormsStringQuery = `
|
|
752
764
|
query getForms {
|
|
753
765
|
settings_forms (
|
|
@@ -779,12 +791,12 @@ query getForms {
|
|
|
779
791
|
}
|
|
780
792
|
}
|
|
781
793
|
`;
|
|
782
|
-
const getFormsByDocumentTypeStringQuery = (filters = {}) => `
|
|
783
|
-
query getFormsByDocumentType
|
|
794
|
+
const getFormsByDocumentTypeStringQuery = (document_type, filters = {}) => `
|
|
795
|
+
query getFormsByDocumentType {
|
|
784
796
|
settings_forms (
|
|
785
797
|
where: {
|
|
786
798
|
${filters?.formZid ? `zid: {_eq: ${filters?.formZid}},` : ""}
|
|
787
|
-
document_type: {_eq: $document_type}
|
|
799
|
+
document_type: {_eq: "${document_type}"}
|
|
788
800
|
},
|
|
789
801
|
order_by: {zid: desc, version: desc}
|
|
790
802
|
) {
|
|
@@ -821,8 +833,8 @@ query getFormsByDocumentType ($document_type: String) {
|
|
|
821
833
|
}
|
|
822
834
|
`;
|
|
823
835
|
exports.getFormsByDocumentTypeStringQuery = getFormsByDocumentTypeStringQuery;
|
|
824
|
-
const getMyCaseFormSubmissionsStringQuery = (filters = {}) => `
|
|
825
|
-
query getMyCaseFormSubmissions
|
|
836
|
+
const getMyCaseFormSubmissionsStringQuery = (responsible_id, filters = {}) => `
|
|
837
|
+
query getMyCaseFormSubmissions {
|
|
826
838
|
submission_cases (
|
|
827
839
|
limit: 500,
|
|
828
840
|
where: {
|
|
@@ -834,7 +846,7 @@ query getMyCaseFormSubmissions ($responsible_id: Int) {
|
|
|
834
846
|
},
|
|
835
847
|
case: {
|
|
836
848
|
${filters?.caseId ? `id: {_eq: ${filters?.caseId}},` : ""}
|
|
837
|
-
responsible_id: {_eq: $responsible_id}
|
|
849
|
+
responsible_id: {_eq: ${responsible_id}}
|
|
838
850
|
}
|
|
839
851
|
},
|
|
840
852
|
order_by: {id: desc})
|
|
@@ -893,9 +905,9 @@ query getMyCaseFormSubmissions ($responsible_id: Int) {
|
|
|
893
905
|
}
|
|
894
906
|
`;
|
|
895
907
|
exports.getMyCaseFormSubmissionsStringQuery = getMyCaseFormSubmissionsStringQuery;
|
|
896
|
-
|
|
897
|
-
query getFormSubmissionById
|
|
898
|
-
settings_form_submissions (where: {id: { _eq: $formId }}) {
|
|
908
|
+
const getFormSubmissionByIdStringQuery = (formId) => `
|
|
909
|
+
query getFormSubmissionById {
|
|
910
|
+
settings_form_submissions (where: {id: { _eq: ${formId} }}) {
|
|
899
911
|
id
|
|
900
912
|
zid
|
|
901
913
|
reference
|
|
@@ -927,11 +939,10 @@ query getFormSubmissionById ($formId: bigint) {
|
|
|
927
939
|
}
|
|
928
940
|
}
|
|
929
941
|
`;
|
|
930
|
-
|
|
942
|
+
exports.getFormSubmissionByIdStringQuery = getFormSubmissionByIdStringQuery;
|
|
943
|
+
const getInvoiceFormSubmissionsByAgencyIdStringQuery = (agency_id, filters) => {
|
|
931
944
|
return `
|
|
932
|
-
query getInvoiceFormSubmissionsByAgencyId
|
|
933
|
-
$agency_id: Int
|
|
934
|
-
) {
|
|
945
|
+
query getInvoiceFormSubmissionsByAgencyId {
|
|
935
946
|
submission_invoices(
|
|
936
947
|
where: {
|
|
937
948
|
settings_form_submission: {
|
|
@@ -949,7 +960,7 @@ query getInvoiceFormSubmissionsByAgencyId (
|
|
|
949
960
|
? `created_at: { _gte: "${filters?.startDate}T00:00:00", _lte: "${filters?.endDate}T00:00:00" },`
|
|
950
961
|
: ""}
|
|
951
962
|
invoice: {
|
|
952
|
-
agency_id: {_eq: $agency_id},
|
|
963
|
+
agency_id: {_eq: ${agency_id}},
|
|
953
964
|
${filters?.seller_id ? `seller_id: {_eq: ${filters?.seller_id} },` : ""}
|
|
954
965
|
${filters?.payee_id_number_search
|
|
955
966
|
? `payee: {
|
|
@@ -1043,11 +1054,11 @@ query getLastInvoiceFormSubmission {
|
|
|
1043
1054
|
}
|
|
1044
1055
|
`;
|
|
1045
1056
|
exports.getLastInvoiceFormSubmissionStringQuery = getLastInvoiceFormSubmissionStringQuery;
|
|
1046
|
-
const getInvoiceFormSubmissionsByInvoiceIdStringQuery = (filters = {}) => `
|
|
1047
|
-
query getInvoiceFormSubmissionsByInvoiceId
|
|
1057
|
+
const getInvoiceFormSubmissionsByInvoiceIdStringQuery = (invoice_id, filters = {}) => `
|
|
1058
|
+
query getInvoiceFormSubmissionsByInvoiceId {
|
|
1048
1059
|
submission_invoices(
|
|
1049
1060
|
where: {
|
|
1050
|
-
invoice_id: {_eq: $invoice_id},
|
|
1061
|
+
invoice_id: {_eq: ${invoice_id}},
|
|
1051
1062
|
settings_form_submission: {
|
|
1052
1063
|
${filters?.formZid
|
|
1053
1064
|
? `settings_form: {zid: {_eq: ${filters?.formZid}}},`
|
|
@@ -1207,9 +1218,9 @@ const getPaymentMethodsStringQuery = (config) => {
|
|
|
1207
1218
|
`;
|
|
1208
1219
|
};
|
|
1209
1220
|
exports.getPaymentMethodsStringQuery = getPaymentMethodsStringQuery;
|
|
1210
|
-
|
|
1211
|
-
query getPaymentTermById
|
|
1212
|
-
payment_terms (where: {id: {_eq: $id }}) {
|
|
1221
|
+
const getPaymentTermByIdStringQuery = (id) => `
|
|
1222
|
+
query getPaymentTermById {
|
|
1223
|
+
payment_terms (where: {id: {_eq: ${id} }}) {
|
|
1213
1224
|
active
|
|
1214
1225
|
id
|
|
1215
1226
|
memo
|
|
@@ -1222,9 +1233,10 @@ query getPaymentTermById ($id: Int) {
|
|
|
1222
1233
|
}
|
|
1223
1234
|
}
|
|
1224
1235
|
`;
|
|
1225
|
-
exports.
|
|
1226
|
-
|
|
1227
|
-
|
|
1236
|
+
exports.getPaymentTermByIdStringQuery = getPaymentTermByIdStringQuery;
|
|
1237
|
+
const getInvoicesByAgencyIdStringQuery = (id) => `
|
|
1238
|
+
query getInvoicesByAgencyId {
|
|
1239
|
+
invoices(limit: 1000, where: {agency_id: {_eq: ${id}}, voided: {_eq: false}}, order_by: {id: desc}) {
|
|
1228
1240
|
id
|
|
1229
1241
|
zid
|
|
1230
1242
|
id_number
|
|
@@ -1269,11 +1281,12 @@ query getInvoicesByAgencyId($id: Int) {
|
|
|
1269
1281
|
}
|
|
1270
1282
|
}
|
|
1271
1283
|
`;
|
|
1272
|
-
|
|
1284
|
+
exports.getInvoicesByAgencyIdStringQuery = getInvoicesByAgencyIdStringQuery;
|
|
1285
|
+
const getCasesByResponsibleIdStringQuery = (responsible_id, wheres = []) => {
|
|
1273
1286
|
const additionalWheres = wheres.join(",");
|
|
1274
1287
|
return `
|
|
1275
|
-
query getCasesByResponsibleId
|
|
1276
|
-
cases(where: {responsible_id: {_eq: $responsible_id}${additionalWheres.length > 0 ? "," : ""}${additionalWheres}}, order_by: {id: desc}) {
|
|
1288
|
+
query getCasesByResponsibleId {
|
|
1289
|
+
cases(where: {responsible_id: {_eq: ${responsible_id}}${additionalWheres.length > 0 ? "," : ""}${additionalWheres}}, order_by: {id: desc}) {
|
|
1277
1290
|
id
|
|
1278
1291
|
id_number
|
|
1279
1292
|
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,20 @@ 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}}}) {
|
|
369
366
|
data
|
|
370
367
|
}
|
|
371
368
|
}
|
|
372
369
|
`;
|
|
373
|
-
exports.
|
|
374
|
-
|
|
370
|
+
exports.getWebAppRowStringQuery = getWebAppRowStringQuery;
|
|
371
|
+
const getWebAppRowsByWebAppTableIdStringQuery = (webapp_table_id) => `
|
|
372
|
+
query getWebAppRowsByWebAppTableId {
|
|
375
373
|
webapp_rows (
|
|
376
374
|
where: {
|
|
377
375
|
webapp_table_id: {
|
|
378
|
-
_eq: $webapp_table_id
|
|
376
|
+
_eq: ${webapp_table_id}
|
|
379
377
|
}
|
|
380
378
|
},
|
|
381
379
|
order_by: {
|
|
@@ -388,9 +386,10 @@ query getWebAppRowsByWebAppTableId ($webapp_table_id: Int) {
|
|
|
388
386
|
}
|
|
389
387
|
}
|
|
390
388
|
`;
|
|
391
|
-
exports.
|
|
392
|
-
|
|
393
|
-
|
|
389
|
+
exports.getWebAppRowsByWebAppTableIdStringQuery = getWebAppRowsByWebAppTableIdStringQuery;
|
|
390
|
+
const getPayeeCategoryByIdStringQuery = (id) => `
|
|
391
|
+
query getPayeeCategoryById {
|
|
392
|
+
payee_categories (where: {id: {_eq: ${id} }}) {
|
|
394
393
|
payees (order_by: { id: desc }) {
|
|
395
394
|
id
|
|
396
395
|
name
|
|
@@ -405,6 +404,7 @@ query getPayeeCategoryById ($id: Int) {
|
|
|
405
404
|
}
|
|
406
405
|
}
|
|
407
406
|
`;
|
|
407
|
+
exports.getPayeeCategoryByIdStringQuery = getPayeeCategoryByIdStringQuery;
|
|
408
408
|
const getPayeeCategoriesByNotesMatchStringQuery = (match) => `
|
|
409
409
|
query getPayeeCategoriesByNotesMatch {
|
|
410
410
|
payee_categories(where: {notes: {_ilike: "%${match}%" }}) {
|
|
@@ -467,9 +467,9 @@ query getClientCategories {
|
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
469
|
`;
|
|
470
|
-
|
|
471
|
-
query getPayeeById
|
|
472
|
-
payees (where: {id: {_eq: $id }}) {
|
|
470
|
+
const getPayeeByIdStringQuery = (id) => `
|
|
471
|
+
query getPayeeById {
|
|
472
|
+
payees (where: {id: {_eq: ${id} }}) {
|
|
473
473
|
id
|
|
474
474
|
name
|
|
475
475
|
id_number
|
|
@@ -481,9 +481,10 @@ query getPayeeById ($id: Int) {
|
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
483
|
`;
|
|
484
|
-
exports.
|
|
485
|
-
|
|
486
|
-
|
|
484
|
+
exports.getPayeeByIdStringQuery = getPayeeByIdStringQuery;
|
|
485
|
+
const getSuperCategoryByIdStringQuery = (id) => `
|
|
486
|
+
query getSuperCategoryById {
|
|
487
|
+
item_super_categories (where: {id: {_eq: ${id} }}) {
|
|
487
488
|
item_categories {
|
|
488
489
|
id
|
|
489
490
|
name
|
|
@@ -493,9 +494,10 @@ query getSuperCategoryById ($id: bigint) {
|
|
|
493
494
|
}
|
|
494
495
|
}
|
|
495
496
|
`;
|
|
496
|
-
exports.
|
|
497
|
-
|
|
498
|
-
|
|
497
|
+
exports.getSuperCategoryByIdStringQuery = getSuperCategoryByIdStringQuery;
|
|
498
|
+
const getItemCategoryByIdStringQuery = (id) => `
|
|
499
|
+
query getItemCategoryById {
|
|
500
|
+
item_categories (where: {id: {_eq: ${id} }}) {
|
|
499
501
|
id
|
|
500
502
|
name
|
|
501
503
|
notes
|
|
@@ -503,9 +505,10 @@ query getItemCategoryById ($id: Int) {
|
|
|
503
505
|
}
|
|
504
506
|
}
|
|
505
507
|
`;
|
|
506
|
-
exports.
|
|
507
|
-
|
|
508
|
-
|
|
508
|
+
exports.getItemCategoryByIdStringQuery = getItemCategoryByIdStringQuery;
|
|
509
|
+
const getItemsByCategoryStringQuery = (id) => `
|
|
510
|
+
query getItemsByCategory {
|
|
511
|
+
item_categories (where: {id: {_eq: ${id} }}) {
|
|
509
512
|
items (where: {active: {_eq: true }}) {
|
|
510
513
|
id,
|
|
511
514
|
name,
|
|
@@ -516,6 +519,7 @@ query getItemsByCategory ($id: Int) {
|
|
|
516
519
|
}
|
|
517
520
|
}
|
|
518
521
|
`;
|
|
522
|
+
exports.getItemsByCategoryStringQuery = getItemsByCategoryStringQuery;
|
|
519
523
|
exports.getItemsStringQuery = `
|
|
520
524
|
query getItems {
|
|
521
525
|
items (where: {active: {_eq: true }}) {
|
|
@@ -525,9 +529,9 @@ query getItems {
|
|
|
525
529
|
}
|
|
526
530
|
}
|
|
527
531
|
`;
|
|
528
|
-
|
|
529
|
-
query getItemsBySuperCategory
|
|
530
|
-
item_super_categories (where: {id: {_eq: $id }}, order_by: {id: desc}) {
|
|
532
|
+
const getItemsBySuperCategoryStringQuery = (id, agency_id) => `
|
|
533
|
+
query getItemsBySuperCategory {
|
|
534
|
+
item_super_categories (where: {id: {_eq: ${id} }}, order_by: {id: desc}) {
|
|
531
535
|
item_categories {
|
|
532
536
|
items (where: {active: {_eq: true }}) {
|
|
533
537
|
id,
|
|
@@ -538,7 +542,7 @@ query getItemsBySuperCategory ($id: bigint, $agency_id: Int) {
|
|
|
538
542
|
measurement_unit,
|
|
539
543
|
description
|
|
540
544
|
product_type
|
|
541
|
-
stocks(where: {agency_id: {_eq: $agency_id}}, order_by: {id: desc}) {
|
|
545
|
+
stocks(where: {agency_id: {_eq: ${agency_id}}}, order_by: {id: desc}) {
|
|
542
546
|
available
|
|
543
547
|
id
|
|
544
548
|
incoming
|
|
@@ -549,9 +553,10 @@ query getItemsBySuperCategory ($id: bigint, $agency_id: Int) {
|
|
|
549
553
|
}
|
|
550
554
|
}
|
|
551
555
|
`;
|
|
552
|
-
exports.
|
|
553
|
-
|
|
554
|
-
|
|
556
|
+
exports.getItemsBySuperCategoryStringQuery = getItemsBySuperCategoryStringQuery;
|
|
557
|
+
const getConsolidatesBetweenDatesStringQuery = (startDate, endDate) => `
|
|
558
|
+
query getConsolidatesBetweenDates {
|
|
559
|
+
consolidates (order_by: {id: desc}, where: {created_at: {_gte: "${startDate}", _lte: "${endDate}"}}) {
|
|
555
560
|
id
|
|
556
561
|
id_number
|
|
557
562
|
created_at
|
|
@@ -563,9 +568,10 @@ query getConsolidatesBetweenDates ($startDate: timestamp, $endDate: timestamp) {
|
|
|
563
568
|
}
|
|
564
569
|
}
|
|
565
570
|
`;
|
|
566
|
-
exports.
|
|
567
|
-
|
|
568
|
-
|
|
571
|
+
exports.getConsolidatesBetweenDatesStringQuery = getConsolidatesBetweenDatesStringQuery;
|
|
572
|
+
const getEmployeeProfileStringQuery = (id) => `
|
|
573
|
+
query getEmployeeProfile {
|
|
574
|
+
employees(where: {id: {_eq: ${id}}}) {
|
|
569
575
|
agency_id
|
|
570
576
|
email
|
|
571
577
|
entity_id
|
|
@@ -581,9 +587,10 @@ query getEmployeeProfile ($id: Int) {
|
|
|
581
587
|
}
|
|
582
588
|
}
|
|
583
589
|
`;
|
|
584
|
-
exports.
|
|
585
|
-
|
|
586
|
-
|
|
590
|
+
exports.getEmployeeProfileStringQuery = getEmployeeProfileStringQuery;
|
|
591
|
+
const getEmployeesByAgencyIdStringQuery = (id) => `
|
|
592
|
+
query getEmployeesByAgencyId {
|
|
593
|
+
employees(where: {agency_id: {_eq: ${id}}}) {
|
|
587
594
|
name
|
|
588
595
|
id
|
|
589
596
|
user_id
|
|
@@ -597,9 +604,10 @@ query getEmployeesByAgencyId ($id: Int) {
|
|
|
597
604
|
}
|
|
598
605
|
}
|
|
599
606
|
`;
|
|
600
|
-
exports.
|
|
601
|
-
|
|
602
|
-
|
|
607
|
+
exports.getEmployeesByAgencyIdStringQuery = getEmployeesByAgencyIdStringQuery;
|
|
608
|
+
const getBundlesByItemCategoryIdStringQuery = (id) => `
|
|
609
|
+
query getBundlesByItemCategoryId {
|
|
610
|
+
bundles(where: {active: {_eq: true}, item_category_id: {_eq: ${id}}}) {
|
|
603
611
|
id
|
|
604
612
|
code
|
|
605
613
|
description
|
|
@@ -615,16 +623,18 @@ query getBundlesByItemCategoryId ($id: Int) {
|
|
|
615
623
|
}
|
|
616
624
|
}
|
|
617
625
|
`;
|
|
618
|
-
exports.
|
|
619
|
-
|
|
620
|
-
|
|
626
|
+
exports.getBundlesByItemCategoryIdStringQuery = getBundlesByItemCategoryIdStringQuery;
|
|
627
|
+
const getBundleByNameStringQuery = (name) => `
|
|
628
|
+
query getBundleByName {
|
|
629
|
+
bundles (where: {name: {_eq: "${name}" }}) {
|
|
621
630
|
id
|
|
622
631
|
}
|
|
623
632
|
}
|
|
624
633
|
`;
|
|
625
|
-
exports.
|
|
626
|
-
|
|
627
|
-
|
|
634
|
+
exports.getBundleByNameStringQuery = getBundleByNameStringQuery;
|
|
635
|
+
const getItemByNameStringQuery = (name) => `
|
|
636
|
+
query getItemByName {
|
|
637
|
+
items (where: {active: {_eq: true }, name: {_eq: "${name}" }}) {
|
|
628
638
|
id
|
|
629
639
|
name
|
|
630
640
|
stocks_only_integer
|
|
@@ -633,6 +643,7 @@ query getItemByName ($name: String) {
|
|
|
633
643
|
}
|
|
634
644
|
}
|
|
635
645
|
`;
|
|
646
|
+
exports.getItemByNameStringQuery = getItemByNameStringQuery;
|
|
636
647
|
const getShipmentsStringQuery = (wheres = []) => {
|
|
637
648
|
const additionalWheres = wheres.join(",");
|
|
638
649
|
return `query getShipments {
|
|
@@ -716,10 +727,10 @@ query getAllForms {
|
|
|
716
727
|
}
|
|
717
728
|
`;
|
|
718
729
|
exports.getAllFormsStringQuery = getAllFormsStringQuery;
|
|
719
|
-
|
|
720
|
-
query getFormByName
|
|
730
|
+
const getFormByNameStringQuery = (name) => `
|
|
731
|
+
query getFormByName {
|
|
721
732
|
settings_forms (
|
|
722
|
-
where: {name: {_eq: $name }},
|
|
733
|
+
where: {name: {_eq: "${name}" }},
|
|
723
734
|
order_by: {zid: desc, version: desc}
|
|
724
735
|
) {
|
|
725
736
|
id
|
|
@@ -748,6 +759,7 @@ query getFormByName ($name: String) {
|
|
|
748
759
|
}
|
|
749
760
|
}
|
|
750
761
|
`;
|
|
762
|
+
exports.getFormByNameStringQuery = getFormByNameStringQuery;
|
|
751
763
|
exports.getFormsStringQuery = `
|
|
752
764
|
query getForms {
|
|
753
765
|
settings_forms (
|
|
@@ -779,12 +791,12 @@ query getForms {
|
|
|
779
791
|
}
|
|
780
792
|
}
|
|
781
793
|
`;
|
|
782
|
-
const getFormsByDocumentTypeStringQuery = (filters = {}) => `
|
|
783
|
-
query getFormsByDocumentType
|
|
794
|
+
const getFormsByDocumentTypeStringQuery = (document_type, filters = {}) => `
|
|
795
|
+
query getFormsByDocumentType {
|
|
784
796
|
settings_forms (
|
|
785
797
|
where: {
|
|
786
798
|
${filters?.formZid ? `zid: {_eq: ${filters?.formZid}},` : ""}
|
|
787
|
-
document_type: {_eq: $document_type}
|
|
799
|
+
document_type: {_eq: "${document_type}"}
|
|
788
800
|
},
|
|
789
801
|
order_by: {zid: desc, version: desc}
|
|
790
802
|
) {
|
|
@@ -821,8 +833,8 @@ query getFormsByDocumentType ($document_type: String) {
|
|
|
821
833
|
}
|
|
822
834
|
`;
|
|
823
835
|
exports.getFormsByDocumentTypeStringQuery = getFormsByDocumentTypeStringQuery;
|
|
824
|
-
const getMyCaseFormSubmissionsStringQuery = (filters = {}) => `
|
|
825
|
-
query getMyCaseFormSubmissions
|
|
836
|
+
const getMyCaseFormSubmissionsStringQuery = (responsible_id, filters = {}) => `
|
|
837
|
+
query getMyCaseFormSubmissions {
|
|
826
838
|
submission_cases (
|
|
827
839
|
limit: 500,
|
|
828
840
|
where: {
|
|
@@ -834,7 +846,7 @@ query getMyCaseFormSubmissions ($responsible_id: Int) {
|
|
|
834
846
|
},
|
|
835
847
|
case: {
|
|
836
848
|
${filters?.caseId ? `id: {_eq: ${filters?.caseId}},` : ""}
|
|
837
|
-
responsible_id: {_eq: $responsible_id}
|
|
849
|
+
responsible_id: {_eq: ${responsible_id}}
|
|
838
850
|
}
|
|
839
851
|
},
|
|
840
852
|
order_by: {id: desc})
|
|
@@ -893,9 +905,9 @@ query getMyCaseFormSubmissions ($responsible_id: Int) {
|
|
|
893
905
|
}
|
|
894
906
|
`;
|
|
895
907
|
exports.getMyCaseFormSubmissionsStringQuery = getMyCaseFormSubmissionsStringQuery;
|
|
896
|
-
|
|
897
|
-
query getFormSubmissionById
|
|
898
|
-
settings_form_submissions (where: {id: { _eq: $formId }}) {
|
|
908
|
+
const getFormSubmissionByIdStringQuery = (formId) => `
|
|
909
|
+
query getFormSubmissionById {
|
|
910
|
+
settings_form_submissions (where: {id: { _eq: ${formId} }}) {
|
|
899
911
|
id
|
|
900
912
|
zid
|
|
901
913
|
reference
|
|
@@ -927,11 +939,10 @@ query getFormSubmissionById ($formId: bigint) {
|
|
|
927
939
|
}
|
|
928
940
|
}
|
|
929
941
|
`;
|
|
930
|
-
|
|
942
|
+
exports.getFormSubmissionByIdStringQuery = getFormSubmissionByIdStringQuery;
|
|
943
|
+
const getInvoiceFormSubmissionsByAgencyIdStringQuery = (agency_id, filters) => {
|
|
931
944
|
return `
|
|
932
|
-
query getInvoiceFormSubmissionsByAgencyId
|
|
933
|
-
$agency_id: Int
|
|
934
|
-
) {
|
|
945
|
+
query getInvoiceFormSubmissionsByAgencyId {
|
|
935
946
|
submission_invoices(
|
|
936
947
|
where: {
|
|
937
948
|
settings_form_submission: {
|
|
@@ -949,7 +960,7 @@ query getInvoiceFormSubmissionsByAgencyId (
|
|
|
949
960
|
? `created_at: { _gte: "${filters?.startDate}T00:00:00", _lte: "${filters?.endDate}T00:00:00" },`
|
|
950
961
|
: ""}
|
|
951
962
|
invoice: {
|
|
952
|
-
agency_id: {_eq: $agency_id},
|
|
963
|
+
agency_id: {_eq: ${agency_id}},
|
|
953
964
|
${filters?.seller_id ? `seller_id: {_eq: ${filters?.seller_id} },` : ""}
|
|
954
965
|
${filters?.payee_id_number_search
|
|
955
966
|
? `payee: {
|
|
@@ -1043,11 +1054,11 @@ query getLastInvoiceFormSubmission {
|
|
|
1043
1054
|
}
|
|
1044
1055
|
`;
|
|
1045
1056
|
exports.getLastInvoiceFormSubmissionStringQuery = getLastInvoiceFormSubmissionStringQuery;
|
|
1046
|
-
const getInvoiceFormSubmissionsByInvoiceIdStringQuery = (filters = {}) => `
|
|
1047
|
-
query getInvoiceFormSubmissionsByInvoiceId
|
|
1057
|
+
const getInvoiceFormSubmissionsByInvoiceIdStringQuery = (invoice_id, filters = {}) => `
|
|
1058
|
+
query getInvoiceFormSubmissionsByInvoiceId {
|
|
1048
1059
|
submission_invoices(
|
|
1049
1060
|
where: {
|
|
1050
|
-
invoice_id: {_eq: $invoice_id},
|
|
1061
|
+
invoice_id: {_eq: ${invoice_id}},
|
|
1051
1062
|
settings_form_submission: {
|
|
1052
1063
|
${filters?.formZid
|
|
1053
1064
|
? `settings_form: {zid: {_eq: ${filters?.formZid}}},`
|
|
@@ -1207,9 +1218,9 @@ const getPaymentMethodsStringQuery = (config) => {
|
|
|
1207
1218
|
`;
|
|
1208
1219
|
};
|
|
1209
1220
|
exports.getPaymentMethodsStringQuery = getPaymentMethodsStringQuery;
|
|
1210
|
-
|
|
1211
|
-
query getPaymentTermById
|
|
1212
|
-
payment_terms (where: {id: {_eq: $id }}) {
|
|
1221
|
+
const getPaymentTermByIdStringQuery = (id) => `
|
|
1222
|
+
query getPaymentTermById {
|
|
1223
|
+
payment_terms (where: {id: {_eq: ${id} }}) {
|
|
1213
1224
|
active
|
|
1214
1225
|
id
|
|
1215
1226
|
memo
|
|
@@ -1222,9 +1233,10 @@ query getPaymentTermById ($id: Int) {
|
|
|
1222
1233
|
}
|
|
1223
1234
|
}
|
|
1224
1235
|
`;
|
|
1225
|
-
exports.
|
|
1226
|
-
|
|
1227
|
-
|
|
1236
|
+
exports.getPaymentTermByIdStringQuery = getPaymentTermByIdStringQuery;
|
|
1237
|
+
const getInvoicesByAgencyIdStringQuery = (id) => `
|
|
1238
|
+
query getInvoicesByAgencyId {
|
|
1239
|
+
invoices(limit: 1000, where: {agency_id: {_eq: ${id}}, voided: {_eq: false}}, order_by: {id: desc}) {
|
|
1228
1240
|
id
|
|
1229
1241
|
zid
|
|
1230
1242
|
id_number
|
|
@@ -1269,11 +1281,12 @@ query getInvoicesByAgencyId($id: Int) {
|
|
|
1269
1281
|
}
|
|
1270
1282
|
}
|
|
1271
1283
|
`;
|
|
1272
|
-
|
|
1284
|
+
exports.getInvoicesByAgencyIdStringQuery = getInvoicesByAgencyIdStringQuery;
|
|
1285
|
+
const getCasesByResponsibleIdStringQuery = (responsible_id, wheres = []) => {
|
|
1273
1286
|
const additionalWheres = wheres.join(",");
|
|
1274
1287
|
return `
|
|
1275
|
-
query getCasesByResponsibleId
|
|
1276
|
-
cases(where: {responsible_id: {_eq: $responsible_id}${additionalWheres.length > 0 ? "," : ""}${additionalWheres}}, order_by: {id: desc}) {
|
|
1288
|
+
query getCasesByResponsibleId {
|
|
1289
|
+
cases(where: {responsible_id: {_eq: ${responsible_id}}${additionalWheres.length > 0 ? "," : ""}${additionalWheres}}, order_by: {id: desc}) {
|
|
1277
1290
|
id
|
|
1278
1291
|
id_number
|
|
1279
1292
|
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.94",
|
|
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": "9bb9ad806317e995dcb86262ed37ba73cd276c07"
|
|
26
26
|
}
|