@nomalism-com/types 1.3.39 → 1.3.40

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 (30) hide show
  1. package/dist/index.js +157 -58
  2. package/dist/main.d.ts +4 -1
  3. package/dist/modules/document/billOfLading/interfaces.d.ts +2 -0
  4. package/dist/modules/document/materialEntrance/interfaces.d.ts +1 -0
  5. package/dist/modules/document/order/interfaces.d.ts +5 -0
  6. package/dist/modules/document/order/route.schema.d.ts +1 -0
  7. package/dist/modules/sms/smsSender/interfaces.d.ts +42 -0
  8. package/dist/modules/sms/smsTemplate/interfaces.d.ts +29 -0
  9. package/dist/modules/sms/smsTemplate/route.schema.d.ts +5 -0
  10. package/dist/modules/stock/dashboard/interface.d.ts +20 -0
  11. package/dist/modules/stock/dashboard/route.schema.d.ts +1 -0
  12. package/dist/modules/supply/documentHeader/interfaces.d.ts +1 -0
  13. package/dist/modules/supply/documentHeaderSubscriber/interface.d.ts +1 -1
  14. package/dist/modules/supply/documentHeaderSurvey/interfaces.d.ts +36 -1
  15. package/dist/modules/supply/documentHeaderSurvey/route.schema.d.ts +2 -0
  16. package/dist/modules/supply/documentLine/interfaces.d.ts +2 -0
  17. package/dist/modules/ui/portal/interface.d.ts +5 -1
  18. package/dist/modules/ui/portal/route.schema.d.ts +1 -0
  19. package/dist/modules/user/chatSubscribers/interfaces.d.ts +10 -1
  20. package/dist/modules/user/chatSubscribers/route.schema.d.ts +1 -0
  21. package/dist/modules/user/storeOperator/interface.d.ts +4 -0
  22. package/dist/modules/user/storeOperator/route.schema.d.ts +1 -0
  23. package/dist/modules/user/timeSheet/interfaces.d.ts +32 -53
  24. package/dist/modules/user/timeSheet/route.schema.d.ts +3 -0
  25. package/dist/modules/view/webSocket/interfaces.d.ts +23 -0
  26. package/dist/shared/entities/sms.d.ts +31 -0
  27. package/dist/shared/entities/stock.d.ts +6 -1
  28. package/dist/shared/entities/user.d.ts +7 -18
  29. package/dist/shared/interface.d.ts +25 -2
  30. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -206,6 +206,9 @@ __export(main_exports, {
206
206
  SideMenuRoutes: () => route_schema_exports100,
207
207
  SidemenuHighlight: () => interface_exports56,
208
208
  SidemenuHighlightRoutes: () => route_schema_exports101,
209
+ SmsSender: () => interfaces_exports63,
210
+ SmsTemplate: () => interfaces_exports64,
211
+ SmsTemplateRoutes: () => route_schema_exports120,
209
212
  StartDocumentHeaderLastUpdate: () => interface_exports42,
210
213
  StockMovement: () => interface_exports36,
211
214
  StockMovementRoutes: () => route_schema_exports57,
@@ -470,7 +473,9 @@ var IBrokerTopic = /* @__PURE__ */ ((IBrokerTopic2) => {
470
473
  IBrokerTopic2["tickets_change"] = "tickets_change";
471
474
  IBrokerTopic2["push_notification"] = "push_notification";
472
475
  IBrokerTopic2["portal_subscriber_events"] = "portal_subscriber_events";
476
+ IBrokerTopic2["portal_document_events"] = "portal_document_events";
473
477
  IBrokerTopic2["sidemenu_highlight_changed"] = "sidemenu_highlight_changed";
478
+ IBrokerTopic2["proposta_sheets_import_status"] = "proposta_sheets_import_status";
474
479
  IBrokerTopic2["user_send_email_password"] = "user_send_email_password";
475
480
  IBrokerTopic2["grant_access"] = "grant_access";
476
481
  IBrokerTopic2["remove_access"] = "remove_access";
@@ -515,6 +520,7 @@ var IBrokerTopic = /* @__PURE__ */ ((IBrokerTopic2) => {
515
520
  IBrokerTopic2["googlesheet_stock_log"] = "googlesheet_stock_log";
516
521
  IBrokerTopic2["googlesheet_encomenda_log"] = "googlesheet_encomenda_log";
517
522
  IBrokerTopic2["log_google_api_request"] = "log_google_api_request";
523
+ IBrokerTopic2["sms_sender_select_lines"] = "sms_sender_select_lines";
518
524
  return IBrokerTopic2;
519
525
  })(IBrokerTopic || {});
520
526
 
@@ -1560,6 +1566,7 @@ var updateBodyKeys8 = {
1560
1566
  owner_id: joi10.string().uuid().optional(),
1561
1567
  owner_number: joi10.number().integer().positive().optional(),
1562
1568
  owner_name: joi10.string().optional(),
1569
+ owner_ref_document: joi10.string().allow(null, "").optional(),
1563
1570
  reason_for_exemption_id: joi10.string().uuid().allow(null).optional(),
1564
1571
  reason_for_exemption: joi10.string().allow(null).optional(),
1565
1572
  billing_persona_id: joi10.string().uuid().allow(null).optional(),
@@ -1702,9 +1709,11 @@ var deliveryAddress = {
1702
1709
  delivery_departure_street: joi10.string().required(),
1703
1710
  delivery_departure_locality: joi10.string().required(),
1704
1711
  delivery_departure_postal_code: joi10.string().required(),
1712
+ delivery_departure_country_id: joi10.string().uuid().required(),
1705
1713
  delivery_street: joi10.string().required(),
1706
1714
  delivery_locality: joi10.string().required(),
1707
- delivery_postal_code: joi10.string().required()
1715
+ delivery_postal_code: joi10.string().required(),
1716
+ delivery_country_id: joi10.string().uuid().required()
1708
1717
  };
1709
1718
  var createBillOfLadingBodyKeys = {
1710
1719
  persona_id: joi10.string().uuid().required(),
@@ -1951,6 +1960,7 @@ var updateManyKeys = {
1951
1960
  provider_estimated_delivery_date: joi10.date().allow(null, "").optional(),
1952
1961
  provider_purchase_discount: joi10.number().positive().allow(0).max(100).optional(),
1953
1962
  consignacao: joi10.boolean().optional(),
1963
+ abater_na_fatura_final: joi10.boolean().optional(),
1954
1964
  cancelled: joi10.boolean().optional(),
1955
1965
  force_closed: joi10.boolean().optional()
1956
1966
  };
@@ -2960,6 +2970,7 @@ var route_schema_exports44 = {};
2960
2970
  __export(route_schema_exports44, {
2961
2971
  createBody: () => createBody32,
2962
2972
  findWithPaginationQuery: () => findWithPaginationQuery18,
2973
+ updateOwnPinBody: () => updateOwnPinBody,
2963
2974
  updatePasswordBody: () => updatePasswordBody,
2964
2975
  updateStoreOperatorQuery: () => updateStoreOperatorQuery
2965
2976
  });
@@ -2992,6 +3003,10 @@ var updatePasswordBodyKeys = {
2992
3003
  oldPassword: joi10.string().required()
2993
3004
  };
2994
3005
  var updatePasswordBody = joi10.object().keys(updatePasswordBodyKeys).messages(messages);
3006
+ var updateOwnPinBodyKeys = {
3007
+ pin: joi10.string().required()
3008
+ };
3009
+ var updateOwnPinBody = joi10.object().keys(updateOwnPinBodyKeys).messages(messages);
2995
3010
 
2996
3011
  // src/modules/user/systemModule/interface.ts
2997
3012
  var interface_exports27 = {};
@@ -4269,6 +4284,7 @@ var Route85 = "order";
4269
4284
  var route_schema_exports80 = {};
4270
4285
  __export(route_schema_exports80, {
4271
4286
  conferirEncomendaClienteBody: () => conferirEncomendaClienteBody,
4287
+ createProviderOrderChatBody: () => createProviderOrderChatBody,
4272
4288
  findByIdsQuery: () => findByIdsQuery,
4273
4289
  findQuery: () => findQuery32,
4274
4290
  setProviderBody: () => setProviderBody,
@@ -4346,6 +4362,11 @@ var undoProviderOrderBodyKeys = {
4346
4362
  send_notification: joi10.boolean().required()
4347
4363
  };
4348
4364
  var undoProviderOrderBody = joi10.object().keys(undoProviderOrderBodyKeys).messages(messages);
4365
+ var createProviderOrderChatBodyKeys = {
4366
+ from_header: joi10.array().items(joi10.string().uuid().required()).required(),
4367
+ from_lines: joi10.array().items(joi10.string().uuid().required()).required()
4368
+ };
4369
+ var createProviderOrderChatBody = joi10.object().keys(createProviderOrderChatBodyKeys).messages(messages);
4349
4370
  var conferirEncomendaClienteBody = joi10.object().keys({
4350
4371
  option: joi10.string().valid(...estadoEncomendaValues).required(),
4351
4372
  document_line_ids: joi10.array().items(joi10.string().uuid().required()).required(),
@@ -4421,7 +4442,8 @@ __export(route_schema_exports81, {
4421
4442
  });
4422
4443
  var finalizarEntradaDeMaterialBodyKeys = {
4423
4444
  provider_id: joi10.string().uuid().required(),
4424
- saved_em_picking_ids: joi10.array().items(joi10.string().uuid().required()).optional()
4445
+ saved_em_picking_ids: joi10.array().items(joi10.string().uuid().required()).optional(),
4446
+ store_operator_id: joi10.string().uuid().required()
4425
4447
  };
4426
4448
  var finalizarEntradaDeMaterialBody = joi10.object().keys(finalizarEntradaDeMaterialBodyKeys).messages(messages);
4427
4449
  var undoEntradaDeMaterialBodyKeys = {
@@ -5117,13 +5139,19 @@ var Route105 = "dashboard";
5117
5139
  // src/modules/stock/dashboard/route.schema.ts
5118
5140
  var route_schema_exports98 = {};
5119
5141
  __export(route_schema_exports98, {
5120
- findByDateParams: () => findByDateParams
5142
+ findByDateParams: () => findByDateParams,
5143
+ findTodoCountsParams: () => findTodoCountsParams
5121
5144
  });
5122
5145
  var findByDateKeys = {
5123
5146
  date: joi10.date().required(),
5124
5147
  name: joi10.string().valid("dia", "mes", "ano").required()
5125
5148
  };
5126
5149
  var findByDateParams = joi10.object().keys(findByDateKeys).messages(messages);
5150
+ var findTodoCountsKeys = {
5151
+ from: joi10.date().required(),
5152
+ to: joi10.date().required()
5153
+ };
5154
+ var findTodoCountsParams = joi10.object().keys(findTodoCountsKeys).messages(messages);
5127
5155
 
5128
5156
  // src/modules/stock/chatRapidMessage/interface.ts
5129
5157
  var interface_exports54 = {};
@@ -5318,6 +5346,7 @@ var Route113 = "chat_subscriber";
5318
5346
  var route_schema_exports105 = {};
5319
5347
  __export(route_schema_exports105, {
5320
5348
  createOrUpdateBody: () => createOrUpdateBody2,
5349
+ emailTokenParam: () => emailTokenParam,
5321
5350
  findDocumentHeaderSubscribersByLanguageQuery: () => findDocumentHeaderSubscribersByLanguageQuery,
5322
5351
  findDocumentHeaderSubscribersQuery: () => findDocumentHeaderSubscribersQuery,
5323
5352
  findSubscribedDocumentHeadersQuery: () => findSubscribedDocumentHeadersQuery
@@ -5340,6 +5369,9 @@ var findSubscribedDocumentHeadersQueryKeys = {
5340
5369
  owner_id: joi10.string().uuid().required()
5341
5370
  };
5342
5371
  var findSubscribedDocumentHeadersQuery = joi10.object().keys(findSubscribedDocumentHeadersQueryKeys).messages(messages);
5372
+ var emailTokenParam = joi10.object().keys({
5373
+ token: joi10.string().pattern(/^[a-f0-9]{64}$/).required()
5374
+ }).messages(messages);
5343
5375
 
5344
5376
  // src/modules/stock/tag/interface.ts
5345
5377
  var interface_exports59 = {};
@@ -5540,8 +5572,14 @@ var IPublicDocumentHeaderNoteType = /* @__PURE__ */ ((IPublicDocumentHeaderNoteT
5540
5572
  var route_schema_exports111 = {};
5541
5573
  __export(route_schema_exports111, {
5542
5574
  createNoteBody: () => createNoteBody,
5575
+ publicFindBySubscriberQuery: () => publicFindBySubscriberQuery,
5543
5576
  updateNoteBody: () => updateNoteBody
5544
5577
  });
5578
+ var publicFindBySubscriberQueryKeys = {
5579
+ id: joi10.alternatives().try(joi10.string().uuid(), joi10.string().pattern(/^[a-f0-9]{64}$/)).required(),
5580
+ document_header_id: joi10.string().uuid().optional()
5581
+ };
5582
+ var publicFindBySubscriberQuery = joi10.object().keys(publicFindBySubscriberQueryKeys).messages(messages);
5545
5583
  var createNoteBodyKeys = {
5546
5584
  document_header_id: joi10.string().uuid().required(),
5547
5585
  note: joi10.string().required(),
@@ -5622,9 +5660,14 @@ var Route125 = "document_header_survey";
5622
5660
  // src/modules/supply/documentHeaderSurvey/route.schema.ts
5623
5661
  var route_schema_exports114 = {};
5624
5662
  __export(route_schema_exports114, {
5663
+ findQuery: () => findQuery34,
5625
5664
  updateSentBody: () => updateSentBody,
5626
5665
  updateSurveyBody: () => updateSurveyBody
5627
5666
  });
5667
+ var findQuery34 = joi10.object().keys({
5668
+ date_start: joi10.date().required(),
5669
+ date_end: joi10.date().required()
5670
+ }).messages(messages);
5628
5671
  var updateSentBodyKeys = {
5629
5672
  document_header_id: joi10.string().uuid().required(),
5630
5673
  persona_id: joi10.string().uuid().required()
@@ -5651,7 +5694,7 @@ __export(route_schema_exports115, {
5651
5694
  });
5652
5695
  var createBodyKeys63 = {
5653
5696
  document_header_id: joi10.string().uuid().required(),
5654
- store_operator_id: joi10.string().uuid().required()
5697
+ user_id: joi10.string().uuid().required()
5655
5698
  };
5656
5699
  var createBody64 = joi10.object().keys(createBodyKeys63).messages(messages);
5657
5700
 
@@ -5706,84 +5749,88 @@ var printLocationsQuery = joi10.object({
5706
5749
  // src/modules/user/timeSheet/interfaces.ts
5707
5750
  var interfaces_exports61 = {};
5708
5751
  __export(interfaces_exports61, {
5709
- IClockTypeEnum: () => IClockTypeEnum,
5710
- IRegistryTypeEnum: () => IRegistryTypeEnum,
5711
- ITimesheetStateEnum: () => ITimesheetStateEnum,
5752
+ ITimeSheetRecordTypeEnum: () => ITimeSheetRecordTypeEnum,
5753
+ ITimeSheetRegistryTypeEnum: () => ITimeSheetRegistryTypeEnum,
5712
5754
  Route: () => Route131,
5713
- clockTypes: () => clockTypes,
5714
- registryTypes: () => registryTypes,
5715
- timesheetStates: () => timesheetStates
5755
+ timeSheetRecordTypes: () => timeSheetRecordTypes,
5756
+ timeSheetRegistryTypes: () => timeSheetRegistryTypes
5716
5757
  });
5717
5758
  var Route131 = "time_sheet";
5718
- var IClockTypeEnum = {
5759
+ var ITimeSheetRecordTypeEnum = {
5719
5760
  ENTRY: "ENTRY",
5720
- EXIT: "EXIT"
5761
+ EXIT: "EXIT",
5762
+ CREDIT: "CREDIT",
5763
+ DEBIT: "DEBIT"
5721
5764
  };
5722
- var clockTypes = Object.keys(IClockTypeEnum);
5723
- var IRegistryTypeEnum = {
5765
+ var timeSheetRecordTypes = Object.values(ITimeSheetRecordTypeEnum);
5766
+ var ITimeSheetRegistryTypeEnum = {
5724
5767
  AUTOMATIC: "AUTOMATIC",
5725
5768
  MANUAL: "MANUAL"
5726
5769
  };
5727
- var registryTypes = Object.keys(IRegistryTypeEnum);
5728
- var ITimesheetStateEnum = {
5729
- CONFIRMED: "CONFIRMED",
5730
- PENDING: "PENDING",
5731
- ERROR: "ERROR"
5732
- };
5733
- var timesheetStates = Object.keys(ITimesheetStateEnum);
5770
+ var timeSheetRegistryTypes = Object.values(ITimeSheetRegistryTypeEnum);
5734
5771
 
5735
5772
  // src/modules/user/timeSheet/route.schema.ts
5736
5773
  var route_schema_exports118 = {};
5737
5774
  __export(route_schema_exports118, {
5738
5775
  createBody: () => createBody65,
5776
+ dailySummaryQuery: () => dailySummaryQuery,
5777
+ findByDateQuery: () => findByDateQuery,
5778
+ findQuery: () => findQuery35,
5739
5779
  updateBody: () => updateBody56
5740
5780
  });
5741
- var clockSchema = joi10.object({
5742
- id: joi10.string().uuid(),
5743
- time: joi10.date().required(),
5744
- type: joi10.string().valid(...Object.values(IClockTypeEnum)).required(),
5745
- registry_type: joi10.string().valid(...Object.values(IRegistryTypeEnum)).required(),
5746
- note: joi10.string().allow("", null).optional(),
5747
- created_by: joi10.string().uuid().required(),
5748
- // 👈 Adicionado para auditoria nos updates
5749
- updated_by: joi10.string().uuid().required()
5750
- // 👈 Adicionado para auditoria nos updates
5751
- });
5752
5781
  var createBodyKeys64 = {
5753
- date: joi10.date().required(),
5754
5782
  user_id: joi10.string().uuid().required(),
5755
- total_worked: joi10.number().integer().min(0),
5756
- balance: joi10.number().integer(),
5757
- state: joi10.string().valid(...Object.values(ITimesheetStateEnum)),
5783
+ type: joi10.string().valid("ENTRY", "EXIT", "CREDIT", "DEBIT").required(),
5784
+ time: joi10.when("type", {
5785
+ is: joi10.string().valid("ENTRY", "EXIT"),
5786
+ then: joi10.date().required(),
5787
+ otherwise: joi10.date().optional().allow(null)
5788
+ }),
5789
+ minutes: joi10.when("type", {
5790
+ is: joi10.string().valid("CREDIT", "DEBIT"),
5791
+ then: joi10.number().integer().min(1).required(),
5792
+ otherwise: joi10.number().optional().allow(null)
5793
+ }),
5794
+ registry_type: joi10.string().valid("AUTOMATIC", "MANUAL").default("MANUAL").optional(),
5795
+ note: joi10.string().allow("", null).optional(),
5758
5796
  created_by: joi10.string().uuid().required(),
5759
- // 👈 Adicionado na raiz do dia
5760
- updated_by: joi10.string().uuid().required(),
5761
- // 👈 Adicionado na raiz do dia
5762
- // Objeto opcional para quando se cria o dia já com a primeira picagem
5763
- clock: joi10.object({
5764
- time: joi10.date(),
5765
- type: joi10.string().valid(...Object.values(IClockTypeEnum)).required(),
5766
- registry_type: joi10.string().valid(...Object.values(IRegistryTypeEnum)).required(),
5767
- note: joi10.string().allow("", null).optional(),
5768
- created_by: joi10.string().uuid().required(),
5769
- // 👈 Adicionado no clock interno
5770
- updated_by: joi10.string().uuid().required()
5771
- // 👈 Adicionado no clock interno
5772
- })
5797
+ updated_by: joi10.string().uuid().required()
5773
5798
  };
5774
5799
  var createBody65 = joi10.object().keys(createBodyKeys64).messages(messages);
5775
5800
  var updateBodyKeys54 = {
5776
- total_worked: joi10.number().integer().min(0),
5777
- balance: joi10.number().integer(),
5778
- state: joi10.string().valid(...Object.values(ITimesheetStateEnum)),
5779
- created_by: joi10.string().uuid().optional(),
5780
- // 💡 Opcional no update para manter o original se quiseres
5801
+ type: joi10.string().valid("ENTRY", "EXIT", "CREDIT", "DEBIT").optional(),
5802
+ time: joi10.when("type", {
5803
+ is: joi10.string().valid("ENTRY", "EXIT"),
5804
+ then: joi10.date().optional(),
5805
+ otherwise: joi10.date().optional().allow(null)
5806
+ }),
5807
+ minutes: joi10.when("type", {
5808
+ is: joi10.string().valid("CREDIT", "DEBIT"),
5809
+ then: joi10.number().integer().min(1).optional(),
5810
+ otherwise: joi10.number().optional().allow(null)
5811
+ }),
5812
+ note: joi10.string().allow("", null).optional(),
5781
5813
  updated_by: joi10.string().uuid().required(),
5782
- // 👈 Obrigatório no update do dia
5783
- // Array de picagens enviado pelo formulário de edição
5784
- clocks: joi10.array().items(clockSchema)
5814
+ updated_at: joi10.date().optional()
5785
5815
  };
5786
5816
  var updateBody56 = joi10.object().keys(updateBodyKeys54).messages(messages);
5817
+ var findQueryKeys32 = {
5818
+ user_id: joi10.string().uuid().optional(),
5819
+ start_date: joi10.date().optional(),
5820
+ end_date: joi10.date().optional()
5821
+ };
5822
+ var findQuery35 = joi10.object().keys(findQueryKeys32).messages(messages);
5823
+ var findByDateQueryKeys = {
5824
+ user_id: joi10.string().uuid().required(),
5825
+ date: joi10.string().isoDate().required()
5826
+ };
5827
+ var findByDateQuery = joi10.object().keys(findByDateQueryKeys).messages(messages);
5828
+ var dailySummaryQueryKeys = {
5829
+ user_id: joi10.string().uuid().required(),
5830
+ start_date: joi10.string().isoDate().required(),
5831
+ end_date: joi10.string().isoDate().required()
5832
+ };
5833
+ var dailySummaryQuery = joi10.object().keys(dailySummaryQueryKeys).messages(messages);
5787
5834
 
5788
5835
  // src/modules/document/CAT/interfaces.ts
5789
5836
  var interfaces_exports62 = {};
@@ -5804,6 +5851,58 @@ var createBody66 = joi10.object().keys({
5804
5851
  document_line_ids: joi10.array().items(joi10.string().uuid().required()).required()
5805
5852
  }).messages(messages);
5806
5853
 
5854
+ // src/modules/sms/smsSender/interfaces.ts
5855
+ var interfaces_exports63 = {};
5856
+ __export(interfaces_exports63, {
5857
+ ISmsSenderStatsEnum: () => ISmsSenderStatsEnum,
5858
+ Route: () => Route133,
5859
+ timeSheetRecordTypes: () => timeSheetRecordTypes2
5860
+ });
5861
+ var Route133 = "sms_sender";
5862
+ var ISmsSenderStatsEnum = {
5863
+ PENDING: "PENDING",
5864
+ PROCESSING: "PROCESSING",
5865
+ SENT: "SENT",
5866
+ FAILED: "FAILED"
5867
+ };
5868
+ var timeSheetRecordTypes2 = Object.values(ISmsSenderStatsEnum);
5869
+
5870
+ // src/modules/sms/smsTemplate/interfaces.ts
5871
+ var interfaces_exports64 = {};
5872
+ __export(interfaces_exports64, {
5873
+ Route: () => Route134
5874
+ });
5875
+ var Route134 = "sms_template";
5876
+
5877
+ // src/modules/sms/smsTemplate/route.schema.ts
5878
+ var route_schema_exports120 = {};
5879
+ __export(route_schema_exports120, {
5880
+ createBody: () => createBody67,
5881
+ idParam: () => idParam2,
5882
+ keyParam: () => keyParam,
5883
+ updateBody: () => updateBody57
5884
+ });
5885
+ var createBodyKeys65 = {
5886
+ key: joi10.string().required(),
5887
+ name: joi10.string().required(),
5888
+ message: joi10.string().required(),
5889
+ variables: joi10.object().pattern(joi10.string(), joi10.alternatives().try(joi10.string(), joi10.number(), joi10.boolean())).optional()
5890
+ };
5891
+ var createBody67 = joi10.object().keys(createBodyKeys65).messages(messages);
5892
+ var updateBodyKeys55 = {
5893
+ name: joi10.string().optional(),
5894
+ message: joi10.string().optional(),
5895
+ key: joi10.string().optional(),
5896
+ variables: joi10.object().pattern(joi10.string(), joi10.alternatives().try(joi10.string(), joi10.number(), joi10.boolean())).optional()
5897
+ };
5898
+ var updateBody57 = joi10.object().keys(updateBodyKeys55).messages(messages);
5899
+ var idParam2 = joi10.object().keys({
5900
+ id: joi10.string().uuid().required()
5901
+ }).messages(messages);
5902
+ var keyParam = joi10.object().keys({
5903
+ key: joi10.string().required()
5904
+ }).messages(messages);
5905
+
5807
5906
  // src/index.ts
5808
5907
  var index_default = main_exports;
5809
5908
 
package/dist/main.d.ts CHANGED
@@ -255,4 +255,7 @@ import * as TimeSheet from './modules/user/timeSheet/interfaces';
255
255
  import * as TimeSheetRoutes from './modules/user/timeSheet/route.schema';
256
256
  import * as Catalogo from './modules/document/CAT/interfaces';
257
257
  import * as CatalogoRoutes from './modules/document/CAT/route.schema';
258
- export { shared, viewErrors, stockErrors, userErrors, documentManagementErrors, integrationErrors, ZipCode, ZipCodeRoutes, BankData, BankDataRoutes, Client, ClientRoutes, ClientType, ClientTypeRoutes, Chat, ChatRoutes, Commissioner, CommissionerRoutes, Country, CountryRoutes, DeliveryMethods, DeliveryMethodsRoutes, DocumentHeader, DocumentHeaderRoutes, DocumentHeaderHistory, BillOfLading, BillOfLadingRoutes, ProductionOrder, ProductionOrderRoutes, Proforma, ProformaRoutes, PropostaFornecedor, PropostaFornecedorRoutes, ProviderCreditNoteFromReturn, ProviderCreditNoteFromReturnRoutes, ProviderFinancialCreditNote, ProviderFinancialCreditNoteRoutes, ProviderServiceInvoice, ProviderServiceInvoiceRoutes, DocumentLine, DocumentLineRoutes, DocumentLineAssoc, DocumentSet, DocumentSetRoutes, DocumentType, DocumentTypeRoutes, ExternalDocumentType, ExternalDocumentHeader, ExternalDocumentHeaderRoutes, Favorites, FavoritesRoutes, File, FileRoutes, GoogleSheets, GoogleSheetsRoutes, Language, LanguageRoutes, Location, LocationRoutes, MaturityDates, MaturityDatesRoutes, Multimedia, MultimediaRoutes, OrderManagement, Observation, ObservationRoutes, ObservationType, ObservationTypeRoutes, Password, PasswordRoutes, Payment, PaymentRoutes, PaymentMethods, PaymentMethodsRoutes, ProductImage, ProductImageRoutes, Promotion, PromotionRoutes, PromotionAssoc, PromotionAssocRoutes, Providers, ProvidersRoutes, ProviderType, ProviderTypeRoutes, PurchaseConditions, PurchaseConditionsRoutes, ReasonForExemption, ReasonForExemptionRoutes, RefreshToken, RefreshTokenRoutes, SegmentsArea, SegmentsAreaRoutes, Sessions, SessionsRoutes, Shippings, ShippingsRoutes, StoreOperator, StoreOperatorRoutes, SystemModule, SystemModuleRoutes, Swift, SwiftRoutes, TypeOfLocation, TypeOfLocationRoutes, UnitOfMeasure, UnitOfMeasureRoutes, UserPositions, UserPositionsRoutes, Users, UsersRoutes, UserTokens, UserTokensRoutes, VatValidation, VatValidationRoutes, VatTax, VatTaxRoutes, VatTaxZone, VatTaxZoneRoutes, Vehicles, VehiclesRoutes, Workflow, WorkflowRoutes, StockMovement, StockMovementRoutes, Tenant, TenantRoutes, PreSale, PreSaleRoutes, PreSaleProduct, PreSaleProductRoutes, Npc, NpcRoutes, Printer, PrinterRoutes, SchedulePrintJob, SchedulePrintJobRoutes, QueryList, QueryListRoutes, QueryParameter, QueryParameterRoutes, ReturnReason, ReturnReasonRoutes, PropostaSheets, PropostaSheetsRoutes, Schedule, ScheduleRoutes, GoogleFilePermission, GoogleFilePermissionRoutes, Settings, SettingsRoutes, Tickets, TicketsRoutes, Channel, ChannelRoutes, TicketsLanguage, TicketsLanguageRoutes, CLT, CLTRoutes, StartDocumentHeaderLastUpdate, Persona, PersonaRoutes, ProjectInfo, ProjectInfoRoutes, EmailVerification, EmailVerificationRoutes, EmailLog, EmailLogRoutes, Purchase, PurchaseRoutes, Order, OrderRoutes, MaterialEntrance, MaterialEntranceRoutes, Transformado, TransformadoRoutes, Quebra, QuebraRoutes, UpfrontReturn, UpfrontReturnRoutes, SavedEmPicking, SavedEmPickingRoutes, EmailTemplate, EmailTemplateRoutes, EmailTemplateAttachment, EmailTemplateAttachmentRoutes, Inventario, InventarioRoutes, ReturnToProvider, ReturnToProviderRoutes, Prison, PrisonRoutes, DocumentLineNote, DocumentLineNoteRoutes, SavedProviderProposal, SavedProviderProposalRoutes, ProductGoogleSheets, ProductGoogleSheetsRoutes, Task, TaskRoutes, TaskMessage, TaskMessageRoutes, RecurrentTasks, TaskRead, TaskReadRoutes, Theme, ThemeRoutes, Dashboard, DashboardRoutes, ChatRapidMessage, ChatRapidMessageRoutes, SideMenu, SideMenuRoutes, SidemenuHighlight, SidemenuHighlightRoutes, AdminPanel, ErrorLog, ErrorLogRoutes, DocumentLineRm, DocumentLineRmRoutes, DocumentLineMt, DocumentLineMtRoutes, ChatSubscriber, ChatSubscriberRoutes, Tag, TagRoutes, Gmails, NPF, NPFRoutes, NRCL, NRCLRoutes, CurrentAccount, CurrentAccountRoutes, PaymentBatch, PaymentBatchRoutes, Portal, PortalRoutes, GoogleSheetPool, AccountCode, AccountCodeRoutes, LLM, LLMRoutes, PatchNotes, ConferirEncomenda, DocumentHeaderSurvey, DocumentHeaderSurveyRoutes, DocumentHeaderSubscriber, DocumentHeaderSubscriberRoutes, GoogleCalendar, GoogleCalendarRoutes, WebSocket, ProductLocation, MobilePrint, MobilePrintRoutes, TimeSheet, TimeSheetRoutes, Catalogo, CatalogoRoutes, };
258
+ import * as SmsSender from './modules/sms/smsSender/interfaces';
259
+ import * as SmsTemplate from './modules/sms/smsTemplate/interfaces';
260
+ import * as SmsTemplateRoutes from './modules/sms/smsTemplate/route.schema';
261
+ export { shared, viewErrors, stockErrors, userErrors, documentManagementErrors, integrationErrors, ZipCode, ZipCodeRoutes, BankData, BankDataRoutes, Client, ClientRoutes, ClientType, ClientTypeRoutes, Chat, ChatRoutes, Commissioner, CommissionerRoutes, Country, CountryRoutes, DeliveryMethods, DeliveryMethodsRoutes, DocumentHeader, DocumentHeaderRoutes, DocumentHeaderHistory, BillOfLading, BillOfLadingRoutes, ProductionOrder, ProductionOrderRoutes, Proforma, ProformaRoutes, PropostaFornecedor, PropostaFornecedorRoutes, ProviderCreditNoteFromReturn, ProviderCreditNoteFromReturnRoutes, ProviderFinancialCreditNote, ProviderFinancialCreditNoteRoutes, ProviderServiceInvoice, ProviderServiceInvoiceRoutes, DocumentLine, DocumentLineRoutes, DocumentLineAssoc, DocumentSet, DocumentSetRoutes, DocumentType, DocumentTypeRoutes, ExternalDocumentType, ExternalDocumentHeader, ExternalDocumentHeaderRoutes, Favorites, FavoritesRoutes, File, FileRoutes, GoogleSheets, GoogleSheetsRoutes, Language, LanguageRoutes, Location, LocationRoutes, MaturityDates, MaturityDatesRoutes, Multimedia, MultimediaRoutes, OrderManagement, Observation, ObservationRoutes, ObservationType, ObservationTypeRoutes, Password, PasswordRoutes, Payment, PaymentRoutes, PaymentMethods, PaymentMethodsRoutes, ProductImage, ProductImageRoutes, Promotion, PromotionRoutes, PromotionAssoc, PromotionAssocRoutes, Providers, ProvidersRoutes, ProviderType, ProviderTypeRoutes, PurchaseConditions, PurchaseConditionsRoutes, ReasonForExemption, ReasonForExemptionRoutes, RefreshToken, RefreshTokenRoutes, SegmentsArea, SegmentsAreaRoutes, Sessions, SessionsRoutes, Shippings, ShippingsRoutes, StoreOperator, StoreOperatorRoutes, SystemModule, SystemModuleRoutes, Swift, SwiftRoutes, TypeOfLocation, TypeOfLocationRoutes, UnitOfMeasure, UnitOfMeasureRoutes, UserPositions, UserPositionsRoutes, Users, UsersRoutes, UserTokens, UserTokensRoutes, VatValidation, VatValidationRoutes, VatTax, VatTaxRoutes, VatTaxZone, VatTaxZoneRoutes, Vehicles, VehiclesRoutes, Workflow, WorkflowRoutes, StockMovement, StockMovementRoutes, Tenant, TenantRoutes, PreSale, PreSaleRoutes, PreSaleProduct, PreSaleProductRoutes, Npc, NpcRoutes, Printer, PrinterRoutes, SchedulePrintJob, SchedulePrintJobRoutes, QueryList, QueryListRoutes, QueryParameter, QueryParameterRoutes, ReturnReason, ReturnReasonRoutes, PropostaSheets, PropostaSheetsRoutes, Schedule, ScheduleRoutes, GoogleFilePermission, GoogleFilePermissionRoutes, Settings, SettingsRoutes, Tickets, TicketsRoutes, Channel, ChannelRoutes, TicketsLanguage, TicketsLanguageRoutes, CLT, CLTRoutes, StartDocumentHeaderLastUpdate, Persona, PersonaRoutes, ProjectInfo, ProjectInfoRoutes, EmailVerification, EmailVerificationRoutes, EmailLog, EmailLogRoutes, Purchase, PurchaseRoutes, Order, OrderRoutes, MaterialEntrance, MaterialEntranceRoutes, Transformado, TransformadoRoutes, Quebra, QuebraRoutes, UpfrontReturn, UpfrontReturnRoutes, SavedEmPicking, SavedEmPickingRoutes, EmailTemplate, EmailTemplateRoutes, EmailTemplateAttachment, EmailTemplateAttachmentRoutes, Inventario, InventarioRoutes, ReturnToProvider, ReturnToProviderRoutes, Prison, PrisonRoutes, DocumentLineNote, DocumentLineNoteRoutes, SavedProviderProposal, SavedProviderProposalRoutes, ProductGoogleSheets, ProductGoogleSheetsRoutes, Task, TaskRoutes, TaskMessage, TaskMessageRoutes, RecurrentTasks, TaskRead, TaskReadRoutes, Theme, ThemeRoutes, Dashboard, DashboardRoutes, ChatRapidMessage, ChatRapidMessageRoutes, SideMenu, SideMenuRoutes, SidemenuHighlight, SidemenuHighlightRoutes, AdminPanel, ErrorLog, ErrorLogRoutes, DocumentLineRm, DocumentLineRmRoutes, DocumentLineMt, DocumentLineMtRoutes, ChatSubscriber, ChatSubscriberRoutes, Tag, TagRoutes, Gmails, NPF, NPFRoutes, NRCL, NRCLRoutes, CurrentAccount, CurrentAccountRoutes, PaymentBatch, PaymentBatchRoutes, Portal, PortalRoutes, GoogleSheetPool, AccountCode, AccountCodeRoutes, LLM, LLMRoutes, PatchNotes, ConferirEncomenda, DocumentHeaderSurvey, DocumentHeaderSurveyRoutes, DocumentHeaderSubscriber, DocumentHeaderSubscriberRoutes, GoogleCalendar, GoogleCalendarRoutes, WebSocket, ProductLocation, MobilePrint, MobilePrintRoutes, TimeSheet, TimeSheetRoutes, Catalogo, CatalogoRoutes, SmsSender, SmsTemplate, SmsTemplateRoutes, };
@@ -4,9 +4,11 @@ export interface IDeliveryAddressRequest {
4
4
  delivery_street: string;
5
5
  delivery_locality: string;
6
6
  delivery_postal_code: string;
7
+ delivery_country_id: string;
7
8
  delivery_departure_locality: string;
8
9
  delivery_departure_postal_code: string;
9
10
  delivery_departure_street: string;
11
+ delivery_departure_country_id: string;
10
12
  }
11
13
  export interface ICreateRequest {
12
14
  persona_id: string;
@@ -97,6 +97,7 @@ export interface IUndoEntradaDeMaterialRequest {
97
97
  export interface IFinalizarEntradaDeMaterialRequest {
98
98
  provider_id: string;
99
99
  saved_em_picking_ids?: string[];
100
+ store_operator_id: string;
100
101
  }
101
102
  export interface IFinalizarEntradaDeMaterialResponse {
102
103
  broker_messages: IShared.IBrokerMessage<IShared.IBrokerTopic>[];
@@ -5,6 +5,10 @@ export interface IUndoProviderOrderRequest {
5
5
  document_line_ids: string[];
6
6
  send_notification: boolean;
7
7
  }
8
+ export interface ICreateProviderOrderChatRequest {
9
+ from_header: string[];
10
+ from_lines: string[];
11
+ }
8
12
  export interface IMotivosDeEsperaData {
9
13
  esperaEnvioDeMedidas?: boolean;
10
14
  esperaConfirmacaoDeMedidas?: boolean;
@@ -77,6 +81,7 @@ export interface IRepository {
77
81
  unsetProvider(selector: IShared.IFindByIdRequest): Promise<void>;
78
82
  unlinkFromProviderOrder(selector: IFindByIdsRequest): Promise<void>;
79
83
  undoProviderOrder(data: IUndoProviderOrderRequest): Promise<void>;
84
+ createProviderOrderChat(data: ICreateProviderOrderChatRequest): Promise<void>;
80
85
  unsetCativado(data: IUnsetCativado): Promise<void>;
81
86
  find(params: IFindRequest): Promise<IFindResponse[]>;
82
87
  previewRegroupLinesInProviderOrder(params: IShared.IFindByIdRequest): Promise<IPreviewResponse>;
@@ -1,6 +1,7 @@
1
1
  import joi from 'joi';
2
2
  import { IConferirEncomendaClienteRequest, IFindRequest, IFindByIdsRequest } from './interfaces';
3
3
  export declare const undoProviderOrderBody: joi.ObjectSchema<any>;
4
+ export declare const createProviderOrderChatBody: joi.ObjectSchema<any>;
4
5
  export declare const conferirEncomendaClienteBody: joi.ObjectSchema<IConferirEncomendaClienteRequest>;
5
6
  export declare const setProviderBody: joi.ObjectSchema<any>;
6
7
  export declare const unsetCativadoBody: joi.ObjectSchema<any>;
@@ -0,0 +1,42 @@
1
+ import { SmsSender } from '../../../shared/entities/sms';
2
+ export type Entity = SmsSender;
3
+ export declare const Route = "sms_sender";
4
+ export declare const ISmsSenderStatsEnum: {
5
+ readonly PENDING: "PENDING";
6
+ readonly PROCESSING: "PROCESSING";
7
+ readonly SENT: "SENT";
8
+ readonly FAILED: "FAILED";
9
+ };
10
+ export type ISmsSenderStats = (typeof ISmsSenderStatsEnum)[keyof typeof ISmsSenderStatsEnum];
11
+ export declare const timeSheetRecordTypes: ("PENDING" | "PROCESSING" | "SENT" | "FAILED")[];
12
+ export interface ICreateRequest {
13
+ telephone: string;
14
+ message: string;
15
+ google_calendar_id: string;
16
+ }
17
+ export interface IClaimResponse {
18
+ id: string;
19
+ telephone: string;
20
+ message: string;
21
+ status: string;
22
+ }
23
+ export interface IResultRequest {
24
+ status: ISmsSenderStats;
25
+ error?: string;
26
+ }
27
+ export interface IFindResponse {
28
+ id: string;
29
+ telephone: string;
30
+ message: string;
31
+ status: string;
32
+ error?: string;
33
+ created_at: Date;
34
+ processed_at?: Date;
35
+ sent_at?: Date;
36
+ }
37
+ export interface IController {
38
+ claim(): Promise<IClaimResponse[]>;
39
+ result(id: string, data: IResultRequest): Promise<void>;
40
+ findById(id: string): Promise<IFindResponse>;
41
+ findAll(): Promise<IFindResponse[]>;
42
+ }
@@ -0,0 +1,29 @@
1
+ import { SmsTemplate } from '../../../shared/entities/sms';
2
+ import * as IShared from '../../../shared/interface';
3
+ export type Entity = SmsTemplate;
4
+ export declare const Route = "sms_template";
5
+ export interface IEntity extends Entity {
6
+ }
7
+ export type SmsTemplateVariables = Record<string, string | number | boolean>;
8
+ export interface ICreateRequest {
9
+ key: string;
10
+ name: string;
11
+ message: string;
12
+ variables?: SmsTemplateVariables;
13
+ }
14
+ export interface IUpdateRequest {
15
+ name?: string;
16
+ key?: string;
17
+ message?: string;
18
+ variables?: SmsTemplateVariables;
19
+ }
20
+ export interface IRepository {
21
+ find(): Promise<IEntity[]>;
22
+ findById(id: string): Promise<Entity>;
23
+ findByKey(key: string): Promise<Entity>;
24
+ create(data: ICreateRequest): Promise<string>;
25
+ update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<void>;
26
+ deleteOne(selector: IShared.IFindByIdRequest): Promise<void>;
27
+ }
28
+ export type IController = IShared.IEntityWithUserToken<IRepository>;
29
+ export type IApi = IRepository;
@@ -0,0 +1,5 @@
1
+ import joi from 'joi';
2
+ export declare const createBody: joi.ObjectSchema<any>;
3
+ export declare const updateBody: joi.ObjectSchema<any>;
4
+ export declare const idParam: joi.ObjectSchema<any>;
5
+ export declare const keyParam: joi.ObjectSchema<any>;
@@ -26,7 +26,27 @@ export interface IDashboardProjectInfoResponse {
26
26
  d: number;
27
27
  c: number;
28
28
  }
29
+ export interface IFindDashboardTodoCounts {
30
+ from: Date;
31
+ to: Date;
32
+ }
33
+ export interface IDashboardTodoCountOperator {
34
+ store_operator_id: string;
35
+ name: string;
36
+ }
37
+ export interface IDashboardTodoCountPoint {
38
+ /** ISO timestamp of the snapshot (captured_at) */
39
+ t: string;
40
+ store_operator_id: string;
41
+ name: string;
42
+ count: number;
43
+ }
44
+ export interface IDashboardTodoCountsResponse {
45
+ operators: IDashboardTodoCountOperator[];
46
+ points: IDashboardTodoCountPoint[];
47
+ }
29
48
  export interface IRepository {
30
49
  salesByDate(selector: IFindDashboardSalesByDate): Promise<IDashboardSalesResponse>;
31
50
  projectInfo(): Promise<IDashboardProjectInfoResponse[]>;
51
+ todoCounts(selector: IFindDashboardTodoCounts): Promise<IDashboardTodoCountsResponse>;
32
52
  }
@@ -1,2 +1,3 @@
1
1
  import joi from 'joi';
2
2
  export declare const findByDateParams: joi.ObjectSchema<any>;
3
+ export declare const findTodoCountsParams: joi.ObjectSchema<any>;
@@ -140,6 +140,7 @@ export interface IUpdateRequest {
140
140
  owner_id?: string;
141
141
  owner_number?: number;
142
142
  owner_name?: string;
143
+ owner_ref_document?: string | null;
143
144
  reason_for_exemption_id?: string | null;
144
145
  reason_for_exemption?: string | null;
145
146
  billing_persona_id?: string | null;
@@ -7,7 +7,7 @@ export interface IFindByOwnerRequest {
7
7
  }
8
8
  export interface ICreateRequest {
9
9
  document_header_id: string;
10
- store_operator_id: string;
10
+ user_id: string;
11
11
  }
12
12
  export interface IRepository {
13
13
  findByOwnerId(params: IFindByOwnerRequest): Promise<Entity[]>;
@@ -4,10 +4,45 @@ export type IEntity = DocumentHeaderSurvey;
4
4
  export declare const Route = "document_header_survey";
5
5
  export type ICreateRequest = Pick<IEntity, 'owner_id' | 'document_header_id' | 'persona_id'>;
6
6
  export type IResponse = IEntity;
7
+ export interface IFindRequest {
8
+ date_start: Date;
9
+ date_end: Date;
10
+ }
11
+ export interface IFindResponseItem {
12
+ document_header_id: string;
13
+ document_number: number;
14
+ rm_date: Date | null;
15
+ survey_id: string | null;
16
+ persona_name: string | null;
17
+ persona_email: string | null;
18
+ sent: Date | null;
19
+ responded_at: Date | null;
20
+ response_url: string | null;
21
+ }
22
+ export interface IMtWithoutDateCountResponse {
23
+ count: number;
24
+ }
7
25
  export type IUpdateSentRequest = Pick<IEntity, 'document_header_id' | 'persona_id'>;
8
26
  export type IUpdateSurveyRequest = Pick<IEntity, 'document_header_id' | 'persona_id' | 'data'>;
27
+ export interface ISurveyStatsSummary {
28
+ total: number;
29
+ sent: number;
30
+ pending: number;
31
+ responded: number;
32
+ response_rate: number;
33
+ }
34
+ export interface ISurveyStatsDailyPoint {
35
+ day: string;
36
+ created: number;
37
+ sent: number;
38
+ responded: number;
39
+ }
40
+ export interface ISurveyStatsResponse {
41
+ summary: ISurveyStatsSummary;
42
+ daily: ISurveyStatsDailyPoint[];
43
+ }
9
44
  export interface IRepository {
10
- find(): Promise<IResponse[]>;
45
+ find(params: IFindRequest): Promise<IFindResponseItem[]>;
11
46
  updateSent(data: IUpdateSentRequest): Promise<void>;
12
47
  updateSurvey(data: IUpdateSurveyRequest): Promise<void>;
13
48
  }
@@ -1,3 +1,5 @@
1
1
  import joi from 'joi';
2
+ import { IFindRequest } from './interfaces';
3
+ export declare const findQuery: joi.ObjectSchema<IFindRequest>;
2
4
  export declare const updateSentBody: joi.ObjectSchema<any>;
3
5
  export declare const updateSurveyBody: joi.ObjectSchema<any>;
@@ -112,6 +112,7 @@ export interface IUpdateManyRequest {
112
112
  provider_estimated_delivery_date?: Date | null;
113
113
  provider_purchase_discount?: number;
114
114
  consignacao?: boolean;
115
+ abater_na_fatura_final?: boolean;
115
116
  cancelled?: boolean;
116
117
  force_closed?: boolean;
117
118
  }
@@ -131,6 +132,7 @@ export interface IPrintLabelQueryRequest {
131
132
  token: string;
132
133
  }
133
134
  export interface IRepository {
135
+ getSmsData(): Promise<void>;
134
136
  create(data: ICreateRequest[]): Promise<IDocumentLineAssoc.IEntityExtended[]>;
135
137
  update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<void>;
136
138
  updateMany(data: IUpdateManyRequest): Promise<void>;
@@ -34,6 +34,10 @@ export interface IPublicFindBySubscriberId {
34
34
  chat: IChatBalloon[];
35
35
  documents: IPublicOtherDocument[];
36
36
  }
37
+ export interface IPublicFindBySubscriberIdRequest {
38
+ id: string;
39
+ document_header_id?: string;
40
+ }
37
41
  export declare enum IPublicDocumentHeaderNoteType {
38
42
  Provider = "Provider",
39
43
  Client = "Client"
@@ -56,7 +60,7 @@ export interface PublicDocumentHeaderNoteUpdateRequest {
56
60
  note: string;
57
61
  }
58
62
  export interface IRepository {
59
- publicFindBySubscriberId(params: IShared.IFindByIdRequest): Promise<IPublicFindBySubscriberId>;
63
+ publicFindBySubscriberId(params: IPublicFindBySubscriberIdRequest): Promise<IPublicFindBySubscriberId>;
60
64
  publicCreateDocumentHeaderNote: (data: PublicDocumentHeaderNoteCreateRequest[]) => Promise<PublicDocumentHeaderNote[]>;
61
65
  publicUpdateDocumentHeaderNote: (selector: IShared.IFindByIdRequest, data: PublicDocumentHeaderNoteUpdateRequest[]) => Promise<PublicDocumentHeaderNote[]>;
62
66
  }
@@ -1,3 +1,4 @@
1
1
  import joi from 'joi';
2
+ export declare const publicFindBySubscriberQuery: joi.ObjectSchema<any>;
2
3
  export declare const createNoteBody: joi.ObjectSchema<any>;
3
4
  export declare const updateNoteBody: joi.ObjectSchema<any>;
@@ -17,9 +17,16 @@ export interface IFindDocumentHeaderSubscribersByLanguageRequest {
17
17
  export interface IFindSubscribedDocumentHeadersRequest {
18
18
  owner_id: string;
19
19
  }
20
+ export interface IFindByEmailTokenRequest {
21
+ token: string;
22
+ }
23
+ export interface IPublicAuthenticateByEmailTokenRequest {
24
+ token: string;
25
+ }
20
26
  export type IPersona = Pick<Persona, 'id' | 'external' | 'name' | 'email' | 'telephone' | 'language_id'>;
27
+ export type IPersonaWithToken = IPersona & Pick<Persona, 'email_access_token'>;
21
28
  export interface IEntityWithPersona extends Pick<ChatSubscriber, 'id' | 'chat_document_header_id'> {
22
- persona: IPersona;
29
+ persona: IPersonaWithToken;
23
30
  }
24
31
  export interface IEntityWithPersonaAndSubscriptions extends IPersona {
25
32
  subscriptions: Pick<Entity, 'id' | 'chat_document_header_id'>[];
@@ -29,6 +36,8 @@ export interface IRepository {
29
36
  findDocumentHeaderSubscribersByLanguage(selector: IFindDocumentHeaderSubscribersByLanguageRequest): Promise<string[]>;
30
37
  findSubscribedDocumentHeaders(selector: IFindSubscribedDocumentHeadersRequest): Promise<IEntityWithPersonaAndSubscriptions>;
31
38
  findById(selector: IShared.IFindByIdRequest): Promise<IEntityWithPersonaAndSubscriptions>;
39
+ findByEmailToken(selector: IFindByEmailTokenRequest): Promise<IEntityWithPersonaAndSubscriptions>;
40
+ publicAuthenticateByEmailToken(selector: IPublicAuthenticateByEmailTokenRequest): Promise<string | null>;
32
41
  createOrUpdate(data: ICreateOrUpdateRequest): Promise<string>;
33
42
  deleteOne(selector: IShared.IFindByIdRequest): Promise<void>;
34
43
  deleteByDocumentHeader(selector: IShared.IFindByIdRequest): Promise<void>;
@@ -4,3 +4,4 @@ export declare const createOrUpdateBody: joi.ObjectSchema<any>;
4
4
  export declare const findDocumentHeaderSubscribersQuery: joi.ObjectSchema<any>;
5
5
  export declare const findDocumentHeaderSubscribersByLanguageQuery: joi.ObjectSchema<IFindDocumentHeaderSubscribersByLanguageRequest>;
6
6
  export declare const findSubscribedDocumentHeadersQuery: joi.ObjectSchema<any>;
7
+ export declare const emailTokenParam: joi.ObjectSchema<any>;
@@ -28,6 +28,9 @@ export interface IUpdatePasswordRequest {
28
28
  password: string;
29
29
  oldPassword: string;
30
30
  }
31
+ export interface IUpdateOwnPinRequest {
32
+ pin: string;
33
+ }
31
34
  export interface IRepository {
32
35
  findMinified(params?: IShared.IFindMinifiedRequest): Promise<IShared.IFindMinifiedResponse[]>;
33
36
  find(): Promise<IFindResponse[]>;
@@ -36,5 +39,6 @@ export interface IRepository {
36
39
  update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<void>;
37
40
  deleteOne(selector: IShared.IFindByIdRequest): Promise<void>;
38
41
  updatePassword(selector: IShared.IFindByIdRequest, data: IUpdatePasswordRequest): Promise<void>;
42
+ updateOwnPin(data: IUpdateOwnPinRequest): Promise<void>;
39
43
  }
40
44
  export type IController = IShared.IEntityWithUserToken<IRepository>;
@@ -3,3 +3,4 @@ export declare const createBody: joi.ObjectSchema<any>;
3
3
  export declare const updateStoreOperatorQuery: joi.ObjectSchema<any>;
4
4
  export declare const findWithPaginationQuery: joi.ObjectSchema<any>;
5
5
  export declare const updatePasswordBody: joi.ObjectSchema<any>;
6
+ export declare const updateOwnPinBody: joi.ObjectSchema<any>;
@@ -1,73 +1,52 @@
1
1
  import * as IShared from '../../../shared/interface';
2
- import { TimeSheetDay, TimeSheetClock } from '../../../shared/entities/user';
3
- export type Entity = TimeSheetDay & {
4
- clocks: TimeSheetClock[];
5
- };
2
+ import { TimeSheet } from '../../../shared/entities/user';
3
+ export type Entity = TimeSheet;
6
4
  export declare const Route = "time_sheet";
7
- export declare const IClockTypeEnum: {
8
- ENTRY: 'ENTRY';
9
- EXIT: 'EXIT';
10
- };
11
- export type IClockType = (typeof IClockTypeEnum)[keyof typeof IClockTypeEnum];
12
- export declare const clockTypes: string[];
13
- export declare const IRegistryTypeEnum: {
14
- AUTOMATIC: 'AUTOMATIC';
15
- MANUAL: 'MANUAL';
5
+ export declare const ITimeSheetRecordTypeEnum: {
6
+ readonly ENTRY: "ENTRY";
7
+ readonly EXIT: "EXIT";
8
+ readonly CREDIT: "CREDIT";
9
+ readonly DEBIT: "DEBIT";
16
10
  };
17
- export type IRegistryType = (typeof IRegistryTypeEnum)[keyof typeof IRegistryTypeEnum];
18
- export declare const registryTypes: string[];
19
- export declare const ITimesheetStateEnum: {
20
- CONFIRMED: 'CONFIRMED';
21
- PENDING: 'PENDING';
22
- ERROR: 'ERROR';
11
+ export type ITimeSheetRecordType = (typeof ITimeSheetRecordTypeEnum)[keyof typeof ITimeSheetRecordTypeEnum];
12
+ export declare const timeSheetRecordTypes: ("ENTRY" | "EXIT" | "CREDIT" | "DEBIT")[];
13
+ export declare const ITimeSheetRegistryTypeEnum: {
14
+ readonly AUTOMATIC: "AUTOMATIC";
15
+ readonly MANUAL: "MANUAL";
23
16
  };
24
- export type ITimesheetState = (typeof ITimesheetStateEnum)[keyof typeof ITimesheetStateEnum];
25
- export declare const timesheetStates: string[];
17
+ export type ITimeSheetRegistryType = (typeof ITimeSheetRegistryTypeEnum)[keyof typeof ITimeSheetRegistryTypeEnum];
18
+ export declare const timeSheetRegistryTypes: ("AUTOMATIC" | "MANUAL")[];
26
19
  export interface IFindRequest {
27
20
  user_id?: string;
28
21
  start_date?: string;
29
22
  end_date?: string;
30
- state?: ITimesheetState;
31
23
  }
32
- export interface ICreateRequest {
33
- date: Date;
24
+ export interface IFindByDateRequest {
34
25
  user_id: string;
35
- total_worked?: number;
36
- balance?: number;
37
- state?: ITimesheetState;
38
- created_by: string;
39
- updated_by: string;
40
- clock?: {
41
- time?: Date;
42
- type: IClockType;
43
- registry_type: IRegistryType;
44
- note?: string | null;
45
- created_by: string;
46
- updated_by: string;
47
- };
26
+ date: string;
48
27
  }
49
- export interface IUpdateRequest {
50
- total_worked?: number;
51
- balance?: number;
52
- state?: ITimesheetState;
53
- created_by?: string;
54
- updated_by: string;
55
- clocks?: {
56
- id?: string;
57
- time: Date;
58
- type: IClockType;
59
- registry_type: IRegistryType;
60
- note?: string | null;
61
- created_by: string;
62
- updated_by: string;
63
- }[];
28
+ export interface IDailySummaryRequest {
29
+ user_id: string;
30
+ start_date: string;
31
+ end_date: string;
32
+ }
33
+ export interface IDailySummaryResponse {
34
+ user_id: string;
35
+ date: string;
36
+ total_worked: number;
37
+ balance: number;
38
+ record_count: number;
64
39
  }
40
+ export type ICreateRequest = Omit<Entity, 'id' | 'created_at' | 'updated_at'>;
41
+ export type IUpdateRequest = Partial<Pick<Entity, 'type' | 'time' | 'minutes' | 'note' | 'updated_by' | 'updated_at'>>;
65
42
  export interface IRepository {
66
43
  find(filters?: IFindRequest): Promise<Entity[]>;
67
44
  findById(id: string): Promise<Entity | null>;
68
45
  create(data: ICreateRequest): Promise<Entity>;
69
46
  update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<Entity | null>;
70
- deleteOne(selector: IShared.IFindByIdRequest): Promise<Entity | null>;
47
+ deleteOne(selector: IShared.IFindByIdRequest): Promise<void>;
48
+ findByUserAndDate(filters: IFindByDateRequest): Promise<Entity[]>;
49
+ getDailySummary(filters: IDailySummaryRequest): Promise<IDailySummaryResponse[]>;
71
50
  }
72
51
  export type IController = IShared.IEntityWithUserToken<IRepository>;
73
52
  export type IApi = Omit<IRepository, 'findById'>;
@@ -1,3 +1,6 @@
1
1
  import joi from 'joi';
2
2
  export declare const createBody: joi.ObjectSchema<any>;
3
3
  export declare const updateBody: joi.ObjectSchema<any>;
4
+ export declare const findQuery: joi.ObjectSchema<any>;
5
+ export declare const findByDateQuery: joi.ObjectSchema<any>;
6
+ export declare const dailySummaryQuery: joi.ObjectSchema<any>;
@@ -1,6 +1,7 @@
1
1
  import type { IChatBalloon } from '../../stock/chat/interfaces';
2
2
  import type { ILastTicketCalledTodayByChannel, IRemainingTodayTickets } from '../../tickets/tickets/interfaces';
3
3
  import type { IPublicDocument, IPublicFindBySubscriberId, ITags } from '../../ui/portal/interface';
4
+ import type { IFindByOwnerIdItemWithVersions } from '../../supply/externalDocumentHeader/interface';
4
5
  export declare const Route = "ws";
5
6
  export interface IEvent {
6
7
  type: string;
@@ -65,6 +66,28 @@ export interface ITicketsChanged extends IEvent {
65
66
  remaining_today_tickets_to_call: IRemainingTodayTickets[];
66
67
  }
67
68
  export type TicketsSocketEvent = ITicketsChanged | IPing | IPong;
69
+ export interface IPropostaSheetsImportStatus extends IEvent {
70
+ type: 'proposta_sheets.import.status';
71
+ document_header_id: string;
72
+ google_sheet_id: string;
73
+ is_processing: boolean;
74
+ error: string | null;
75
+ }
76
+ export type PropostaSheetsSocketEvent = IPropostaSheetsImportStatus | IPing | IPong;
77
+ /**
78
+ * Emitted whenever an external/certified document tied to a dossier is
79
+ * created (post-create effects finished), retried, or voided. The payload
80
+ * carries the full `IFindByOwnerIdItemWithVersions` row so the client can
81
+ * upsert it straight into the `ExternalDocumentHeaderFindByOwnerId` cache
82
+ * keyed by `owner_id` (the dossier / start_document_header_id), matching on
83
+ * `item.document_header_id` to decide between insert and replace.
84
+ */
85
+ export interface IExternalDocumentUpserted extends IEvent {
86
+ type: 'external_document.upserted';
87
+ owner_id: string;
88
+ item: IFindByOwnerIdItemWithVersions;
89
+ }
90
+ export type SupplyDocumentSocketEvent = IExternalDocumentUpserted | IPing | IPong;
68
91
  export interface IPushNotificationEvent extends IEvent {
69
92
  type: 'push_notification';
70
93
  counts: Record<string, number>;
@@ -0,0 +1,31 @@
1
+ import { ISmsSenderStats } from '../../modules/sms/smsSender/interfaces';
2
+ /**
3
+ * Model SmsSender
4
+ *
5
+ */
6
+ export type SmsSender = {
7
+ id: string;
8
+ document_line_id: string | null;
9
+ telephone: string;
10
+ message: string;
11
+ status: ISmsSenderStats;
12
+ error: string | null;
13
+ created_at: Date;
14
+ processed_at: Date | null;
15
+ sent_at: Date | null;
16
+ };
17
+ /**
18
+ * Model SmsTemplate
19
+ *
20
+ */
21
+ export type SmsTemplate = {
22
+ id: string;
23
+ key: string;
24
+ name: string;
25
+ message: string;
26
+ variables: unknown;
27
+ created_at: Date;
28
+ updated_at: Date;
29
+ created_by: string;
30
+ updated_by: string;
31
+ };
@@ -40,6 +40,8 @@ export type Chat = {
40
40
  is_customer: boolean;
41
41
  deleted: boolean;
42
42
  lang: string | null;
43
+ lang_confidence: number | null;
44
+ lang_multi_dominant: boolean | null;
43
45
  created_by: string;
44
46
  updated_by: string;
45
47
  created_at: Date;
@@ -305,6 +307,8 @@ export type DocumentHeader = {
305
307
  delivery_departure_street: string | null;
306
308
  delivery_departure_locality: string | null;
307
309
  delivery_departure_postal_code: string | null;
310
+ delivery_departure_country_id: string | null;
311
+ delivery_departure_country_name: string | null;
308
312
  delivery_method_id: string | null;
309
313
  delivery_method: string | null;
310
314
  vehicle_id: string | null;
@@ -379,6 +383,7 @@ export type DocumentLine = {
379
383
  cativado: boolean;
380
384
  cativado_date: Date | null;
381
385
  consignacao: boolean;
386
+ abater_na_fatura_final: boolean;
382
387
  document_line_group_id: string;
383
388
  index: number;
384
389
  data: IData;
@@ -1087,7 +1092,7 @@ export type DocumentHeaderSurvey = {
1087
1092
  export type DocumentHeaderSubscriber = {
1088
1093
  id: string;
1089
1094
  document_header_id: string;
1090
- store_operator_id: string;
1095
+ user_id: string;
1091
1096
  created_at: Date;
1092
1097
  created_by: string;
1093
1098
  updated_at: Date;
@@ -1,7 +1,7 @@
1
1
  import { IPaymentMethodsSaftCodeEnum } from '../../modules/user/paymentMethods/interfaces';
2
2
  import type { IReasonForExemptionType } from '../../modules/user/reasonForExemption/interface';
3
3
  import type { SystemModuleEnum } from '../../modules/user/systemModule/interface';
4
- import { IClockType, IRegistryType, ITimesheetState } from '../../modules/user/timeSheet/interfaces';
4
+ import { ITimeSheetRecordType, ITimeSheetRegistryType } from '../../modules/user/timeSheet/interfaces';
5
5
  /**
6
6
  * Model Users
7
7
  *
@@ -424,6 +424,7 @@ export type Persona = {
424
424
  nif: string | null;
425
425
  telephone: string | null;
426
426
  email: string | null;
427
+ email_access_token: string | null;
427
428
  observations: string | null;
428
429
  street: string | null;
429
430
  postal_code: string | null;
@@ -481,26 +482,14 @@ export type SystemModule = {
481
482
  };
482
483
  /**
483
484
  * Model TimeSheet
484
- *
485
485
  */
486
- export interface TimeSheetDay {
486
+ export interface TimeSheet {
487
487
  id: string;
488
- date: Date;
489
- total_worked: number;
490
- balance: number;
491
488
  user_id: string;
492
- state: ITimesheetState;
493
- created_at: Date;
494
- updated_at: Date;
495
- created_by: string;
496
- updated_by: string;
497
- }
498
- export interface TimeSheetClock {
499
- id: string;
500
- timesheet_day_id: string;
501
- time: Date;
502
- type: IClockType;
503
- registry_type: IRegistryType;
489
+ type: ITimeSheetRecordType;
490
+ time: Date | null;
491
+ minutes: number | null;
492
+ registry_type: ITimeSheetRegistryType;
504
493
  note: string | null;
505
494
  created_at: Date;
506
495
  updated_at: Date;
@@ -11,7 +11,7 @@ import type { ProjectInfo } from './entities/integration';
11
11
  import type { IAttachment } from '../modules/supply/externalDocumentHeader/interface';
12
12
  import type { Persona } from './entities/user';
13
13
  import type { ITranslateRequest } from '../modules/stock/chat/interfaces';
14
- import type { ChatSocketEvent, TicketsSocketEvent } from '../modules/view/webSocket/interfaces';
14
+ import type { ChatSocketEvent, TicketsSocketEvent, SupplyDocumentSocketEvent } from '../modules/view/webSocket/interfaces';
15
15
  import type { SystemModuleEnum } from '../modules/user/systemModule/interface';
16
16
  export { messages };
17
17
  type CreatedAt = 'created_at';
@@ -135,11 +135,19 @@ export declare const IUserSendEmailDocumentTemplateEnum: {
135
135
  };
136
136
  export type IUserSendEmailDocumentTemplate = (typeof IUserSendEmailDocumentTemplateEnum)[keyof typeof IUserSendEmailDocumentTemplateEnum];
137
137
  export declare const IUserSendEmailDocumentTemplateTypes: string[];
138
+ export interface ISmsSenderSelectLinesData {
139
+ document_line_id: string;
140
+ document_header_id: string;
141
+ execution_date: string;
142
+ type: 'RM' | 'MT';
143
+ }
138
144
  export declare enum IBrokerTopic {
139
145
  tickets_change = "tickets_change",
140
146
  push_notification = "push_notification",
141
147
  portal_subscriber_events = "portal_subscriber_events",
148
+ portal_document_events = "portal_document_events",
142
149
  sidemenu_highlight_changed = "sidemenu_highlight_changed",
150
+ proposta_sheets_import_status = "proposta_sheets_import_status",
143
151
  user_send_email_password = "user_send_email_password",
144
152
  grant_access = "grant_access",
145
153
  remove_access = "remove_access",
@@ -183,7 +191,8 @@ export declare enum IBrokerTopic {
183
191
  googlesheet_task_log = "googlesheet_task_log",
184
192
  googlesheet_stock_log = "googlesheet_stock_log",
185
193
  googlesheet_encomenda_log = "googlesheet_encomenda_log",
186
- log_google_api_request = "log_google_api_request"
194
+ log_google_api_request = "log_google_api_request",
195
+ sms_sender_select_lines = "sms_sender_select_lines"
187
196
  }
188
197
  export type IBrokerTopicPayload = {
189
198
  [IBrokerTopic.google_sheet_import]: {
@@ -305,6 +314,12 @@ export type IBrokerTopicPayload = {
305
314
  values: string[];
306
315
  timestamp: string;
307
316
  };
317
+ [IBrokerTopic.proposta_sheets_import_status]: {
318
+ document_header_id: string;
319
+ google_sheet_id: string;
320
+ is_processing: boolean;
321
+ error: string | null;
322
+ };
308
323
  [IBrokerTopic.import_master_artigos]: {};
309
324
  [IBrokerTopic.kafka_log]: {
310
325
  id: string;
@@ -367,6 +382,7 @@ export type IBrokerTopicPayload = {
367
382
  };
368
383
  [IBrokerTopic.send_email_client_survey]: {
369
384
  persona_id: string;
385
+ owner_id: string;
370
386
  document_header_id: string;
371
387
  document_number: number;
372
388
  persona_name: string;
@@ -389,6 +405,13 @@ export type IBrokerTopicPayload = {
389
405
  target_subscriber_ids: string[];
390
406
  event: ChatSocketEvent;
391
407
  };
408
+ [IBrokerTopic.portal_document_events]: {
409
+ owner_id: string;
410
+ event: SupplyDocumentSocketEvent;
411
+ };
412
+ [IBrokerTopic.sms_sender_select_lines]: {
413
+ data: ISmsSenderSelectLinesData;
414
+ };
392
415
  };
393
416
  export interface IBrokerMessage<T extends IBrokerTopic = IBrokerTopic> {
394
417
  topic: T;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nomalism-com/types",
3
3
  "description": "A nomalism package with all necessary types and validations for developing APIs",
4
- "version": "1.3.39",
4
+ "version": "1.3.40",
5
5
  "author": "Nomalism <it.nomalism@gmail.com> (https://nomalism.com/)",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",
@@ -23,18 +23,18 @@
23
23
  "prepack": "npm run lint && npm run build"
24
24
  },
25
25
  "dependencies": {
26
- "joi": "^18.2.1"
26
+ "joi": "^18.2.3"
27
27
  },
28
28
  "devDependencies": {
29
- "@swc/core": "^1.15.41",
29
+ "@swc/core": "^1.15.43",
30
30
  "@types/node": "^24.13.2",
31
- "@typescript-eslint/eslint-plugin": "^8.61.0",
32
- "@typescript-eslint/parser": "^8.61.0",
31
+ "@typescript-eslint/eslint-plugin": "^8.62.0",
32
+ "@typescript-eslint/parser": "^8.62.0",
33
33
  "eslint": "^9.39.4",
34
34
  "eslint-config-prettier": "^10.1.8",
35
35
  "eslint-import-resolver-typescript": "^4.4.5",
36
36
  "eslint-plugin-prettier": "^5.5.6",
37
- "prettier": "^3.8.4",
37
+ "prettier": "^3.9.0",
38
38
  "tsup": "^8.5.1"
39
39
  },
40
40
  "repository": {