@zauru-sdk/services 1.0.6 → 1.0.7

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.
Files changed (65) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/index.d.ts +20 -0
  3. package/dist/index.js +20 -0
  4. package/dist/zauru/zauru-currencies.server.d.ts +6 -0
  5. package/dist/zauru/zauru-currencies.server.js +20 -0
  6. package/dist/zauru/zauru-deliveries.server.d.ts +22 -0
  7. package/dist/zauru/zauru-deliveries.server.js +44 -0
  8. package/dist/zauru/zauru-discharges.server.d.ts +26 -0
  9. package/dist/zauru/zauru-discharges.server.js +46 -0
  10. package/dist/zauru/zauru-employees.server.d.ts +6 -0
  11. package/dist/zauru/zauru-employees.server.js +23 -0
  12. package/dist/zauru/zauru-forms.server.d.ts +96 -0
  13. package/dist/zauru/zauru-forms.server.js +343 -0
  14. package/dist/zauru/zauru-invoices.server.d.ts +26 -0
  15. package/dist/zauru/zauru-invoices.server.js +94 -0
  16. package/dist/zauru/zauru-items.server.d.ts +91 -0
  17. package/dist/zauru/zauru-items.server.js +238 -0
  18. package/dist/zauru/zauru-lote-record.server.d.ts +8 -0
  19. package/dist/zauru/zauru-lote-record.server.js +26 -0
  20. package/dist/zauru/zauru-lotes.server.d.ts +91 -0
  21. package/dist/zauru/zauru-lotes.server.js +294 -0
  22. package/dist/zauru/zauru-motivos-rechazo.server.d.ts +9 -0
  23. package/dist/zauru/zauru-motivos-rechazo.server.js +49 -0
  24. package/dist/zauru/zauru-payees.server.d.ts +97 -0
  25. package/dist/zauru/zauru-payees.server.js +227 -0
  26. package/dist/zauru/zauru-payment-terms.server.d.ts +20 -0
  27. package/dist/zauru/zauru-payment-terms.server.js +65 -0
  28. package/dist/zauru/zauru-price-lists.server.d.ts +22 -0
  29. package/dist/zauru/zauru-price-lists.server.js +40 -0
  30. package/dist/zauru/zauru-purchase-orders.server.d.ts +160 -0
  31. package/dist/zauru/zauru-purchase-orders.server.js +414 -0
  32. package/dist/zauru/zauru-receptions.server.d.ts +33 -0
  33. package/dist/zauru/zauru-receptions.server.js +94 -0
  34. package/dist/zauru/zauru-shipments.server.d.ts +20 -0
  35. package/dist/zauru/zauru-shipments.server.js +53 -0
  36. package/dist/zauru/zauru-suggested-prices.server.d.ts +30 -0
  37. package/dist/zauru/zauru-suggested-prices.server.js +83 -0
  38. package/dist/zauru/zauru-tags.server.d.ts +7 -0
  39. package/dist/zauru/zauru-tags.server.js +13 -0
  40. package/dist/zauru/zauru-templates.server.d.ts +7 -0
  41. package/dist/zauru/zauru-templates.server.js +15 -0
  42. package/dist/zauru/zauru-web-app-tables.server.d.ts +48 -0
  43. package/dist/zauru/zauru-web-app-tables.server.js +120 -0
  44. package/package.json +6 -6
  45. package/src/index.ts +20 -0
  46. package/src/zauru/zauru-currencies.server.ts +39 -0
  47. package/src/zauru/zauru-deliveries.server.ts +70 -0
  48. package/src/zauru/zauru-discharges.server.ts +90 -0
  49. package/src/zauru/zauru-employees.server.ts +43 -0
  50. package/src/zauru/zauru-forms.server.ts +618 -0
  51. package/src/zauru/zauru-invoices.server.ts +142 -0
  52. package/src/zauru/zauru-items.server.ts +427 -0
  53. package/src/zauru/zauru-lote-record.server.ts +77 -0
  54. package/src/zauru/zauru-lotes.server.ts +484 -0
  55. package/src/zauru/zauru-motivos-rechazo.server.ts +121 -0
  56. package/src/zauru/zauru-payees.server.ts +398 -0
  57. package/src/zauru/zauru-payment-terms.server.ts +126 -0
  58. package/src/zauru/zauru-price-lists.server.ts +68 -0
  59. package/src/zauru/zauru-purchase-orders.server.ts +701 -0
  60. package/src/zauru/zauru-receptions.server.ts +148 -0
  61. package/src/zauru/zauru-shipments.server.ts +88 -0
  62. package/src/zauru/zauru-suggested-prices.server.ts +134 -0
  63. package/src/zauru/zauru-tags.server.ts +22 -0
  64. package/src/zauru/zauru-templates.server.ts +24 -0
  65. package/src/zauru/zauru-web-app-tables.server.ts +200 -0
@@ -0,0 +1,142 @@
1
+ import type { Session } from "@remix-run/node";
2
+ import { arrayToObject, handlePossibleAxiosErrors } from "@zauru-sdk/common";
3
+ import {
4
+ AxiosUtilsResponse,
5
+ InvoiceGraphQL,
6
+ SubmissionInvoicesGraphQL,
7
+ } from "@zauru-sdk/types";
8
+ import { getGraphQLAPIHeaders } from "~/common.server.js";
9
+ import httpGraphQLAPI from "./httpGraphQL.server.js";
10
+ import { getInvoicesByAgencyIdStringQuery } from "@zauru-sdk/graphql";
11
+ import httpZauru from "./httpZauru.server.js";
12
+ /**
13
+ * getInvoicesByAgencyId
14
+ */
15
+ export async function getInvoicesByAgencyId(
16
+ session: Session,
17
+ id: string | null
18
+ ): Promise<AxiosUtilsResponse<InvoiceGraphQL[]>> {
19
+ return handlePossibleAxiosErrors(async () => {
20
+ const headers = await getGraphQLAPIHeaders(session);
21
+
22
+ const response = await httpGraphQLAPI.post<{
23
+ data: { invoices: InvoiceGraphQL[] };
24
+ errors?: {
25
+ message: string;
26
+ extensions: { path: string; code: string };
27
+ }[];
28
+ }>(
29
+ "",
30
+ {
31
+ query: getInvoicesByAgencyIdStringQuery,
32
+ variables: {
33
+ id,
34
+ },
35
+ },
36
+ { headers }
37
+ );
38
+
39
+ if (response.data.errors) {
40
+ throw new Error(response.data.errors.map((x) => x.message).join(";"));
41
+ }
42
+
43
+ // Filtrar los registros para obtener sólo los de la versión más alta.
44
+ const registers = response?.data?.data?.invoices.map((x) => {
45
+ const groupedByVersion = x.submission_invoices?.reduce((acc, record) => {
46
+ const zid = record.settings_form_submission?.zid;
47
+
48
+ if (!acc[zid]) {
49
+ acc[zid] = record;
50
+ }
51
+
52
+ return acc;
53
+ }, {} as { [key: string]: SubmissionInvoicesGraphQL });
54
+
55
+ x.submission_invoices = Object.values(groupedByVersion)?.reverse() ?? [];
56
+
57
+ return x;
58
+ });
59
+
60
+ return registers;
61
+ });
62
+ }
63
+
64
+ /**
65
+ * createInvoiceOrder
66
+ * @param headers
67
+ * @param body
68
+ * @returns
69
+ */
70
+ export async function createInvoiceOrder(
71
+ headers: any,
72
+ body: Partial<InvoiceGraphQL>
73
+ ): Promise<AxiosUtilsResponse<InvoiceGraphQL>> {
74
+ return handlePossibleAxiosErrors(async () => {
75
+ const sendBody = {
76
+ ...body,
77
+ issued: false, // Esto lo hace una órden y no una factura
78
+ invoice_details_attributes: arrayToObject(body.invoice_details),
79
+ tag_ids: body.tagging_invoices?.map((x) => x.tag_id) ?? [],
80
+ } as any;
81
+
82
+ if (sendBody.deleted_invoice_details)
83
+ delete sendBody.deleted_invoice_details;
84
+ if (sendBody.__rvfInternalFormId) delete sendBody.__rvfInternalFormId;
85
+ if (sendBody.invoice_details) delete sendBody.invoice_details;
86
+
87
+ const response = await httpZauru.post<InvoiceGraphQL>(
88
+ `/sales/orders.json`,
89
+ { invoice: sendBody },
90
+ { headers }
91
+ );
92
+
93
+ return response.data;
94
+ });
95
+ }
96
+
97
+ /**
98
+ * updateInvoiceOrder
99
+ * @param headers
100
+ * @param body
101
+ * @returns
102
+ */
103
+ export async function updateInvoiceOrder(
104
+ headers: any,
105
+ body: Partial<InvoiceGraphQL>
106
+ ): Promise<AxiosUtilsResponse<InvoiceGraphQL>> {
107
+ return handlePossibleAxiosErrors(async () => {
108
+ const sendBody = {
109
+ ...body,
110
+ invoice_details_attributes: arrayToObject(body.invoice_details),
111
+ } as any;
112
+ if (sendBody.deleted_invoice_details)
113
+ delete sendBody.deleted_invoice_details;
114
+ if (sendBody.__rvfInternalFormId) delete sendBody.__rvfInternalFormId;
115
+ if (sendBody.invoice_details) delete sendBody.invoice_details;
116
+
117
+ const response = await httpZauru.patch<InvoiceGraphQL>(
118
+ `/sales/orders/${body.id}.json`,
119
+ { invoice: sendBody },
120
+ { headers }
121
+ );
122
+
123
+ return response.data;
124
+ });
125
+ }
126
+
127
+ /**
128
+ * deleteInvoice
129
+ * @param headers
130
+ * @param body
131
+ */
132
+ export async function deleteInvoiceOrder(
133
+ headers: any,
134
+ id: string | number
135
+ ): Promise<AxiosUtilsResponse<boolean>> {
136
+ return handlePossibleAxiosErrors(async () => {
137
+ await httpZauru.get<any>(`/sales/orders/${id}/void`, {
138
+ headers,
139
+ });
140
+ return true;
141
+ });
142
+ }
@@ -0,0 +1,427 @@
1
+ import type { Session } from "@remix-run/node";
2
+ import { handlePossibleAxiosErrors } from "@zauru-sdk/common";
3
+ import {
4
+ AxiosUtilsResponse,
5
+ ItemCategoryGraphQL,
6
+ ItemGraphQL,
7
+ ItemSuperCategoryGraphQL,
8
+ } from "@zauru-sdk/types";
9
+ import { getGraphQLAPIHeaders } from "~/common.server.js";
10
+ import httpGraphQLAPI from "./httpGraphQL.server.js";
11
+ import {
12
+ getItemByNameStringQuery,
13
+ getItemCategoryByIdStringQuery,
14
+ getItemsByCategoryStringQuery,
15
+ getItemsBySuperCategoryStringQuery,
16
+ getItemsStringQuery,
17
+ getSuperCategoryByIdStringQuery,
18
+ } from "@zauru-sdk/graphql";
19
+ import httpZauru from "./httpZauru.server.js";
20
+
21
+ /**
22
+ * getItems
23
+ */
24
+ export async function getItems(
25
+ session: Session
26
+ ): Promise<AxiosUtilsResponse<ItemGraphQL[]>> {
27
+ return handlePossibleAxiosErrors(async () => {
28
+ const headers = await getGraphQLAPIHeaders(session);
29
+
30
+ const response = await httpGraphQLAPI.post<{
31
+ data: { items: ItemGraphQL[] };
32
+ errors?: {
33
+ message: string;
34
+ extensions: { path: string; code: string };
35
+ }[];
36
+ }>(
37
+ "",
38
+ {
39
+ query: getItemsStringQuery,
40
+ },
41
+ { headers }
42
+ );
43
+
44
+ if (response.data.errors) {
45
+ throw new Error(response.data.errors.map((x) => x.message).join(";"));
46
+ }
47
+
48
+ const items = response?.data?.data?.items ?? [];
49
+
50
+ return items;
51
+ });
52
+ }
53
+
54
+ /**
55
+ * getItemByName
56
+ */
57
+ export async function getItemByName(
58
+ session: Session,
59
+ name: string
60
+ ): Promise<AxiosUtilsResponse<ItemGraphQL>> {
61
+ return handlePossibleAxiosErrors(async () => {
62
+ const headers = await getGraphQLAPIHeaders(session);
63
+
64
+ const response = await httpGraphQLAPI.post<{
65
+ data: { items: ItemGraphQL[] };
66
+ errors?: {
67
+ message: string;
68
+ extensions: { path: string; code: string };
69
+ }[];
70
+ }>(
71
+ "",
72
+ {
73
+ query: getItemByNameStringQuery,
74
+ variables: {
75
+ name,
76
+ },
77
+ },
78
+ { headers }
79
+ );
80
+
81
+ if (response.data.errors) {
82
+ throw new Error(response.data.errors.map((x) => x.message).join(";"));
83
+ }
84
+
85
+ if (!response?.data?.data?.items[0]) {
86
+ throw new Error(
87
+ `No se encontró ningún item con el nombre: ${name} asociado`
88
+ );
89
+ }
90
+
91
+ const register = response?.data?.data?.items[0];
92
+
93
+ return register;
94
+ });
95
+ }
96
+
97
+ //===================== ITEM CATEGORIES
98
+
99
+ /**
100
+ * getItemCategories
101
+ * @param headers
102
+ * @param agency_id
103
+ * @returns
104
+ */
105
+ export async function getItemCategories(
106
+ headers: any,
107
+ item_category_id: string
108
+ ): Promise<ItemCategoryGraphQL> {
109
+ const response = await httpZauru.get<ItemCategoryGraphQL>(
110
+ `/settings/items/item_categories/${item_category_id}.json`,
111
+ {
112
+ headers,
113
+ }
114
+ );
115
+
116
+ return response.data;
117
+ }
118
+
119
+ /**
120
+ * getItemsByCategoryId
121
+ */
122
+ export async function getItemsByCategoryId(
123
+ session: Session,
124
+ id: string
125
+ ): Promise<AxiosUtilsResponse<ItemGraphQL[]>> {
126
+ return handlePossibleAxiosErrors(async () => {
127
+ const headers = await getGraphQLAPIHeaders(session);
128
+
129
+ const response = await httpGraphQLAPI.post<{
130
+ data: { item_categories: ItemCategoryGraphQL[] };
131
+ errors?: {
132
+ message: string;
133
+ extensions: { path: string; code: string };
134
+ }[];
135
+ }>(
136
+ "",
137
+ {
138
+ query: getItemsByCategoryStringQuery,
139
+ variables: {
140
+ id,
141
+ },
142
+ },
143
+ { headers }
144
+ );
145
+
146
+ if (response.data.errors) {
147
+ throw new Error(response.data.errors.map((x) => x.message).join(";"));
148
+ }
149
+
150
+ if (!response?.data?.data?.item_categories[0]) {
151
+ throw new Error("No se encontró la categoría de item indicada");
152
+ }
153
+
154
+ const items = response?.data?.data?.item_categories[0]?.items ?? [];
155
+
156
+ return items;
157
+ });
158
+ }
159
+
160
+ /**
161
+ * getItemCategory
162
+ * @param session
163
+ * @param id
164
+ */
165
+ export async function getItemCategory(
166
+ session: Session,
167
+ id: number | string
168
+ ): Promise<AxiosUtilsResponse<ItemCategoryGraphQL | undefined>> {
169
+ return handlePossibleAxiosErrors(async () => {
170
+ const headers = await getGraphQLAPIHeaders(session);
171
+
172
+ const response = await httpGraphQLAPI.post<{
173
+ data: { item_categories: ItemCategoryGraphQL[] };
174
+ errors?: {
175
+ message: string;
176
+ extensions: { path: string; code: string };
177
+ }[];
178
+ }>(
179
+ "",
180
+ {
181
+ query: getItemCategoryByIdStringQuery,
182
+ variables: {
183
+ id,
184
+ },
185
+ },
186
+ { headers }
187
+ );
188
+
189
+ if (response.data.errors) {
190
+ throw new Error(response.data.errors.map((x) => x.message).join(";"));
191
+ }
192
+
193
+ if (!response?.data?.data?.item_categories[0]) {
194
+ throw new Error("No se encontró la categoría de item indicada");
195
+ }
196
+
197
+ return response?.data?.data?.item_categories[0];
198
+ });
199
+ }
200
+
201
+ /**
202
+ * getItemCategoriesBySuperCategoryId
203
+ * @param session
204
+ * @param categoryId
205
+ * @returns
206
+ */
207
+ export async function getItemCategoriesBySuperCategoryId(
208
+ session: Session,
209
+ id: number | string
210
+ ): Promise<AxiosUtilsResponse<ItemCategoryGraphQL[]>> {
211
+ return handlePossibleAxiosErrors(async () => {
212
+ const headers = await getGraphQLAPIHeaders(session);
213
+ const response = await httpGraphQLAPI.post<{
214
+ data: {
215
+ item_super_categories: ItemSuperCategoryGraphQL[];
216
+ };
217
+ errors?: {
218
+ message: string;
219
+ extensions: { path: string; code: string };
220
+ }[];
221
+ }>(
222
+ ``,
223
+ {
224
+ query: getSuperCategoryByIdStringQuery,
225
+ variables: { id },
226
+ },
227
+ { headers }
228
+ );
229
+
230
+ if (response.data.errors) {
231
+ throw new Error(response.data.errors.map((x) => x.message).join(";"));
232
+ }
233
+
234
+ if (!response?.data?.data.item_super_categories[0].item_categories) {
235
+ return [];
236
+ }
237
+
238
+ return response.data?.data.item_super_categories[0]?.item_categories;
239
+ });
240
+ }
241
+
242
+ /**
243
+ * getItemsBySuperCategoryId
244
+ * @param session
245
+ * @param categoryId
246
+ * @returns
247
+ */
248
+ export async function getItemsBySuperCategoryId(
249
+ session: Session,
250
+ id: number | string,
251
+ agency_id: number | string
252
+ ): Promise<AxiosUtilsResponse<ItemGraphQL[]>> {
253
+ return handlePossibleAxiosErrors(async () => {
254
+ const headers = await getGraphQLAPIHeaders(session);
255
+ const response = await httpGraphQLAPI.post<{
256
+ data: {
257
+ item_super_categories: ItemSuperCategoryGraphQL[];
258
+ };
259
+ errors?: {
260
+ message: string;
261
+ extensions: { path: string; code: string };
262
+ }[];
263
+ }>(
264
+ ``,
265
+ {
266
+ query: getItemsBySuperCategoryStringQuery,
267
+ variables: { id, agency_id },
268
+ },
269
+ { headers }
270
+ );
271
+
272
+ if (response.data.errors) {
273
+ throw new Error(response.data.errors.map((x) => x.message).join(";"));
274
+ }
275
+
276
+ if (!response?.data?.data.item_super_categories[0].item_categories) {
277
+ return [];
278
+ }
279
+
280
+ const items: ItemGraphQL[] = [];
281
+
282
+ response.data?.data.item_super_categories[0]?.item_categories.forEach((x) =>
283
+ items.push(...x.items)
284
+ );
285
+
286
+ return items;
287
+ });
288
+ }
289
+
290
+ /**
291
+ * createItemSuperCategory
292
+ * @param session
293
+ * @param headers
294
+ * @returns
295
+ */
296
+ export async function createItemSuperCategory(
297
+ headers: any,
298
+ body: Partial<ItemSuperCategoryGraphQL>
299
+ ): Promise<AxiosUtilsResponse<ItemSuperCategoryGraphQL>> {
300
+ return handlePossibleAxiosErrors(async () => {
301
+ const response = await httpZauru.post<ItemSuperCategoryGraphQL>(
302
+ "/settings/items/item_super_categories.json",
303
+ { item_super_category: body },
304
+ { headers }
305
+ );
306
+ return response.data;
307
+ });
308
+ }
309
+
310
+ /**
311
+ * createItemCategory
312
+ * @param session
313
+ * @param headers
314
+ * @returns
315
+ */
316
+ export async function createItemCategory(
317
+ headers: any,
318
+ body: Partial<ItemCategoryGraphQL>
319
+ ): Promise<AxiosUtilsResponse<ItemCategoryGraphQL>> {
320
+ return handlePossibleAxiosErrors(async () => {
321
+ const itemCategoryResponse = await httpZauru.post<ItemCategoryGraphQL>(
322
+ "/settings/items/item_categories",
323
+ { item_category: body },
324
+ { headers }
325
+ );
326
+ return itemCategoryResponse.data;
327
+ });
328
+ }
329
+
330
+ /**
331
+ * deleteItemCategory
332
+ * @param headers
333
+ * @param id
334
+ * @returns
335
+ */
336
+ export async function deleteItemCategory(
337
+ headers: any,
338
+ id: string | number
339
+ ): Promise<AxiosUtilsResponse<boolean>> {
340
+ return handlePossibleAxiosErrors(async () => {
341
+ await httpZauru.delete<any>(
342
+ `/settings/items/item_categories/${id}?destroy=true`,
343
+ {
344
+ headers,
345
+ }
346
+ );
347
+ return true;
348
+ });
349
+ }
350
+
351
+ /**
352
+ * updatePayee
353
+ * @param session
354
+ * @param headers
355
+ * @returns
356
+ */
357
+ export async function updateItemCategory(
358
+ headers: any,
359
+ body: Partial<ItemCategoryGraphQL>
360
+ ): Promise<AxiosUtilsResponse<boolean>> {
361
+ return handlePossibleAxiosErrors(async () => {
362
+ await httpZauru.patch<any>(
363
+ `/settings/items/item_categories/${body.id}`,
364
+ { item_category: body },
365
+ { headers }
366
+ );
367
+ return true;
368
+ });
369
+ }
370
+
371
+ /**
372
+ * createItem
373
+ * @param headers
374
+ * @param body
375
+ * @returns
376
+ */
377
+ export async function createItem(
378
+ headers: any,
379
+ body: Partial<ItemGraphQL>
380
+ ): Promise<AxiosUtilsResponse<ItemGraphQL>> {
381
+ return handlePossibleAxiosErrors(async () => {
382
+ const response = await httpZauru.post<ItemGraphQL>(
383
+ `/settings/items.json`,
384
+ { item: body },
385
+ { headers }
386
+ );
387
+ return response.data;
388
+ });
389
+ }
390
+
391
+ /**
392
+ * updateItem
393
+ * @param headers
394
+ * @param body
395
+ * @param id
396
+ * @returns
397
+ */
398
+ export async function updateItem(headers: any, body: Partial<ItemGraphQL>) {
399
+ return handlePossibleAxiosErrors(async () => {
400
+ await httpZauru.patch<Partial<ItemGraphQL>>(
401
+ `/settings/items/${body.id}.json`,
402
+ body,
403
+ {
404
+ headers,
405
+ }
406
+ );
407
+ return true;
408
+ });
409
+ }
410
+
411
+ /**
412
+ * deleteItemCategory
413
+ * @param headers
414
+ * @param id
415
+ * @returns
416
+ */
417
+ export async function deleteItem(
418
+ headers: any,
419
+ id: string | number
420
+ ): Promise<AxiosUtilsResponse<boolean>> {
421
+ return handlePossibleAxiosErrors(async () => {
422
+ await httpZauru.delete<any>(`/settings/items/${id}?destroy=true`, {
423
+ headers,
424
+ });
425
+ return true;
426
+ });
427
+ }
@@ -0,0 +1,77 @@
1
+ import type { Session } from "@remix-run/node";
2
+ import { LoteRecordBody, WebAppRowGraphQL } from "@zauru-sdk/types";
3
+ import { getVariablesByName } from "~/common.server.js";
4
+ import {
5
+ createWebAppTableRegister,
6
+ deleteWebAppTableRegister,
7
+ getWebAppTableRegisters,
8
+ } from "./zauru-web-app-tables.server.js";
9
+
10
+ export async function getLoteRecord(
11
+ headers: any,
12
+ session: Session
13
+ ): Promise<WebAppRowGraphQL<LoteRecordBody>[]> {
14
+ const { lote_record_webapp_table_id: webapp_table_id } =
15
+ await getVariablesByName(headers, session, ["lote_record_webapp_table_id"]);
16
+
17
+ const response = await getWebAppTableRegisters<LoteRecordBody>(
18
+ session,
19
+ webapp_table_id
20
+ );
21
+
22
+ if (response.error) {
23
+ throw new Error(`Error al obtener el lote: ${response.userMsg}`);
24
+ }
25
+
26
+ const lotes = response.data ?? [];
27
+
28
+ return lotes;
29
+ }
30
+
31
+ export async function deleteLoteRecord(
32
+ headers: any,
33
+ session: Session,
34
+ id: number
35
+ ): Promise<any> {
36
+ const { lote_record_webapp_table_id: webapp_table_id } =
37
+ await getVariablesByName(headers, session, ["lote_record_webapp_table_id"]);
38
+
39
+ const response = await deleteWebAppTableRegister(
40
+ headers,
41
+ webapp_table_id,
42
+ id
43
+ );
44
+ return response.data;
45
+ }
46
+
47
+ export async function createLoteRecord(
48
+ headers: any,
49
+ session: Session,
50
+ body: LoteRecordBody
51
+ ) {
52
+ const { lote_record_webapp_table_id: webapp_table_id } =
53
+ await getVariablesByName(headers, session, ["lote_record_webapp_table_id"]);
54
+
55
+ const response = await createWebAppTableRegister<LoteRecordBody>(
56
+ headers,
57
+ webapp_table_id,
58
+ body
59
+ );
60
+ return response.data;
61
+ }
62
+
63
+ export async function updateLoteRecord(
64
+ headers: any,
65
+ session: Session,
66
+ id: number
67
+ ): Promise<any> {
68
+ const { lote_record_webapp_table_id: webapp_table_id } =
69
+ await getVariablesByName(headers, session, ["lote_record_webapp_table_id"]);
70
+
71
+ const response = await deleteWebAppTableRegister(
72
+ headers,
73
+ webapp_table_id,
74
+ id
75
+ );
76
+ return response.data;
77
+ }