Compare commits
No commits in common. "dev" and "7752-fixSelect" have entirely different histories.
dev
...
7752-fixSe
|
@ -36,7 +36,3 @@ rules:
|
||||||
jasmine/no-focused-tests: 0
|
jasmine/no-focused-tests: 0
|
||||||
jasmine/prefer-toHaveBeenCalledWith: 0
|
jasmine/prefer-toHaveBeenCalledWith: 0
|
||||||
arrow-spacing: ["error", { "before": true, "after": true }]
|
arrow-spacing: ["error", { "before": true, "after": true }]
|
||||||
no-restricted-syntax:
|
|
||||||
- "error"
|
|
||||||
- selector: "NewExpression[callee.name='Date']"
|
|
||||||
message: "Use Date.vnNew() instead of new Date()."
|
|
||||||
|
|
546
CHANGELOG.md
546
CHANGELOG.md
|
@ -1,548 +1,3 @@
|
||||||
# Version 25.04 - 2025-01-28
|
|
||||||
|
|
||||||
### Added 🆕
|
|
||||||
|
|
||||||
- feat: refs #7202 added new field by:Jon
|
|
||||||
- feat: refs #7343 delete sending to user by:ivanm
|
|
||||||
- feat: refs #7569 refs#7569 sendEmailNotification by:sergiodt
|
|
||||||
- feat: refs #7569 refs#7569 sendMail by:sergiodt
|
|
||||||
- feat: refs #7584 changes request by:robert
|
|
||||||
- feat: refs #7584 workerTimeControl_afterDelete by:robert
|
|
||||||
- feat: refs #7832 implement refund ticket restrictions and add unit tests for ticket service updates by:jgallego
|
|
||||||
- feat: refs #7882 Added coords to create a address by:guillermo
|
|
||||||
- feat: refs #8073 change names and primary key by:ivanm
|
|
||||||
- feat: refs #8073 new comment message by:ivanm
|
|
||||||
- feat: refs #8073 #refs 8073 create vn.productionCountryVolume by:ivanm
|
|
||||||
- feat: refs #8117 add worker first and last name to item type query by:jtubau
|
|
||||||
- feat: refs #8247 added new acl for VnUser model by:Jon
|
|
||||||
- feat: refs #8258 added uppercase validation on supplier create (origin/8258-uppercaseInputs) by:provira
|
|
||||||
- feat: refs #8298 add priceOptimum and packagesDiscountFactor to zone and client tables by:jgallego
|
|
||||||
- feat: refs #8298 add priceOptimum column to zoneEvent and update zone fixture data by:jgallego
|
|
||||||
- feat: refs #8298 update price calculation logic and add packagesDiscountFactor column to client table by:jgallego
|
|
||||||
- feat: refs #8357 Agregados triggers para manejar exclusiones de trabajadores en la tabla workerMana by:guillermo
|
|
||||||
- feat: refs #8361 add hasToDownloadRate field to currency model and update exchange rate logic by:jgallego
|
|
||||||
- feat: refs #8381 add initial and final temperature fields to entry model and queries by:jgallego
|
|
||||||
|
|
||||||
### Changed 📦
|
|
||||||
|
|
||||||
- refactor: order by id by:alexm
|
|
||||||
- refactor: refs #7202 modified new invoice procedure and incoterms sql by:Jon
|
|
||||||
- refactor: refs #7202 modified procedure to include customsAgent field when creating an invoice by:Jon
|
|
||||||
- refactor: refs #8378 deprecate bi.f_tvc by:ivanm
|
|
||||||
|
|
||||||
### Fixed 🛠️
|
|
||||||
|
|
||||||
- feat: refs #8298 add priceOptimum column to zoneEvent and update zone fixture data by:jgallego
|
|
||||||
- fix: prevent slow update (HEAD -> 8452-testToMaster, origin/test, origin/8452-testToMaster, test) by:alexm
|
|
||||||
- fix: refs #7202 fixed back test by:Jon
|
|
||||||
- fix: refs #7202 fixed sql by:Jon
|
|
||||||
- fix: refs #7569 refs·6861 ticketOrderReserve by:sergiodt
|
|
||||||
- fix: refs #7569 refs·6861 ticketOrderReserve (origin/7569-sendEmailOrderTicket) by:sergiodt
|
|
||||||
- fix: refs #7569 refs#8188 add IfNotExists by:sergiodt
|
|
||||||
- fix: refs #7832 update ticketService model test suite to correct describe block by:jgallego
|
|
||||||
- fix: refs #8298 remove duplicate entry in English locale file by:jgallego
|
|
||||||
- fix: refs #8361 streamline transaction handling in exchangeRateUpdate by:jgallego
|
|
||||||
- test: refs #8448 fix e2e by:alexm
|
|
||||||
|
|
||||||
# Version 25.00 - 2025-01-14
|
|
||||||
|
|
||||||
### Added 🆕
|
|
||||||
|
|
||||||
- feat: refs #7235 add serialType parameter to getInvoiceDate and implement corresponding tests by:jgallego
|
|
||||||
- feat: refs #7301 update lastEntriesFilter to include landedDate and enhance test cases (origin/7301-removeRedundantInventories) by:pablone
|
|
||||||
- feat: refs #7880 error code and translations by:ivanm
|
|
||||||
- feat: refs #7924 add isCustomInspectionRequired field to item and update related logic by:jgallego
|
|
||||||
- feat: refs #8167 update canBeInvoiced method to include active status check and improve test cases by:jgallego
|
|
||||||
- feat: refs #8167 update locale and improve invoicing logic with error handling by:jgallego
|
|
||||||
- feat: refs #8246 added relation for the front's new field by:Jon
|
|
||||||
- feat: refs #8266 added itemFk and needed fixtures by:jtubau
|
|
||||||
- feat: refs #8324 country unique by:Carlos Andrés
|
|
||||||
|
|
||||||
### Changed 📦
|
|
||||||
|
|
||||||
|
|
||||||
### Fixed 🛠️
|
|
||||||
|
|
||||||
- feat: refs #8266 added itemFk and needed fixtures by:jtubau
|
|
||||||
- fix: add isCustomInspectionRequired column to item table for customs inspection indication by:jgallego
|
|
||||||
- fix: canBeInvoiced only in makeInvoice by:alexm
|
|
||||||
- fix: hotFix getMondayWeekYear by:alexm
|
|
||||||
- fix: refs #6598 update ACL property assignment by:jorgep
|
|
||||||
- fix: refs #6861 refs#6861 addPrevOK by:sergiodt
|
|
||||||
- fix: refs #7301 remove debug console log and update test cases in lastEntriesFilter by:pablone
|
|
||||||
- fix: refs #7301 update SQL fixtures and improve lastEntriesFilter logic by:pablone
|
|
||||||
|
|
||||||
# Version 24.52 - 2024-01-07
|
|
||||||
|
|
||||||
### Added 🆕
|
|
||||||
|
|
||||||
- chore: pullinfo by:alexm
|
|
||||||
- chore: refs #8002 drop comments by:jorgep
|
|
||||||
- chore: refs #8002 drop useless code by:jorgep
|
|
||||||
- feat: added translations and show error in item-type by:Jon
|
|
||||||
- feat: modified data to be equal as the updated back by:Jon
|
|
||||||
- feat: refs #4460 invoiceIn refund by:Carlos Andrés
|
|
||||||
- feat: refs #4466 invoiceIn refund by:Carlos Andrés
|
|
||||||
- feat: refs #6583 add new opt in where builder by:jorgep
|
|
||||||
- feat: refs #6583 add tests by:jorgep
|
|
||||||
- feat: refs #6583 retrieve cloned sale by:jorgep
|
|
||||||
- feat: refs #6583 rollback by:jorgep
|
|
||||||
- feat: refs #7301 add inventory-config and acl by:pablone
|
|
||||||
- feat: refs #7301 update SQL fixtures and enhance lastEntriesFilter logic by:pablone
|
|
||||||
- feat: refs #7882 Added locationiq service by:guillermo
|
|
||||||
- feat: refs #7882 Added osrm service by:guillermo
|
|
||||||
- feat: refs #7882 Added tests by:guillermo
|
|
||||||
- feat: refs #7882 Fixed problems osrm service by:guillermo
|
|
||||||
- feat: refs #7882 Osrm service by:guillermo
|
|
||||||
- feat: refs #7882 Reequested changes by:guillermo
|
|
||||||
- feat: refs #7882 Requested changes by:guillermo
|
|
||||||
- feat: refs #7936 add back test for updateInvoiceIn by:jorgep
|
|
||||||
- feat: refs #7936 add company filter by:jorgep
|
|
||||||
- feat: refs #7936 add currency check to updateInvoiceIn by:jorgep
|
|
||||||
- feat: refs #7936 add currency handling in invoiceIn trigger by:jorgep
|
|
||||||
- feat: refs #7936 add locale by:jorgep
|
|
||||||
- feat: refs #7936 add minimum due date by:jorgep
|
|
||||||
- feat: refs #7936 add reference rates for currency in fixtures by:jorgep
|
|
||||||
- feat: refs #7936 add save validation by:jorgep
|
|
||||||
- feat: refs #7936 add SiiTypeInvoiceIn model and update invoice correction logic by:jorgep
|
|
||||||
- feat: refs #7936 add tests for invoiceIn by:jorgep
|
|
||||||
- feat: refs #7936 add tests for invoiceIn filter by:jorgep
|
|
||||||
- feat: refs #7936 add validation to InvoiceIn & InvoiceInTax by:jorgep
|
|
||||||
- feat: refs #7936 return country code & is vies fields by:jorgep
|
|
||||||
- feat: refs #8002 adjust to lilium by:jorgep
|
|
||||||
- feat: refs #8002 drop support btn by:jorgep
|
|
||||||
- feat: refs #8174 Changed datatype incompatibility access by:guillermo
|
|
||||||
- feat: refs #8174 Created table sim by:guillermo
|
|
||||||
- feat: refs #8174 create table simsupplier by:Jbreso
|
|
||||||
- feat: refs #8174 fix by:Jbreso
|
|
||||||
- feat: refs#8174 simSupplier by:Jbreso
|
|
||||||
- feat: refs #8190 entry_getCommission by:robert
|
|
||||||
- feat: refs #8190 entry_getCommission change request by:robert
|
|
||||||
- feat: refs #8218 Added time and code in mistakeType by:guillermo
|
|
||||||
- feat: refs #8293 include zone data by:Jtubau
|
|
||||||
- refactor: refs #6583 entry report table style by:jorgep
|
|
||||||
|
|
||||||
### Changed 📦
|
|
||||||
|
|
||||||
- refactor: refs #6583 entry report table style by:jorgep
|
|
||||||
- refactor: refs #6583 use warehouseId var by:jorgep
|
|
||||||
- refactor: refs #7301 update entry and item filter tests to validate results against specific criteria by:pablone
|
|
||||||
- refactor: refs #7882 Added ACL's by:guillermo
|
|
||||||
- refactor: refs #7882 Deleted quadminds files by:guillermo
|
|
||||||
- refactor: refs #7936 add transaction & tests by:jorgep
|
|
||||||
- refactor: refs #7936 remove old trigger and add isRaid column to travel table by:jorgep
|
|
||||||
- refactor: refs #7936 remove schema by:jorgep
|
|
||||||
- refactor: refs #8002 use loop wip by:jorgep
|
|
||||||
- refactor: refs #8004 simplify SQL query by removing redundant aliases by:pablone
|
|
||||||
- refactor: refs #8262 Deprecated inventoryFailure by:guillermo
|
|
||||||
- refactor: refs #8266 changed expedition item name by:Jtubau
|
|
||||||
- refactor: refs #8272 delete bi.rotacion by:ivanm
|
|
||||||
|
|
||||||
### Fixed 🛠️
|
|
||||||
|
|
||||||
- feat: refs #7301 update SQL fixtures and enhance lastEntriesFilter logic by:pablone
|
|
||||||
- feat: refs #7936 add reference rates for currency in fixtures by:jorgep
|
|
||||||
- feat: refs #8174 fix by:Jbreso
|
|
||||||
- fix: 8174 pasar PIN a CHAR by:Jbreso
|
|
||||||
- fix: monitorPayMethodFilter by:carlossa
|
|
||||||
- fix: refs #6389 back by:carlossa
|
|
||||||
- fix: refs #6389 filter by:carlossa
|
|
||||||
- fix: refs #6389 packing by:carlossa
|
|
||||||
- fix: refs #6389 saleMonitor filter by:carlossa
|
|
||||||
- fix: refs #6389 salesFilter by:carlossa
|
|
||||||
- fix: refs #6583 drop focus by:jorgep
|
|
||||||
- fix: refs #6583 update onlyWithDestination logic to handle null values correctly by:jorgep
|
|
||||||
- fix: refs #7028 fix confirm deny by:carlossa
|
|
||||||
- fix: refs #7028 fix pr by:carlossa
|
|
||||||
- fix: refs #7028 fix tback findById by:carlossa
|
|
||||||
- fix: refs #7028 fix userError by:carlossa
|
|
||||||
- fix: refs #7028 remove ifs by:carlossa
|
|
||||||
- fix: refs #7028 requesterId fix by:carlossa
|
|
||||||
- fix: refs #7028 requesterId fix salesPerson by:carlossa
|
|
||||||
- fix: refs #7031 fix vnPrice by:carlossa
|
|
||||||
- fix: refs #7031 remove check by:carlossa
|
|
||||||
- fix: refs #7301 update ACL insertion to use INSERT IGNORE and refine property value by:pablone
|
|
||||||
- fix: refs #7936 add IF NOT EXISTS to isRaid column in travel table by:jorgep
|
|
||||||
- fix: refs #7936 change type by:jorgep
|
|
||||||
- fix: refs #7936 check if insert in hook & change test description by:jorgep
|
|
||||||
- fix: refs #7936 conflicts by:jorgep
|
|
||||||
- fix: refs #7936 locale by:jorgep
|
|
||||||
- fix: refs #7936 update Spanish locale for SII terms by:jorgep
|
|
||||||
- fix: refs #8174 fix by:Jbreso
|
|
||||||
- fix: refs#8174 fix by:Jbreso
|
|
||||||
- fix: refs8174 pasar a char el PIN by:Jbreso
|
|
||||||
- fix: refs #8174 Version by:guillermo
|
|
||||||
- fix: refs #8251 add eng template by:carlossa
|
|
||||||
- fix: refs #8315 fixture claimDevelopment by:alexm
|
|
||||||
|
|
||||||
# Version 24.48 - 2024-11-25
|
|
||||||
|
|
||||||
### Added 🆕
|
|
||||||
|
|
||||||
- feat: refs #4948 Added ticket_selfConsumptionPackaging by:guillermo
|
|
||||||
- feat: refs #6818 add config table by:jorgep
|
|
||||||
- feat: refs #6818 add records by:jorgep
|
|
||||||
- feat: refs #6818 saysimple integration by:jorgep
|
|
||||||
- feat: refs #6845 userInterface by:sergiodt
|
|
||||||
- feat: refs #6869 add back by:jorgep
|
|
||||||
- feat: refs #6869 define model by:jorgep
|
|
||||||
- feat: refs #6869 refs#6869 itemShelving_get (origin/6869-createGetDetails) by:sergiodt
|
|
||||||
- feat: refs #7006 itemTypeLog by:guillermo
|
|
||||||
- feat: refs #7006 itemTypeLog created by:guillermo
|
|
||||||
- feat: refs #7006 Requested changes by:guillermo
|
|
||||||
- feat: refs #7193 added scope in parking model by:Jon
|
|
||||||
- feat: refs #7244 Requested changes by:guillermo
|
|
||||||
- feat: refs #7266 Added details and improvements in item label reports by:guillermo
|
|
||||||
- feat: refs #7266 buyFkForPrint by:sergiodt
|
|
||||||
- feat: refs #7266 First commit by:guillermo
|
|
||||||
- feat: refs #7266 Item label barcode by:guillermo
|
|
||||||
- feat: refs #7266 Item label QR by:guillermo
|
|
||||||
- feat: refs #7266 Item label QR finished by:guillermo
|
|
||||||
- feat: refs #7266 Minor change by:guillermo
|
|
||||||
- feat: refs #7266 Print corrections by:guillermo
|
|
||||||
- feat: refs #7266 Requested changes and improvements by:guillermo
|
|
||||||
- feat: refs #7266 Requested changes and query optimization by:guillermo
|
|
||||||
- feat: refs #7266 Version by:guillermo
|
|
||||||
- feat: refs #7289 #7289 apply option 1 by:Javier Segarra
|
|
||||||
- feat: refs #7289 #7289 remove bad translation by:Javier Segarra
|
|
||||||
- feat: refs #7524 restrict fields by:jorgep
|
|
||||||
- feat: refs #7641 fine tunning by:jorgep
|
|
||||||
- feat: refs #7641 improve style by:jorgep
|
|
||||||
- feat: refs #7743 add simple spec for sendMail by:pablone
|
|
||||||
- feat: refs #7743 add try catch stmt to the test by:pablone
|
|
||||||
- feat: refs #7874 add default type by:jorgep
|
|
||||||
- feat: refs #7874 use name by:jorgep
|
|
||||||
- feat: refs #7920 Added ItemShelving in shelvingLog by:guillermo
|
|
||||||
- feat: refs #7921 refs#7921 sendLostExpedition by:sergiodt
|
|
||||||
- feat: refs #7922 refs #792 scanOrder by:sergiodt
|
|
||||||
- feat: refs #7943 quitar lectura en metodos comunes by:jgallego
|
|
||||||
- feat: refs #7943 return just the required content by:jorgep
|
|
||||||
- feat: refs #7943 usa back con permisos by:jgallego
|
|
||||||
- feat: refs #8020 machineWorkerDeprecated by:sergiodt
|
|
||||||
- feat: refs #8057 Added data updates by:guillermo
|
|
||||||
- feat: refs #8057 Added data updates (origin/8057-geoFk) by:guillermo
|
|
||||||
- feat: refs #8057 Added geoFk columns by:guillermo
|
|
||||||
- feat: refs #8057 Fix version by:guillermo
|
|
||||||
- feat: refs #8057 More precision in getGeo by:guillermo
|
|
||||||
- feat: refs #8057 Requested changes by:guillermo
|
|
||||||
- feat: refs #8071 quitar esquema by:robert
|
|
||||||
- feat: refs #8071 travel_weeklyClone by:robert
|
|
||||||
- feat: refs #8080 Added column comment by:guillermo
|
|
||||||
- feat: refs #8083 add prop by:jorgep
|
|
||||||
- feat: refs #8087 Traspasar redadas a travels by:Carlos Andrés
|
|
||||||
- feat: refs #8099 refs#8099 addComplmentSalary by:sergiodt
|
|
||||||
- feat: refs #8124 Enrutadores nuevos requerimientos by:Carlos Andrés
|
|
||||||
- feat: refs #8124 Enrutadores nuevos requerimientos (origin/8124-enrutadoresNuevosRequerimientos) by:Carlos Andrés
|
|
||||||
- feat: refs #8127 entry_getCommission by:robert
|
|
||||||
- feat: refs #8127 quitar esquemas by:robert
|
|
||||||
- feat: refs #8135 refs#8135 updateTicketACL (origin/8135-ticketACL) by:sergiodt
|
|
||||||
- feat: refs #8143 deprecate recoverPass and sync from account.user by:ivanm
|
|
||||||
- feat: refs #8150 movExpeditions by:sergiodt
|
|
||||||
- feat: refs #8151 Added test by:guillermo
|
|
||||||
- feat: refs #8151 moveExpeditions by:guillermo
|
|
||||||
- feat: refs #8151 Requested changes by:guillermo
|
|
||||||
- feat(Supplier): refs #6828 add companySize by:alexm
|
|
||||||
- refactor: refs #7641 entry report style by:jorgep
|
|
||||||
|
|
||||||
### Changed 📦
|
|
||||||
|
|
||||||
- refactor: refs #6920 add correct role by:alexm
|
|
||||||
- refactor: refs #7242 Deleted select column by:guillermo
|
|
||||||
- refactor: refs #7457 Added from param if not exists by:guillermo
|
|
||||||
- refactor: refs #7641 entry report style by:jorgep
|
|
||||||
- refactor: refs #7715 Deleted hasNewLabelMrwMethod column by:guillermo
|
|
||||||
- refactor: refs #7920 Fix tests by:guillermo
|
|
||||||
- refactor: refs #7920 Fix version by:guillermo
|
|
||||||
- refactor: refs #7920 itemShelvingLog by:guillermo
|
|
||||||
- refactor: refs #7920 Main change by:guillermo
|
|
||||||
- refactor: refs #7920 Major changes by:guillermo
|
|
||||||
- refactor: refs #7920 No changes in itemShelvingLog table by:guillermo
|
|
||||||
- refactor: refs #7920 Requested changes by:guillermo
|
|
||||||
- refactor: refs #7950 Created cmr model (7950-cmrModelUnify) by:guillermo
|
|
||||||
- refactor: refs #7950 Requested changes by:guillermo
|
|
||||||
- refactor: refs #8153 Optimized order_getTax by:guillermo
|
|
||||||
|
|
||||||
### Fixed 🛠️
|
|
||||||
|
|
||||||
- fix: clean deletes also zoneEvent range records by:jgallego
|
|
||||||
- fix: more data for fixture.before by:Pako
|
|
||||||
- fix: refs #4948 Tests by:guillermo
|
|
||||||
- fix: refs #6644 email and translations by:carlossa
|
|
||||||
- fix: refs #6818 add config by:jorgep
|
|
||||||
- fix: refs #6818 add defaultChannel by:jorgep
|
|
||||||
- fix: refs #6818 use right col type by:jorgep
|
|
||||||
- fix: refs #6869 use id as primaryKey by:jorgep
|
|
||||||
- fix: refs #7244 Added collection ACL by:guillermo
|
|
||||||
- fix: refs #7283 item filters by:carlossa
|
|
||||||
- fix: refs #7283 remove by:carlossa
|
|
||||||
- fix: refs #7283 remove tests by:carlossa
|
|
||||||
- fix: refs #7283 tback by:carlossa
|
|
||||||
- fix: refs #7323 add remaining fields (origin/7323-warfix-addRemainingFields) by:jorgep
|
|
||||||
- fix: refs #7457 add with on select to reduce by:pablone
|
|
||||||
- fix: refs #7457 empty commit for gitea by:pablone
|
|
||||||
- fix: refs #7457 error on empty from param and add translate by:pablone
|
|
||||||
- fix: refs #7457 remove group by calc time reduce bellow 1s by:pablone
|
|
||||||
- fix: refs #7457 remove translate and use param definition for restriction by:pablone
|
|
||||||
- fix: refs #7641 align columns by:jorgep
|
|
||||||
- fix: refs #7641 drop boilerplate code by:jorgep
|
|
||||||
- fix: refs #7920 refs#7920 itemShelvingLog by:sergiodt
|
|
||||||
- fix: refs #8153 Version by:guillermo
|
|
||||||
- revert cd7ed6987a88e00275b562d3248f368b6333620c by:Javier Segarra
|
|
||||||
|
|
||||||
# Version 24.38 - 2024-09-17
|
|
||||||
|
|
||||||
### Added 🆕
|
|
||||||
|
|
||||||
- chore: refs #7323 filter data by:jorgep
|
|
||||||
- chore: refs #7323 fix test by:jorgep
|
|
||||||
- chore: refs #7323 worker changes by:jorgep
|
|
||||||
- chore: refs #7323 worker changes wip by:jorgep
|
|
||||||
- chore: refs #7524 add select limit by:jorgep
|
|
||||||
- feat(AccessToken&ACL): refs #7547 upgrade security by:alexm
|
|
||||||
- feat: deleted code and redirect to Lilium by:Jon
|
|
||||||
- feat: refs #4515 New throw buy_checkItem by:guillermo
|
|
||||||
- feat: refs #6650 Added saleGroupLog by:guillermo
|
|
||||||
- feat: refs #6650 new itemShelvingLog by:guillermo
|
|
||||||
- feat: refs #6760 refs #actualiza campo nickname by:jgallego
|
|
||||||
- feat: refs #7277 fdescribe by:jgallego
|
|
||||||
- feat: refs #7277 fit by:jgallego
|
|
||||||
- feat: refs #7277 refundInvoices by:jgallego
|
|
||||||
- feat: refs #7277 test with warehouse by:jgallego
|
|
||||||
- feat: refs #7277 traducciones by:jgallego
|
|
||||||
- feat: refs #7277 transfer addressFk by:jgallego
|
|
||||||
- feat: refs #7532 Requested changes by:guillermo
|
|
||||||
- feat: refs #7564 Added proc by:guillermo
|
|
||||||
- feat: refs #7564 Added ticket_setVolumeItemCost by:guillermo
|
|
||||||
- feat: refs #7564 Added volume column by:guillermo
|
|
||||||
- feat: refs #7564 Fix version by:guillermo
|
|
||||||
- feat: refs #7564 Requested changes by:guillermo
|
|
||||||
- feat: refs #7615 setDeleted by:robert
|
|
||||||
- feat: refs #7650 Added no transfer lines to inventory entry and fixtures by:guillermo
|
|
||||||
- feat: refs #7650 Fix tests by:guillermo
|
|
||||||
- feat: refs #7747 Delete buyUltimate and buyUltimateFromInterval by:ivanm
|
|
||||||
- feat: refs #7759 Changed defined only of vn objects by:guillermo
|
|
||||||
- feat: refs #7759 Changed definer root to vn-admin by:guillermo
|
|
||||||
- feat: refs #7759 Changed name by:guillermo
|
|
||||||
- feat: refs #7759 Deleted version 11163-maroonEucalyptus by:guillermo
|
|
||||||
- feat: refs #7759 Revoke routine grants vn by:guillermo
|
|
||||||
- feat: refs #7811 Added comment by:guillermo
|
|
||||||
- feat: refs #7811 Added new params in datasources.json by:guillermo
|
|
||||||
- feat: refs #7898 Add column "floor" in vn.parking by:ivanm
|
|
||||||
- feat: refs #7898 Modify default by:ivanm
|
|
||||||
- feat: refs #7905 Added new method getBuysCsv by:guillermo
|
|
||||||
- feat: refs #7905 Added param toCsv by:guillermo
|
|
||||||
- feat: refs #7938 remove unnecessary insert in clientLog by:alexm
|
|
||||||
- feat: refs #7953 pullinfo (7953-devToTest_2438) by:alexm
|
|
||||||
- feat(salix): #7671 define isDestiny field in model by:Javier Segarra
|
|
||||||
- feat(salix): refs #7896 update version and changelog (origin/7896_down_devToTest_2436) by:Javier Segarra
|
|
||||||
- feat(salix): refs #7905 #7905 use getBuys toCSV flattened by:Javier Segarra
|
|
||||||
- feat(ssalix): refs #7671 #7671 checkDates by:Javier Segarra
|
|
||||||
- feat(ssalix): refs #7671 #7671 checkDates to present by:Javier Segarra
|
|
||||||
- feat: ticket 215005 Changed acl show transferClient by:guillermo
|
|
||||||
|
|
||||||
### Changed 📦
|
|
||||||
|
|
||||||
- perf: refs #7671 improve showBadDates by:Javier Segarra
|
|
||||||
- perf(salix): refs #7671 #7671 imrpove and revert where changes by:Javier Segarra
|
|
||||||
- refactor: deleted e2e & added back descriptor and summary by:Jon
|
|
||||||
|
|
||||||
### Fixed 🛠️
|
|
||||||
|
|
||||||
- chore: refs #7323 fix test by:jorgep
|
|
||||||
- feat: refs #7650 Added no transfer lines to inventory entry and fixtures by:guillermo
|
|
||||||
- fix by:guillermo
|
|
||||||
- fixes: refs #7760 collection problems by:Carlos Andrés
|
|
||||||
- fix merge dev (7407-workerMedical) by:alexm
|
|
||||||
- fix: refs #6727 No delete log tables data in clean procedures by:guillermo
|
|
||||||
- fix: refs #6897 back and tests by:carlossa
|
|
||||||
- fix: refs #6897 back by:carlossa
|
|
||||||
- fix: refs #6897 fix filter by:carlossa
|
|
||||||
- fix: refs #6897 fix json by:carlossa
|
|
||||||
- fix: refs #6897 travel filter by:carlossa
|
|
||||||
- fix: refs #6897 error test by:jgallego
|
|
||||||
- fix: refs #7323 fetch from right source by:jorgep
|
|
||||||
- fix: refs #7564 Deleted query by:guillermo
|
|
||||||
- fix: refs #7759 Added user 'vn'@'localhost' & grants by:guillermo
|
|
||||||
- fix: refs #7760 collection problems by:Carlos Andrés
|
|
||||||
- fix: refs #7760 tmp.ticketIPT by:Carlos Andrés
|
|
||||||
- fix: refs #7905 added comments to flatten.js by:guillermo
|
|
||||||
- fix: refs ##7905 Handle error by:guillermo
|
|
||||||
- fix(salix): refs #7905 #7905 use right fn to flatten data by:Javier Segarra
|
|
||||||
- perf(salix): refs #7671 #7671 imrpove and revert where changes by:Javier Segarra
|
|
||||||
- refs #6898 fix supplier remove by:carlossa
|
|
||||||
- refs #7407 fix acls fixtures by:carlossa
|
|
||||||
- test: fix connections e2e (7547-accessToken-security) by:alexm
|
|
||||||
- test: refs #7277 fix test proposal by:Javier Segarra
|
|
||||||
- test(salix): refs #7671 #7671 improve and revert where changes by:Javier Segarra
|
|
||||||
|
|
||||||
# Version 24.36 - 2024-09-03
|
|
||||||
|
|
||||||
### Added 🆕
|
|
||||||
|
|
||||||
- chore: refs #7524 WIP limit call by:jorgep
|
|
||||||
- chore: refs #7524 modify ormConfig table col (origin/7524-warmfix-modifyColumn) by:jorgep
|
|
||||||
- feat(update-user): refs #7848 add twoFactor by:alexm
|
|
||||||
- feat: #3199 Requested changes by:guillermo
|
|
||||||
- feat: refs #3199 Added more scopes ticket_recalcByScope by:guillermo
|
|
||||||
- feat: refs #3199 Added one more scope ticket_recalcByScope by:guillermo
|
|
||||||
- feat: refs #3199 Created ticket_recalcItemTaxCountryByScope by:guillermo
|
|
||||||
- feat: refs #3199 Requested changes by:guillermo
|
|
||||||
- feat: refs #7346 add multiple feature by:jgallego
|
|
||||||
- feat: refs #7346 backTest checks new implementation by:jgallego
|
|
||||||
- feat: refs #7346 mas intuitivo by:jgallego
|
|
||||||
- feat: refs #7514 Changes to put srt log (origin/7514-srtLog) by:guillermo
|
|
||||||
- feat: refs #7524 add default limit (origin/7524-limitSelect) by:jorgep
|
|
||||||
- feat: refs #7524 add mock limit on find query by:jorgep
|
|
||||||
- feat: refs #7524 wip remote hooks by:jorgep
|
|
||||||
- feat: refs #7562 Requested changes by:guillermo
|
|
||||||
- feat: refs #7567 Changed time to call event by:guillermo
|
|
||||||
- feat: refs #7567 Requested changes by:guillermo
|
|
||||||
- feat: refs #7710 pr revision by:jgallego
|
|
||||||
- feat: refs #7710 test fixed (origin/7710-cloneWithTicketPackaging, 7710-cloneWithTicketPackaging) by:jgallego
|
|
||||||
- feat: refs #7712 Fix by:guillermo
|
|
||||||
- feat: refs #7712 Unify by:guillermo
|
|
||||||
- feat: refs #7712 sizeLimit (origin/7712-sizeLimit) by:guillermo
|
|
||||||
- feat: refs #7758 Add code mandateType and accountDetailType by:ivanm
|
|
||||||
- feat: refs #7758 Modify code lowerCamelCase and UNIQUE by:ivanm
|
|
||||||
- feat: refs #7758 accountDetailType fix deploy error by:ivanm
|
|
||||||
- feat: refs #7784 Changes in entry-order-pdf by:guillermo
|
|
||||||
- feat: refs #7784 Requested changes by:guillermo
|
|
||||||
- feat: refs #7799 Added Fk in vn.item.itemPackingTypeFk by:guillermo
|
|
||||||
- feat: refs #7800 Added company Fk by:guillermo
|
|
||||||
- feat: refs #7842 Added editorFk in vn.host by:guillermo
|
|
||||||
- feat: refs #7860 Update new packagings (origin/7860-newPackaging) by:guillermo
|
|
||||||
- feat: refs #7862 roadmap new fields by:ivanm
|
|
||||||
- feat: refs #7882 Added quadMindsConfig table by:guillermo
|
|
||||||
|
|
||||||
### Changed 📦
|
|
||||||
|
|
||||||
- refactor: refs #7567 Fix and improvement by:guillermo
|
|
||||||
- refactor: refs #7567 Minor change by:guillermo
|
|
||||||
- refactor: refs #7756 Fix tests by:guillermo
|
|
||||||
- refactor: refs #7798 Drop bi.Greuges_comercial_detail by:guillermo
|
|
||||||
- refactor: refs #7848 adapt to lilium by:alexm
|
|
||||||
|
|
||||||
### Fixed 🛠️
|
|
||||||
|
|
||||||
- feat: refs #7710 test fixed (origin/7710-cloneWithTicketPackaging, 7710-cloneWithTicketPackaging) by:jgallego
|
|
||||||
- feat: refs #7758 accountDetailType fix deploy error by:ivanm
|
|
||||||
- fix(salix): #7283 ItemFixedPrice duplicated (origin/7283_itemFixedPrice_duplicated) by:Javier Segarra
|
|
||||||
- fix: refs #7346 minor error (origin/7346, 7346) by:jgallego
|
|
||||||
- fix: refs #7355 remove and tests accounts (origin/7355-accountMigration2) by:carlossa
|
|
||||||
- fix: refs #7355 remove and tests accounts by:carlossa
|
|
||||||
- fix: refs #7524 default limit select by:jorgep
|
|
||||||
- fix: refs #7756 Foreign keys invoiceOut (origin/7756-fixRefFk) by:guillermo
|
|
||||||
- fix: refs #7756 id 0 by:guillermo
|
|
||||||
- fix: refs #7800 tpvMerchantEnable PRIMARY KEY (origin/7800-tpvMerchantEnable) by:guillermo
|
|
||||||
- fix: refs #7800 tpvMerchantEnable PRIMARY KEY by:guillermo
|
|
||||||
- fix: refs #7916 itemShelving_transfer (origin/test, test) by:guillermo
|
|
||||||
- fix: refs #pako Deleted duplicated version by:guillermo
|
|
||||||
|
|
||||||
# Version 24.34 - 2024-08-20
|
|
||||||
|
|
||||||
### Added 🆕
|
|
||||||
|
|
||||||
- #6900 feat: clear empty by:jorgep
|
|
||||||
- #6900 feat: empty commit by:jorgep
|
|
||||||
- chore: refs #6900 beautify code by:jorgep
|
|
||||||
- chore: refs #6989 add config model by:jorgep
|
|
||||||
- feat workerActivity refs #6078 by:sergiodt
|
|
||||||
- feat: #6453 Refactor (origin/6453-orderConfirm) by:guillermo
|
|
||||||
- feat: #6453 Rollback always split by itemPackingType by:guillermo
|
|
||||||
- feat: deleted worker module code & redirect to Lilium by:Jon
|
|
||||||
- feat: refs #6453 Added new ticket search by:guillermo
|
|
||||||
- feat: refs #6453 Fixes by:guillermo
|
|
||||||
- feat: refs #6453 Minor changes by:guillermo
|
|
||||||
- feat: refs #6453 Requested changes by:guillermo
|
|
||||||
- feat: refs #6900 drop section by:jorgep
|
|
||||||
- feat: refs #7283 order by desc date by:jorgep
|
|
||||||
- feat: refs #7323 add locale by:jorgep
|
|
||||||
- feat: refs #7323 redirect to lilium by:jorgep
|
|
||||||
- feat: refs #7646 delete scannableCodeType by:robert
|
|
||||||
- feat: refs #7713 Created ACLLog by:guillermo
|
|
||||||
- feat: refs #7774 (origin/7774-ticket_cloneWeekly) by:robert
|
|
||||||
- feat: refs #7774 #7774 Changes ticket_cloneWeekly by:guillermo
|
|
||||||
- feat: refs #7774 ticket_cloneWeekly by:robert
|
|
||||||
|
|
||||||
### Changed 📦
|
|
||||||
|
|
||||||
- refactor: refs #6453 Major changes by:guillermo
|
|
||||||
- refactor: refs #6453 Minor changes by:guillermo
|
|
||||||
- refactor: refs #6453 order_confirmWithUser by:guillermo
|
|
||||||
- refactor: refs #7646 #7646 Deleted scannable* variables productionConfig by:guillermo
|
|
||||||
- refactor: refs #7820 Deprecated silexACL by:guillermo
|
|
||||||
|
|
||||||
### Fixed 🛠️
|
|
||||||
|
|
||||||
- #6900 fix: #6900 rectificative filter by:jorgep
|
|
||||||
- #6900 fix: empty commit by:jorgep
|
|
||||||
- fix(orders_filter): add sourceApp accepts by:alexm
|
|
||||||
- fix: refs #6130 commit lint by:pablone
|
|
||||||
- fix: refs #6453 order_confirmWithUser by:guillermo
|
|
||||||
- fix: refs #7283 sql by:jorgep
|
|
||||||
- fix: refs #7713 ACL Log by:guillermo
|
|
||||||
- test: fix claim descriptor redirect to lilium by:alexm
|
|
||||||
- test: fix ticket redirect to lilium by:alexm
|
|
||||||
- test: fix ticket sale e2e by:alexm
|
|
||||||
|
|
||||||
# Version 24.32 - 2024-08-06
|
|
||||||
|
|
||||||
### Added 🆕
|
|
||||||
|
|
||||||
- chore: refs #7197 add supplierActivityFk filter by:jorgep
|
|
||||||
- feat checkExpeditionPrintOut refs #7751 by:sergiodt
|
|
||||||
- feat(defaulter_filter): add department by:alexm
|
|
||||||
- feat: redirect to lilium page not found by:alexm
|
|
||||||
- feat: refactor buyUltimate refs #7736 by:Carlos Andrés
|
|
||||||
- feat: refs #6403 add delete by:pablone
|
|
||||||
- feat: refs #7126 Added manaClaim calc by:guillermo
|
|
||||||
- feat: refs #7126 Refactor and added columns in bs.waste table & proc by:guillermo
|
|
||||||
- feat: refs #7197 filter by correcting by:jorgep
|
|
||||||
- feat: refs #7297 add new columns by:pablone
|
|
||||||
- feat: refs #7356 new parameters in sql for Weekly tickets front by:Jon
|
|
||||||
- feat: refs #7401 redirect lilium by:pablone
|
|
||||||
- feat: refs #7511 Fix tests by:guillermo
|
|
||||||
- feat: refs #7511 Rename to multiConfig tables by:guillermo
|
|
||||||
- feat: refs #7589 Added display (item_valuateInventory) by:guillermo
|
|
||||||
- feat: refs #7589 Added vItemTypeFk & vItemCategoryFk (item_valuateInventory) by:guillermo
|
|
||||||
- feat: refs #7681 Changes by:guillermo
|
|
||||||
- feat: refs #7681 Optimization and refactor by:guillermo
|
|
||||||
- feat: refs #7683 drop temporary table by:robert
|
|
||||||
- feat: refs #7683 productionControl by:robert
|
|
||||||
- feat: refs #7728 Added throw due date by:guillermo
|
|
||||||
- feat: refs #7740 Ticket before update added restriction by:guillermo
|
|
||||||
- feat(salix): #7648 Add field for endpoint as buyLabel report by:Javier Segarra
|
|
||||||
- feat(salix): #7648 remove white line by:Javier Segarra
|
|
||||||
- feat: tabla config dias margen vctos. refs #7728 by:Carlos Andrés
|
|
||||||
|
|
||||||
### Changed 📦
|
|
||||||
|
|
||||||
- eat: refactor buyUltimate refs #7736 by:Carlos Andrés
|
|
||||||
- feat: refactor buyUltimate refs #7736 by:Carlos Andrés
|
|
||||||
- feat: refs #7681 Optimization and refactor by:guillermo
|
|
||||||
- refactor: refs #7126 Requested changes by:guillermo
|
|
||||||
- refactor: refs #7511 Minor change by:guillermo
|
|
||||||
- refactor: refs #7640 Multipleinventory available by:guillermo
|
|
||||||
- refactor: refs #7681 Changes by:guillermo
|
|
||||||
- refactor: refs #7681 Requested changes by:guillermo
|
|
||||||
|
|
||||||
### Fixed 🛠️
|
|
||||||
|
|
||||||
- add prefix (hotFix_liliumRedirection) by:alexm
|
|
||||||
- fix(client_filter): add recovery by:alexm
|
|
||||||
- fix: defaulter filter correct sql (6943-fix_defaulter_filter) by:alexm
|
|
||||||
- fix(deletExpeditions): merge test → dev by:guillermo
|
|
||||||
- fix: refs #6403 fix mrw cancel shipment return type by:pablone
|
|
||||||
- fix: refs #7126 Added addressWaste type by:guillermo
|
|
||||||
- fix: refs #7126 Fix by:guillermo
|
|
||||||
- fix: refs #7126 Minor change by:guillermo
|
|
||||||
- fix: refs #7126 Primary key no unique data by:guillermo
|
|
||||||
- fix: refs #7126 Slow update by:guillermo
|
|
||||||
- fix: refs #7511 Minor change by:guillermo
|
|
||||||
- fix: refs #7546 Deleted insert util.binlogQueue by:guillermo
|
|
||||||
- fix: refs #7811 Variables pm2 by:guillermo
|
|
||||||
- fix: without path by:alexm
|
|
||||||
|
|
||||||
# Version 24.28 - 2024-07-09
|
# Version 24.28 - 2024-07-09
|
||||||
|
|
||||||
### Added 🆕
|
### Added 🆕
|
||||||
|
@ -647,7 +102,6 @@
|
||||||
- feat: refs #7438 Added volume to item_valuateInventory by:guillermo
|
- feat: refs #7438 Added volume to item_valuateInventory by:guillermo
|
||||||
- feat: refs #7438 Requested changes and little changes by:guillermo
|
- feat: refs #7438 Requested changes and little changes by:guillermo
|
||||||
- refs #6281 feat:buyFk in itemShelving by:sergiodt
|
- refs #6281 feat:buyFk in itemShelving by:sergiodt
|
||||||
- feat: refs #6449 item ID is displayed in the sale line by:jorgep
|
|
||||||
|
|
||||||
### Changed 📦
|
### Changed 📦
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,7 @@ def RUN_BUILD
|
||||||
|
|
||||||
def BRANCH_ENV = [
|
def BRANCH_ENV = [
|
||||||
test: 'test',
|
test: 'test',
|
||||||
master: 'production',
|
master: 'production'
|
||||||
beta: 'production'
|
|
||||||
]
|
]
|
||||||
|
|
||||||
node {
|
node {
|
||||||
|
@ -19,8 +18,7 @@ node {
|
||||||
PROTECTED_BRANCH = [
|
PROTECTED_BRANCH = [
|
||||||
'dev',
|
'dev',
|
||||||
'test',
|
'test',
|
||||||
'master',
|
'master'
|
||||||
'beta'
|
|
||||||
].contains(env.BRANCH_NAME)
|
].contains(env.BRANCH_NAME)
|
||||||
|
|
||||||
FROM_GIT = env.JOB_NAME.startsWith('gitea/')
|
FROM_GIT = env.JOB_NAME.startsWith('gitea/')
|
||||||
|
@ -64,18 +62,6 @@ pipeline {
|
||||||
PROJECT_NAME = 'salix'
|
PROJECT_NAME = 'salix'
|
||||||
}
|
}
|
||||||
stages {
|
stages {
|
||||||
stage('Version') {
|
|
||||||
when {
|
|
||||||
expression { RUN_BUILD }
|
|
||||||
}
|
|
||||||
steps {
|
|
||||||
script {
|
|
||||||
def packageJson = readJSON file: 'package.json'
|
|
||||||
def version = "${packageJson.version}-build${env.BUILD_ID}"
|
|
||||||
writeFile(file: 'VERSION.txt', text: version)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stage('Install') {
|
stage('Install') {
|
||||||
environment {
|
environment {
|
||||||
NODE_ENV = ''
|
NODE_ENV = ''
|
||||||
|
@ -132,10 +118,11 @@ pipeline {
|
||||||
when {
|
when {
|
||||||
expression { RUN_BUILD }
|
expression { RUN_BUILD }
|
||||||
}
|
}
|
||||||
environment {
|
|
||||||
VERSION = readFile 'VERSION.txt'
|
|
||||||
}
|
|
||||||
steps {
|
steps {
|
||||||
|
script {
|
||||||
|
def packageJson = readJSON file: 'package.json'
|
||||||
|
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
|
||||||
|
}
|
||||||
sh 'docker-compose build back'
|
sh 'docker-compose build back'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,10 +156,11 @@ pipeline {
|
||||||
when {
|
when {
|
||||||
expression { RUN_BUILD }
|
expression { RUN_BUILD }
|
||||||
}
|
}
|
||||||
environment {
|
|
||||||
VERSION = readFile 'VERSION.txt'
|
|
||||||
}
|
|
||||||
steps {
|
steps {
|
||||||
|
script {
|
||||||
|
def packageJson = readJSON file: 'package.json'
|
||||||
|
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
|
||||||
|
}
|
||||||
sh 'gulp build'
|
sh 'gulp build'
|
||||||
sh 'docker-compose build front'
|
sh 'docker-compose build front'
|
||||||
}
|
}
|
||||||
|
@ -187,9 +175,12 @@ pipeline {
|
||||||
}
|
}
|
||||||
environment {
|
environment {
|
||||||
CREDENTIALS = credentials('docker-registry')
|
CREDENTIALS = credentials('docker-registry')
|
||||||
VERSION = readFile 'VERSION.txt'
|
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
|
script {
|
||||||
|
def packageJson = readJSON file: 'package.json'
|
||||||
|
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
|
||||||
|
}
|
||||||
sh 'docker login --username $CREDENTIALS_USR --password $CREDENTIALS_PSW $REGISTRY'
|
sh 'docker login --username $CREDENTIALS_USR --password $CREDENTIALS_PSW $REGISTRY'
|
||||||
sh 'docker-compose push'
|
sh 'docker-compose push'
|
||||||
}
|
}
|
||||||
|
@ -216,10 +207,11 @@ pipeline {
|
||||||
when {
|
when {
|
||||||
expression { FROM_GIT }
|
expression { FROM_GIT }
|
||||||
}
|
}
|
||||||
environment {
|
|
||||||
VERSION = readFile 'VERSION.txt'
|
|
||||||
}
|
|
||||||
steps {
|
steps {
|
||||||
|
script {
|
||||||
|
def packageJson = readJSON file: 'package.json'
|
||||||
|
env.VERSION = "${packageJson.version}-build${env.BUILD_ID}"
|
||||||
|
}
|
||||||
withKubeConfig([
|
withKubeConfig([
|
||||||
serverUrl: "$KUBERNETES_API",
|
serverUrl: "$KUBERNETES_API",
|
||||||
credentialsId: 'kubernetes',
|
credentialsId: 'kubernetes',
|
||||||
|
|
|
@ -13,7 +13,6 @@ RUN apt-get update \
|
||||||
graphicsmagick \
|
graphicsmagick \
|
||||||
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
||||||
&& apt-get install -y --no-install-recommends nodejs \
|
&& apt-get install -y --no-install-recommends nodejs \
|
||||||
&& npm install -g corepack@0.31.0 \
|
|
||||||
&& corepack enable pnpm
|
&& corepack enable pnpm
|
||||||
|
|
||||||
# Puppeteer
|
# Puppeteer
|
||||||
|
@ -33,7 +32,8 @@ RUN apt-get update \
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
samba-common-bin samba-dsdb-modules\
|
samba-common-bin samba-dsdb-modules\
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& npm -g install pm2
|
||||||
|
|
||||||
# Salix
|
# Salix
|
||||||
|
|
||||||
|
@ -55,4 +55,7 @@ COPY \
|
||||||
README.md \
|
README.md \
|
||||||
./
|
./
|
||||||
|
|
||||||
CMD ["node", "--tls-min-v1.0", "--openssl-legacy-provider", "./loopback/server/server.js"]
|
CMD ["pm2-runtime", "./back/process.yml"]
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=15s --timeout=10s \
|
||||||
|
CMD curl -f http://localhost:3000/api/Applications/status || exit 1
|
||||||
|
|
|
@ -27,46 +27,38 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.sendCheckingPresence = async(ctx, recipientId, message) => {
|
Self.sendCheckingPresence = async(ctx, recipientId, message) => {
|
||||||
|
if (!recipientId) return false;
|
||||||
|
const models = Self.app.models;
|
||||||
|
|
||||||
const userId = ctx.req.accessToken.userId;
|
const userId = ctx.req.accessToken.userId;
|
||||||
|
const sender = await models.VnUser.findById(userId, {fields: ['id']});
|
||||||
|
const recipient = await models.VnUser.findById(recipientId, null);
|
||||||
|
|
||||||
|
// Prevent sending messages to yourself
|
||||||
|
if (recipientId == userId) return false;
|
||||||
|
if (!recipient)
|
||||||
|
throw new Error(`Could not send message "${message}" to worker id ${recipientId} from user ${userId}`);
|
||||||
|
|
||||||
|
if (!isProduction())
|
||||||
|
message = `[Test:Environment to user ${userId}] ` + message;
|
||||||
|
|
||||||
|
const chat = await models.Chat.create({
|
||||||
|
senderFk: sender.id,
|
||||||
|
recipient: `@${recipient.name}`,
|
||||||
|
dated: Date.vnNew(),
|
||||||
|
checkUserStatus: 1,
|
||||||
|
message: message,
|
||||||
|
status: 'sending',
|
||||||
|
attempts: 0
|
||||||
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const models = Self.app.models;
|
await Self.sendCheckingUserStatus(chat);
|
||||||
const sender = await models.VnUser.findById(userId, {fields: ['id']});
|
await Self.updateChat(chat, 'sent');
|
||||||
const error = `Could not send message from user ${userId}`;
|
} catch (error) {
|
||||||
|
await Self.updateChat(chat, 'error', error);
|
||||||
if (!recipientId) throw new Error(error);
|
|
||||||
const recipient = await models.VnUser.findById(recipientId, null);
|
|
||||||
if (!recipient)
|
|
||||||
throw new Error(error);
|
|
||||||
|
|
||||||
// Prevent sending messages to yourself
|
|
||||||
if (recipientId == userId) return false;
|
|
||||||
|
|
||||||
if (!isProduction())
|
|
||||||
message = `[Test:Environment to user ${userId}] ` + message;
|
|
||||||
|
|
||||||
const chat = await models.Chat.create({
|
|
||||||
senderFk: sender.id,
|
|
||||||
recipient: `@${recipient.name}`,
|
|
||||||
dated: Date.vnNew(),
|
|
||||||
checkUserStatus: 1,
|
|
||||||
message: message,
|
|
||||||
status: 'sending',
|
|
||||||
attempts: 0
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
|
||||||
await Self.sendCheckingUserStatus(chat);
|
|
||||||
await Self.updateChat(chat, 'sent');
|
|
||||||
} catch (error) {
|
|
||||||
await Self.updateChat(chat, 'error', error);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} catch (e) {
|
|
||||||
await Self.rawSql(`
|
|
||||||
INSERT INTO util.debug (variable, value)
|
|
||||||
VALUES ('sendCheckingPresence_error', ?)
|
|
||||||
`, [`User: ${userId}, recipient: ${recipientId}, message: ${message}, error: ${e}`]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,14 +20,9 @@ module.exports = Self => {
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
const randStr = Math.random().toString(36).substring(3);
|
const [, , [{collectionFk}]] =
|
||||||
const result = await Self.rawSql(`
|
await Self.rawSql('CALL vn.collection_assign(?, @vCollectionFk); SELECT @vCollectionFk collectionFk',
|
||||||
CALL vn.collection_assign(?, @vCollectionFk);
|
[userId], myOptions);
|
||||||
SELECT @vCollectionFk ?
|
|
||||||
`, [userId, randStr], myOptions);
|
|
||||||
|
|
||||||
// Por si entra en SELECT FOR UPDATE una o varias veces
|
|
||||||
const collectionFk = result.find(item => item[0]?.[randStr] !== undefined)?.[0]?.[randStr];
|
|
||||||
|
|
||||||
if (!collectionFk) throw new UserError('There are not picking tickets');
|
if (!collectionFk) throw new UserError('There are not picking tickets');
|
||||||
await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk], myOptions);
|
await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk], myOptions);
|
||||||
|
|
|
@ -19,15 +19,8 @@ module.exports = Self => {
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
const [info, info2, [{'@vCollectionFk': collectionFk}]] = await Self.rawSql(
|
||||||
const randStr = Math.random().toString(36).substring(3);
|
'CALL vn.collection_getAssigned(?, @vCollectionFk);SELECT @vCollectionFk', [userId], myOptions);
|
||||||
const result = await Self.rawSql(`
|
|
||||||
CALL vn.collection_getAssigned(?, @vCollectionFk);
|
|
||||||
SELECT @vCollectionFk ?
|
|
||||||
`, [userId, randStr], myOptions);
|
|
||||||
|
|
||||||
const collectionFk = result.find(item => item[0]?.[randStr] !== undefined)?.[0]?.[randStr];
|
|
||||||
|
|
||||||
if (!collectionFk) throw new UserError('There are not picking tickets');
|
if (!collectionFk) throw new UserError('There are not picking tickets');
|
||||||
await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk], myOptions);
|
await Self.rawSql('CALL vn.collection_printSticker(?, NULL)', [collectionFk], myOptions);
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,10 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.getSales = async(ctx, collectionOrTicketFk, print, source, options) => {
|
Self.getSales = async(ctx, collectionOrTicketFk, print, source, options) => {
|
||||||
|
const models = Self.app.models;
|
||||||
const userId = ctx.req.accessToken.userId;
|
const userId = ctx.req.accessToken.userId;
|
||||||
const myOptions = {userId};
|
const myOptions = {userId};
|
||||||
|
const $t = ctx.req.__;
|
||||||
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
@ -57,6 +59,22 @@ module.exports = Self => {
|
||||||
|
|
||||||
if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions);
|
if (print) await Self.rawSql('CALL vn.collection_printSticker(?,NULL)', [id], myOptions);
|
||||||
|
|
||||||
|
for (let ticket of tickets) {
|
||||||
|
if (ticket.observaciones) {
|
||||||
|
let observations = ticket.observaciones.split(' ');
|
||||||
|
|
||||||
|
for (let observation of observations) {
|
||||||
|
const salesPerson = ticket.salesPersonFk;
|
||||||
|
if (observation.startsWith('#') || observation.startsWith('@')) {
|
||||||
|
await models.Chat.send(ctx,
|
||||||
|
observation,
|
||||||
|
$t('ticketCommercial', {ticket: ticket.ticketFk, salesPerson})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return getCollection(id, tickets, sales, placements, myOptions);
|
return getCollection(id, tickets, sales, placements, myOptions);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,6 @@ module.exports = Self => {
|
||||||
|
|
||||||
const sales = await Self.rawSql(`
|
const sales = await Self.rawSql(`
|
||||||
SELECT s.ticketFk,
|
SELECT s.ticketFk,
|
||||||
NULL ticketOrder,
|
|
||||||
sgd.saleGroupFk,
|
sgd.saleGroupFk,
|
||||||
s.id saleFk,
|
s.id saleFk,
|
||||||
s.itemFk,
|
s.itemFk,
|
||||||
|
@ -58,15 +57,10 @@ module.exports = Self => {
|
||||||
ROW_NUMBER () OVER (PARTITION BY s.id ORDER BY pickingOrder) currentItemShelving,
|
ROW_NUMBER () OVER (PARTITION BY s.id ORDER BY pickingOrder) currentItemShelving,
|
||||||
COUNT(*) OVER (PARTITION BY s.id ORDER BY s.id) totalItemShelving,
|
COUNT(*) OVER (PARTITION BY s.id ORDER BY s.id) totalItemShelving,
|
||||||
sh.code,
|
sh.code,
|
||||||
p2.code parkingCodePrevia,
|
IFNULL(p2.code, p.code) parkingCode,
|
||||||
p2.pickingOrder pickingOrderPrevia,
|
IFNULL(p2.pickingOrder, p.pickingOrder) pickingOrder,
|
||||||
p.code parkingCode,
|
|
||||||
p.pickingOrder pickingOrder,
|
|
||||||
iss.id itemShelvingSaleFk,
|
iss.id itemShelvingSaleFk,
|
||||||
iss.isPicked,
|
iss.isPicked
|
||||||
iss.itemShelvingFk,
|
|
||||||
st.code stateCode,
|
|
||||||
ac.username
|
|
||||||
FROM ticketCollection tc
|
FROM ticketCollection tc
|
||||||
LEFT JOIN collection c ON c.id = tc.collectionFk
|
LEFT JOIN collection c ON c.id = tc.collectionFk
|
||||||
JOIN sale s ON s.ticketFk = tc.ticketFk
|
JOIN sale s ON s.ticketFk = tc.ticketFk
|
||||||
|
@ -76,17 +70,14 @@ module.exports = Self => {
|
||||||
JOIN item i ON i.id = s.itemFk
|
JOIN item i ON i.id = s.itemFk
|
||||||
JOIN itemShelvingSale iss ON iss.saleFk = s.id
|
JOIN itemShelvingSale iss ON iss.saleFk = s.id
|
||||||
LEFT JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
LEFT JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
||||||
LEFT JOIN shelving sh ON sh.id = ish.shelvingFk
|
LEFT JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||||
LEFT JOIN parking p ON p.id = sh.parkingFk
|
LEFT JOIN parking p ON p.id = sh.parkingFk
|
||||||
LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk
|
LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk
|
||||||
LEFT JOIN origin o ON o.id = i.originFk
|
LEFT JOIN origin o ON o.id = i.originFk
|
||||||
LEFT JOIN state st ON st.id = sg.stateFk
|
|
||||||
LEFT JOIN account.user ac ON ac.id = iss.userFk
|
|
||||||
WHERE tc.collectionFk = ?
|
WHERE tc.collectionFk = ?
|
||||||
GROUP BY s.id, ish.id, p.code, p2.code
|
GROUP BY s.id, ish.id, p.code, p2.code
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT s.ticketFk,
|
SELECT s.ticketFk,
|
||||||
DENSE_RANK() OVER (ORDER BY ss.id),
|
|
||||||
sgd.saleGroupFk,
|
sgd.saleGroupFk,
|
||||||
s.id saleFk,
|
s.id saleFk,
|
||||||
s.itemFk,
|
s.itemFk,
|
||||||
|
@ -104,15 +95,10 @@ module.exports = Self => {
|
||||||
ROW_NUMBER () OVER (PARTITION BY s.id ORDER BY p.pickingOrder),
|
ROW_NUMBER () OVER (PARTITION BY s.id ORDER BY p.pickingOrder),
|
||||||
COUNT(*) OVER (PARTITION BY s.id ORDER BY s.id) ,
|
COUNT(*) OVER (PARTITION BY s.id ORDER BY s.id) ,
|
||||||
sh.code,
|
sh.code,
|
||||||
p2.code,
|
IFNULL(p2.code, p.code),
|
||||||
p2.pickingOrder,
|
IFNULL(p2.pickingOrder, p.pickingOrder),
|
||||||
p.code,
|
|
||||||
p.pickingOrder,
|
|
||||||
iss.id itemShelvingSaleFk,
|
iss.id itemShelvingSaleFk,
|
||||||
iss.isPicked,
|
iss.isPicked
|
||||||
iss.itemShelvingFk,
|
|
||||||
st.code stateCode,
|
|
||||||
ac.username
|
|
||||||
FROM sectorCollection sc
|
FROM sectorCollection sc
|
||||||
JOIN sectorCollectionSaleGroup ss ON ss.sectorCollectionFk = sc.id
|
JOIN sectorCollectionSaleGroup ss ON ss.sectorCollectionFk = sc.id
|
||||||
JOIN saleGroup sg ON sg.id = ss.saleGroupFk
|
JOIN saleGroup sg ON sg.id = ss.saleGroupFk
|
||||||
|
@ -122,12 +108,10 @@ module.exports = Self => {
|
||||||
JOIN item i ON i.id = s.itemFk
|
JOIN item i ON i.id = s.itemFk
|
||||||
JOIN itemShelvingSale iss ON iss.saleFk = s.id
|
JOIN itemShelvingSale iss ON iss.saleFk = s.id
|
||||||
LEFT JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
LEFT JOIN itemShelving ish ON ish.id = iss.itemShelvingFk
|
||||||
LEFT JOIN shelving sh ON sh.id = ish.shelvingFk
|
LEFT JOIN shelving sh ON sh.code = ish.shelvingFk
|
||||||
LEFT JOIN parking p ON p.id = sh.parkingFk
|
LEFT JOIN parking p ON p.id = sh.parkingFk
|
||||||
LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk
|
LEFT JOIN itemColor ic ON ic.itemFk = s.itemFk
|
||||||
LEFT JOIN origin o ON o.id = i.originFk
|
LEFT JOIN origin o ON o.id = i.originFk
|
||||||
LEFT JOIN state st ON st.id = sg.stateFk
|
|
||||||
LEFT JOIN account.user ac ON ac.id = sg.userFk
|
|
||||||
WHERE sc.id = ?
|
WHERE sc.id = ?
|
||||||
AND sgd.saleGroupFk
|
AND sgd.saleGroupFk
|
||||||
GROUP BY s.id, ish.id, p.code, p2.code`, [id, id], myOptions);
|
GROUP BY s.id, ish.id, p.code, p2.code`, [id, id], myOptions);
|
||||||
|
|
|
@ -28,10 +28,9 @@ describe('ticket assign()', () => {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw an error when there are no picking tickets', async() => {
|
it('should throw an error when there is not picking tickets', async() => {
|
||||||
try {
|
try {
|
||||||
await models.Collection.assign(ctx, options);
|
await models.Collection.assign(ctx, options);
|
||||||
fail('Expected an error to be thrown, but none was thrown.');
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
expect(e.message).toEqual('There are not picking tickets');
|
expect(e.message).toEqual('There are not picking tickets');
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,9 @@ describe('ticket assignCollection()', () => {
|
||||||
args: {}
|
args: {}
|
||||||
};
|
};
|
||||||
|
|
||||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({active: ctx.req});
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: ctx.req
|
||||||
|
});
|
||||||
|
|
||||||
options = {transaction: tx};
|
options = {transaction: tx};
|
||||||
tx = await models.Sale.beginTransaction({});
|
tx = await models.Sale.beginTransaction({});
|
||||||
|
@ -23,7 +25,7 @@ describe('ticket assignCollection()', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(async() => {
|
afterEach(async() => {
|
||||||
if (tx) await tx.rollback();
|
await tx.rollback();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw an error when there is not picking tickets', async() => {
|
it('should throw an error when there is not picking tickets', async() => {
|
||||||
|
|
|
@ -4,7 +4,15 @@ describe('collection getSales()', () => {
|
||||||
const collectionOrTicketFk = 999999;
|
const collectionOrTicketFk = 999999;
|
||||||
const print = true;
|
const print = true;
|
||||||
const source = 'CHECKER';
|
const source = 'CHECKER';
|
||||||
const ctx = beforeAll.getCtx();
|
|
||||||
|
beforeAll(() => {
|
||||||
|
ctx = {
|
||||||
|
req: {
|
||||||
|
accessToken: {userId: 9},
|
||||||
|
headers: {origin: 'http://localhost'},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
it('should return a collection with tickets, placements and barcodes settled correctly', async() => {
|
it('should return a collection with tickets, placements and barcodes settled correctly', async() => {
|
||||||
const tx = await models.Collection.beginTransaction({});
|
const tx = await models.Collection.beginTransaction({});
|
||||||
|
|
|
@ -1,7 +1,15 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('collection getTickets()', () => {
|
describe('collection getTickets()', () => {
|
||||||
const ctx = beforeAll.getCtx();
|
let ctx;
|
||||||
|
beforeAll(async() => {
|
||||||
|
ctx = {
|
||||||
|
req: {
|
||||||
|
accessToken: {userId: 9},
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
it('should get tickets, sales and barcodes from collection', async() => {
|
it('should get tickets, sales and barcodes from collection', async() => {
|
||||||
const tx = await models.Collection.beginTransaction({});
|
const tx = await models.Collection.beginTransaction({});
|
||||||
|
|
|
@ -1,7 +1,20 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('setSaleQuantity()', () => {
|
describe('setSaleQuantity()', () => {
|
||||||
beforeAll.mockLoopBackContext();
|
beforeAll(async() => {
|
||||||
|
const activeCtx = {
|
||||||
|
accessToken: {userId: 9},
|
||||||
|
http: {
|
||||||
|
req: {
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should change quantity sale', async() => {
|
it('should change quantity sale', async() => {
|
||||||
const tx = await models.Ticket.beginTransaction({});
|
const tx = await models.Ticket.beginTransaction({});
|
||||||
|
|
|
@ -38,7 +38,7 @@ module.exports = Self => {
|
||||||
{
|
{
|
||||||
arg: 'hasFile',
|
arg: 'hasFile',
|
||||||
type: 'Boolean',
|
type: 'Boolean',
|
||||||
description: 'True if has the original in paper'
|
description: 'True if has an attached file'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'hasFileAttached',
|
arg: 'hasFileAttached',
|
||||||
|
|
|
@ -4,45 +4,21 @@ module.exports = Self => {
|
||||||
/**
|
/**
|
||||||
* Returns basic headers
|
* Returns basic headers
|
||||||
*
|
*
|
||||||
|
* @param {string} cookie - The docuware cookie
|
||||||
* @return {object} - The headers
|
* @return {object} - The headers
|
||||||
*/
|
*/
|
||||||
Self.getOptions = async() => {
|
Self.getOptions = async() => {
|
||||||
const docuwareConfig = await Self.app.models.DocuwareConfig.findOne();
|
const docuwareConfig = await Self.app.models.DocuwareConfig.findOne();
|
||||||
const now = Date.vnNow();
|
|
||||||
let {url, username, password, token, expired} = docuwareConfig;
|
|
||||||
|
|
||||||
if (process.env.NODE_ENV && (!expired || expired < now + 60)) {
|
|
||||||
const {data: {IdentityServiceUrl}} = await axios.get(`${url}/Home/IdentityServiceInfo`);
|
|
||||||
const {data: {token_endpoint}} = await axios.get(`${IdentityServiceUrl}/.well-known/openid-configuration`);
|
|
||||||
const {data} = await axios.post(token_endpoint, {
|
|
||||||
grant_type: 'password',
|
|
||||||
scope: 'docuware.platform',
|
|
||||||
client_id: 'docuware.platform.net.client',
|
|
||||||
username,
|
|
||||||
password
|
|
||||||
}, {headers: {
|
|
||||||
'Accept': 'application/json',
|
|
||||||
'Content-Type': 'application/x-www-form-urlencoded'
|
|
||||||
}});
|
|
||||||
|
|
||||||
const newToken = data.access_token;
|
|
||||||
token = data.token_type + ' ' + newToken;
|
|
||||||
await docuwareConfig.updateAttributes({
|
|
||||||
token,
|
|
||||||
expired: now + data.expires_in
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const headers = {
|
const headers = {
|
||||||
headers: {
|
headers: {
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': token
|
'Cookie': docuwareConfig.cookie
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
url,
|
url: docuwareConfig.url,
|
||||||
headers
|
headers
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,54 +2,87 @@ const axios = require('axios');
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('Docuware core', () => {
|
describe('Docuware core', () => {
|
||||||
const fileCabinetCode = 'deliveryNote';
|
beforeAll(() => {
|
||||||
beforeAll(async() => {
|
|
||||||
process.env.NODE_ENV = 'testing';
|
process.env.NODE_ENV = 'testing';
|
||||||
|
});
|
||||||
|
|
||||||
const docuwareInfo = await models.Docuware.findOne({
|
afterAll(() => {
|
||||||
where: {
|
delete process.env.NODE_ENV;
|
||||||
code: fileCabinetCode
|
});
|
||||||
}
|
|
||||||
|
describe('getOptions()', () => {
|
||||||
|
it('should return url and headers', async() => {
|
||||||
|
const result = await models.Docuware.getOptions();
|
||||||
|
|
||||||
|
expect(result.url).toBeDefined();
|
||||||
|
expect(result.headers).toBeDefined();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
spyOn(axios, 'get').and.callFake(url => {
|
describe('getDialog()', () => {
|
||||||
if (url.includes('IdentityServiceInfo')) return {data: {IdentityServiceUrl: 'IdentityServiceUrl'}};
|
it('should return dialogId', async() => {
|
||||||
if (url.includes('IdentityServiceUrl')) return {data: {token_endpoint: 'token_endpoint'}};
|
const dialogs = {
|
||||||
if (url.includes('dialogs')) {
|
data: {
|
||||||
return {
|
Dialog: [
|
||||||
data: {
|
{
|
||||||
Dialog: [
|
DisplayName: 'find',
|
||||||
{
|
Id: 'getDialogTest'
|
||||||
DisplayName: 'find',
|
}
|
||||||
Id: 'getDialogTest'
|
]
|
||||||
}
|
}
|
||||||
]
|
};
|
||||||
}
|
spyOn(axios, 'get').and.returnValue(new Promise(resolve => resolve(dialogs)));
|
||||||
};
|
const result = await models.Docuware.getDialog('deliveryNote', 'find', 'randomFileCabinetId');
|
||||||
}
|
|
||||||
|
|
||||||
if (url.includes('FileCabinets')) {
|
expect(result).toEqual('getDialogTest');
|
||||||
return {data: {
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('getFileCabinet()', () => {
|
||||||
|
it('should return fileCabinetId', async() => {
|
||||||
|
const code = 'deliveryNote';
|
||||||
|
const docuwareInfo = await models.Docuware.findOne({
|
||||||
|
where: {
|
||||||
|
code
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const dialogs = {
|
||||||
|
data: {
|
||||||
FileCabinet: [
|
FileCabinet: [
|
||||||
{
|
{
|
||||||
Name: docuwareInfo.fileCabinetName,
|
Name: docuwareInfo.fileCabinetName,
|
||||||
Id: 'getFileCabinetTest'
|
Id: 'getFileCabinetTest'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}};
|
}
|
||||||
}
|
};
|
||||||
|
spyOn(axios, 'get').and.returnValue(new Promise(resolve => resolve(dialogs)));
|
||||||
|
const result = await models.Docuware.getFileCabinet(code);
|
||||||
|
|
||||||
|
expect(result).toEqual('getFileCabinetTest');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('get()', () => {
|
||||||
|
it('should return data without parse', async() => {
|
||||||
|
spyOn(models.Docuware, 'getFileCabinet').and.returnValue((new Promise(resolve => resolve(Math.random()))));
|
||||||
|
spyOn(models.Docuware, 'getDialog').and.returnValue((new Promise(resolve => resolve(Math.random()))));
|
||||||
|
const data = {
|
||||||
|
data: {
|
||||||
|
id: 1
|
||||||
|
}
|
||||||
|
};
|
||||||
|
spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(data)));
|
||||||
|
const result = await models.Docuware.get('deliveryNote');
|
||||||
|
|
||||||
|
expect(result.id).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
spyOn(axios, 'post').and.callFake(url => {
|
it('should return data with parse', async() => {
|
||||||
if (url.includes('token_endpoint')) {
|
spyOn(models.Docuware, 'getFileCabinet').and.returnValue((new Promise(resolve => resolve(Math.random()))));
|
||||||
return {data: {
|
spyOn(models.Docuware, 'getDialog').and.returnValue((new Promise(resolve => resolve(Math.random()))));
|
||||||
access_token: 'access_token',
|
const data = {
|
||||||
token_type: 'bearer',
|
data: {
|
||||||
expires_in: 10000
|
|
||||||
}};
|
|
||||||
}
|
|
||||||
if (url.includes('DialogExpression')) {
|
|
||||||
return {data: {
|
|
||||||
Items: [{
|
Items: [{
|
||||||
Fields: [
|
Fields: [
|
||||||
{
|
{
|
||||||
|
@ -70,52 +103,12 @@ describe('Docuware core', () => {
|
||||||
]
|
]
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(() => {
|
|
||||||
delete process.env.NODE_ENV;
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('getOptions()', () => {
|
|
||||||
it('should return url and headers', async() => {
|
|
||||||
const result = await models.Docuware.getOptions();
|
|
||||||
|
|
||||||
expect(result.url).toBeDefined();
|
|
||||||
expect(result.headers).toBeDefined();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Dialog()', () => {
|
|
||||||
it('should return dialogId', async() => {
|
|
||||||
const result = await models.Docuware.getDialog('deliveryNote', 'find', 'randomFileCabinetId');
|
|
||||||
|
|
||||||
expect(result).toEqual('getDialogTest');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('getFileCabinet()', () => {
|
|
||||||
it('should return fileCabinetId', async() => {
|
|
||||||
const result = await models.Docuware.getFileCabinet(fileCabinetCode);
|
|
||||||
|
|
||||||
expect(result).toEqual('getFileCabinetTest');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('get()', () => {
|
|
||||||
it('should return data without parse', async() => {
|
|
||||||
const [result] = await models.Docuware.get('deliveryNote');
|
|
||||||
|
|
||||||
expect(result.firstRequiredField).toEqual(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return data with parse', async() => {
|
|
||||||
const parse = {
|
const parse = {
|
||||||
'firstRequiredField': 'id',
|
'firstRequiredField': 'id',
|
||||||
'secondRequiredField': 'name',
|
'secondRequiredField': 'name',
|
||||||
};
|
};
|
||||||
|
spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(data)));
|
||||||
const [result] = await models.Docuware.get('deliveryNote', null, parse);
|
const [result] = await models.Docuware.get('deliveryNote', null, parse);
|
||||||
|
|
||||||
expect(result.id).toEqual(1);
|
expect(result.id).toEqual(1);
|
||||||
|
@ -126,14 +119,17 @@ describe('Docuware core', () => {
|
||||||
|
|
||||||
describe('getById()', () => {
|
describe('getById()', () => {
|
||||||
it('should return data', async() => {
|
it('should return data', async() => {
|
||||||
spyOn(models.Docuware, 'get');
|
spyOn(models.Docuware, 'getFileCabinet').and.returnValue((new Promise(resolve => resolve(Math.random()))));
|
||||||
await models.Docuware.getById('deliveryNote', 1);
|
spyOn(models.Docuware, 'getDialog').and.returnValue((new Promise(resolve => resolve(Math.random()))));
|
||||||
|
const data = {
|
||||||
|
data: {
|
||||||
|
id: 1
|
||||||
|
}
|
||||||
|
};
|
||||||
|
spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(data)));
|
||||||
|
const result = await models.Docuware.getById('deliveryNote', 1);
|
||||||
|
|
||||||
expect(models.Docuware.get).toHaveBeenCalledWith(
|
expect(result.id).toEqual(1);
|
||||||
'deliveryNote',
|
|
||||||
{condition: [Object({DBName: 'N__ALBAR_N', Value: [1]})]},
|
|
||||||
undefined
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -143,7 +143,7 @@ module.exports = Self => {
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'multipart/form-data',
|
'Content-Type': 'multipart/form-data',
|
||||||
'X-File-ModifiedDate': Date.vnNew(),
|
'X-File-ModifiedDate': Date.vnNew(),
|
||||||
'Authorization': docuwareOptions.headers.headers.Authorization,
|
'Cookie': docuwareOptions.headers.headers.Cookie,
|
||||||
...data.getHeaders()
|
...data.getHeaders()
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,7 +24,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx, userId: ctx.req.accessToken.userId};
|
const options = {transaction: tx, userId: ctx.req.accessToken.userId};
|
||||||
const files = await Self.rawSql('SELECT name, checksum, keyValue FROM edi.fileMultiConfig', null, options);
|
const files = await Self.rawSql('SELECT name, checksum, keyValue FROM edi.fileConfig', null, options);
|
||||||
|
|
||||||
const updatableFiles = [];
|
const updatableFiles = [];
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
|
@ -54,7 +54,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
const tables = await Self.rawSql(`
|
const tables = await Self.rawSql(`
|
||||||
SELECT fileName, toTable, file
|
SELECT fileName, toTable, file
|
||||||
FROM edi.tableMultiConfig
|
FROM edi.tableConfig
|
||||||
WHERE file IN (?)`, [fileNames], options);
|
WHERE file IN (?)`, [fileNames], options);
|
||||||
|
|
||||||
for (const table of tables) {
|
for (const table of tables) {
|
||||||
|
@ -85,9 +85,9 @@ module.exports = Self => {
|
||||||
for (const file of updatableFiles) {
|
for (const file of updatableFiles) {
|
||||||
console.log(`Updating file ${file.name} checksum...`);
|
console.log(`Updating file ${file.name} checksum...`);
|
||||||
await Self.rawSql(`
|
await Self.rawSql(`
|
||||||
UPDATE edi.fileMultiConfig
|
UPDATE edi.fileConfig
|
||||||
SET checksum = ?
|
SET checksum = ?
|
||||||
WHERE name = ?`,
|
WHERE name = ?`,
|
||||||
[file.checksum, file.name], options);
|
[file.checksum, file.name], options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
await Self.rawSql(sqlTemplate, [filePath], options);
|
await Self.rawSql(sqlTemplate, [filePath], options);
|
||||||
await Self.rawSql(`
|
await Self.rawSql(`
|
||||||
UPDATE edi.tableMultiConfig
|
UPDATE edi.tableConfig
|
||||||
SET updated = ?
|
SET updated = ?
|
||||||
WHERE fileName = ?
|
WHERE fileName = ?
|
||||||
`, [Date.vnNew(), baseName], options);
|
`, [Date.vnNew(), baseName], options);
|
||||||
|
|
|
@ -0,0 +1,132 @@
|
||||||
|
const {models} = require('vn-loopback/server/server');
|
||||||
|
|
||||||
|
describe('machineWorker updateInTime()', () => {
|
||||||
|
const itBoss = 104;
|
||||||
|
const davidCharles = 1106;
|
||||||
|
|
||||||
|
beforeAll(async() => {
|
||||||
|
ctx = {
|
||||||
|
req: {
|
||||||
|
accessToken: {},
|
||||||
|
headers: {origin: 'http://localhost'},
|
||||||
|
__: value => value
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should throw an error if the plate does not exist', async() => {
|
||||||
|
const tx = await models.MachineWorker.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
const plate = 'RE-123';
|
||||||
|
ctx.req.accessToken.userId = 1106;
|
||||||
|
try {
|
||||||
|
await models.MachineWorker.updateInTime(ctx, plate, options);
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
const error = e;
|
||||||
|
|
||||||
|
expect(error.message).toContain('the plate does not exist');
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should grab a machine where is not in use', async() => {
|
||||||
|
const tx = await models.MachineWorker.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
const plate = 'RE-003';
|
||||||
|
ctx.req.accessToken.userId = 1107;
|
||||||
|
try {
|
||||||
|
const totalBefore = await models.MachineWorker.find(null, options);
|
||||||
|
await models.MachineWorker.updateInTime(ctx, plate, options);
|
||||||
|
const totalAfter = await models.MachineWorker.find(null, options);
|
||||||
|
|
||||||
|
expect(totalAfter.length).toEqual(totalBefore.length + 1);
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('less than 12h', () => {
|
||||||
|
const plate = 'RE-001';
|
||||||
|
it('should trow an error if it is not himself', async() => {
|
||||||
|
const tx = await models.MachineWorker.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
ctx.req.accessToken.userId = davidCharles;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await models.MachineWorker.updateInTime(ctx, plate, options);
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
const error = e;
|
||||||
|
|
||||||
|
expect(error.message).toContain('This machine is already in use');
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should throw an error if it is himself with a different machine', async() => {
|
||||||
|
const tx = await models.MachineWorker.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
ctx.req.accessToken.userId = itBoss;
|
||||||
|
const plate = 'RE-003';
|
||||||
|
try {
|
||||||
|
await models.MachineWorker.updateInTime(ctx, plate, options);
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
const error = e;
|
||||||
|
|
||||||
|
expect(error.message).toEqual('You are already using a machine');
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should set the out time if it is himself', async() => {
|
||||||
|
const tx = await models.MachineWorker.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
ctx.req.accessToken.userId = itBoss;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const isNotParked = await models.MachineWorker.findOne({
|
||||||
|
where: {workerFk: itBoss}
|
||||||
|
}, options);
|
||||||
|
await models.MachineWorker.updateInTime(ctx, plate, options);
|
||||||
|
const isParked = await models.MachineWorker.findOne({
|
||||||
|
where: {workerFk: itBoss}
|
||||||
|
}, options);
|
||||||
|
|
||||||
|
expect(isNotParked.outTime).toBeNull();
|
||||||
|
expect(isParked.outTime).toBeDefined();
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('equal or more than 12h', () => {
|
||||||
|
const plate = 'RE-002';
|
||||||
|
it('should set the out time and grab the machine', async() => {
|
||||||
|
const tx = await models.MachineWorker.beginTransaction({});
|
||||||
|
const options = {transaction: tx};
|
||||||
|
ctx.req.accessToken.userId = davidCharles;
|
||||||
|
const filter = {
|
||||||
|
where: {workerFk: davidCharles, machineFk: 2}
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
const isNotParked = await models.MachineWorker.findOne(filter, options);
|
||||||
|
const totalBefore = await models.MachineWorker.find(null, options);
|
||||||
|
await models.MachineWorker.updateInTime(ctx, plate, options);
|
||||||
|
const isParked = await models.MachineWorker.findOne(filter, options);
|
||||||
|
const totalAfter = await models.MachineWorker.find(null, options);
|
||||||
|
|
||||||
|
expect(isNotParked.outTime).toBeNull();
|
||||||
|
expect(isParked.outTime).toBeDefined();
|
||||||
|
expect(totalAfter.length).toEqual(totalBefore.length + 1);
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,77 @@
|
||||||
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('updateInTime', {
|
||||||
|
description: 'Updates the corresponding registry if the worker has been registered in the last few hours',
|
||||||
|
accessType: 'WRITE',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
arg: 'plate',
|
||||||
|
type: 'string',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
http: {
|
||||||
|
path: `/updateInTime`,
|
||||||
|
verb: 'POST'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.updateInTime = async(ctx, plate, options) => {
|
||||||
|
const models = Self.app.models;
|
||||||
|
const userId = ctx.req.accessToken.userId;
|
||||||
|
const $t = ctx.req.__;
|
||||||
|
|
||||||
|
let tx;
|
||||||
|
const myOptions = {};
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
if (!myOptions.transaction) {
|
||||||
|
tx = await Self.beginTransaction({});
|
||||||
|
myOptions.transaction = tx;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const machine = await models.Machine.findOne({
|
||||||
|
fields: ['id', 'plate'],
|
||||||
|
where: {plate}
|
||||||
|
}, myOptions);
|
||||||
|
|
||||||
|
if (!machine)
|
||||||
|
throw new UserError($t('the plate does not exist', {plate}));
|
||||||
|
|
||||||
|
const machineWorker = await Self.findOne({
|
||||||
|
where: {
|
||||||
|
or: [{machineFk: machine.id}, {workerFk: userId}],
|
||||||
|
outTime: null,
|
||||||
|
}
|
||||||
|
}, myOptions);
|
||||||
|
|
||||||
|
const {maxHours} = await models.MachineWorkerConfig.findOne({fields: ['maxHours']}, myOptions);
|
||||||
|
const hoursDifference = (Date.vnNow() - machineWorker?.inTime?.getTime() ?? 0) / (60 * 60 * 1000);
|
||||||
|
|
||||||
|
if (machineWorker) {
|
||||||
|
const isHimself = userId == machineWorker.workerFk;
|
||||||
|
const isSameMachine = machine.id == machineWorker.machineFk;
|
||||||
|
|
||||||
|
if (hoursDifference < maxHours && !isHimself)
|
||||||
|
throw new UserError($t('This machine is already in use.'));
|
||||||
|
|
||||||
|
if (hoursDifference < maxHours && isHimself && !isSameMachine)
|
||||||
|
throw new UserError($t('You are already using a machine'));
|
||||||
|
|
||||||
|
await machineWorker.updateAttributes({
|
||||||
|
outTime: Date.vnNew()
|
||||||
|
}, myOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!machineWorker || hoursDifference >= maxHours)
|
||||||
|
await models.MachineWorker.create({machineFk: machine.id, workerFk: userId}, myOptions);
|
||||||
|
|
||||||
|
if (tx) await tx.commit();
|
||||||
|
} catch (e) {
|
||||||
|
if (tx) await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
|
@ -24,13 +24,12 @@ module.exports = Self => {
|
||||||
|
|
||||||
Self.cancelShipment = async expeditionFk => {
|
Self.cancelShipment = async expeditionFk => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
|
|
||||||
const mrw = await models.MrwConfig.findOne();
|
const mrw = await models.MrwConfig.findOne();
|
||||||
const {externalId} = await models.Expedition.findById(expeditionFk);
|
const {externalId} = await models.Expedition.findById(expeditionFk);
|
||||||
const clientType = await models.MrwConfig.getClientType(expeditionFk);
|
const clientType = await models.MrwConfig.getClientType(expeditionFk);
|
||||||
const template = fs.readFileSync(__dirname + '/cancelShipment.ejs', 'utf-8');
|
const template = fs.readFileSync(__dirname + '/cancelShipment.ejs', 'utf-8');
|
||||||
const renderedXml = ejs.render(template, {mrw, externalId, clientType});
|
const renderedXml = ejs.render(template, {mrw, externalId, clientType});
|
||||||
|
|
||||||
await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipment', renderedXml]);
|
|
||||||
const response = await axios.post(mrw.url, renderedXml, {
|
const response = await axios.post(mrw.url, renderedXml, {
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/soap+xml; charset=utf-8'
|
'Content-Type': 'application/soap+xml; charset=utf-8'
|
||||||
|
@ -38,11 +37,9 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const xmlString = response.data;
|
const xmlString = response.data;
|
||||||
await Self.rawSql('CALL util.debugAdd(?,?);', ['cancelShipmentResponse', xmlString]);
|
|
||||||
const parser = new DOMParser();
|
const parser = new DOMParser();
|
||||||
const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
|
const xmlDoc = parser.parseFromString(xmlString, 'text/xml');
|
||||||
|
|
||||||
const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent;
|
const result = xmlDoc.getElementsByTagName('Mensaje')[0].textContent;
|
||||||
return ['no se ha encontrado', 'se ha cancelado correctamente'].some(res => result.toLowerCase().includes(res));
|
return result.toLowerCase().includes('se ha cancelado correctamente');
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,13 +47,13 @@ module.exports = Self => {
|
||||||
co.code countryCode,
|
co.code countryCode,
|
||||||
c.fi,
|
c.fi,
|
||||||
c.name clientName,
|
c.name clientName,
|
||||||
IFNULL(a.mobile, c.mobile) mobile,
|
a.mobile,
|
||||||
DATE_FORMAT(t.shipped, '%d/%m/%Y') created,
|
DATE_FORMAT(t.shipped, '%d/%m/%Y') created,
|
||||||
t.shipped,
|
t.shipped,
|
||||||
CONCAT( e.ticketFk, LPAD(e.counter, mc.counterWidth, '0')) reference,
|
CONCAT( e.ticketFk, LPAD(e.counter, mc.counterWidth, '0')) reference,
|
||||||
LPAD(IF(mw.serviceType IS NULL, ms.serviceType, mw.serviceType), mc.serviceTypeWidth, '0') serviceType,
|
LPAD(IF(mw.serviceType IS NULL, ms.serviceType, mw.serviceType), mc.serviceTypeWidth, '0') serviceType,
|
||||||
IF(mw.weekdays, 'S', 'N') weekDays,
|
IF(mw.weekdays, 'S', 'N') weekDays,
|
||||||
ta.description deliveryObservation
|
oa.description deliveryObservation
|
||||||
FROM expedition e
|
FROM expedition e
|
||||||
JOIN ticket t ON e.ticketFk = t.id
|
JOIN ticket t ON e.ticketFk = t.id
|
||||||
JOIN agencyMode am ON am.id = t.agencyModeFk
|
JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||||
|
@ -62,8 +62,8 @@ module.exports = Self => {
|
||||||
AND mw.weekDays & (1 << WEEKDAY(t.landed))
|
AND mw.weekDays & (1 << WEEKDAY(t.landed))
|
||||||
JOIN client c ON t.clientFk = c.id
|
JOIN client c ON t.clientFk = c.id
|
||||||
JOIN address a ON t.addressFk = a.id
|
JOIN address a ON t.addressFk = a.id
|
||||||
LEFT JOIN ticketObservation ta ON ta.ticketFk = t.id
|
LEFT JOIN addressObservation oa ON oa.addressFk = a.id
|
||||||
AND ta.observationTypeFk IN (SELECT id FROM observationType ot WHERE ot.code = 'agency')
|
AND oa.observationTypeFk IN (SELECT id FROM observationType ot WHERE ot.code = 'delivery')
|
||||||
JOIN province p ON a.provinceFk = p.id
|
JOIN province p ON a.provinceFk = p.id
|
||||||
JOIN country co ON co.id = p.countryFk
|
JOIN country co ON co.id = p.countryFk
|
||||||
JOIN mrwConfig mc
|
JOIN mrwConfig mc
|
||||||
|
|
|
@ -12,8 +12,9 @@ const ticket1 = {
|
||||||
'addressFk': 1,
|
'addressFk': 1,
|
||||||
'agencyModeFk': 999
|
'agencyModeFk': 999
|
||||||
};
|
};
|
||||||
let expedition;
|
|
||||||
const expedition1 = {
|
const expedition1 = {
|
||||||
|
'id': 17,
|
||||||
'agencyModeFk': 999,
|
'agencyModeFk': 999,
|
||||||
'ticketFk': 44,
|
'ticketFk': 44,
|
||||||
'freightItemFk': 71,
|
'freightItemFk': 71,
|
||||||
|
@ -46,7 +47,7 @@ describe('MRWConfig createShipment()', () => {
|
||||||
await createMrwConfig();
|
await createMrwConfig();
|
||||||
|
|
||||||
await models.Ticket.create(ticket1);
|
await models.Ticket.create(ticket1);
|
||||||
expedition = await models.Expedition.create(expedition1);
|
await models.Expedition.create(expedition1);
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async() => {
|
afterAll(async() => {
|
||||||
|
@ -92,7 +93,7 @@ describe('MRWConfig createShipment()', () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
it('should create a shipment and return a base64Binary label', async() => {
|
it('should create a shipment and return a base64Binary label', async() => {
|
||||||
const {file} = await models.MrwConfig.createShipment(expedition.id);
|
const {file} = await models.MrwConfig.createShipment(expedition1.id);
|
||||||
|
|
||||||
expect(file).toEqual(mockBase64Binary);
|
expect(file).toEqual(mockBase64Binary);
|
||||||
});
|
});
|
||||||
|
@ -100,7 +101,7 @@ describe('MRWConfig createShipment()', () => {
|
||||||
it('should fail if mrwConfig has no data', async() => {
|
it('should fail if mrwConfig has no data', async() => {
|
||||||
let error;
|
let error;
|
||||||
await models.MrwConfig.destroyAll();
|
await models.MrwConfig.destroyAll();
|
||||||
await models.MrwConfig.createShipment(expedition.id).catch(e => {
|
await models.MrwConfig.createShipment(expedition1.id).catch(e => {
|
||||||
error = e;
|
error = e;
|
||||||
}).finally(async() => {
|
}).finally(async() => {
|
||||||
expect(error.message).toEqual(`MRW service is not configured`);
|
expect(error.message).toEqual(`MRW service is not configured`);
|
||||||
|
@ -125,7 +126,7 @@ describe('MRWConfig createShipment()', () => {
|
||||||
yesterday.setDate(yesterday.getDate() - 1);
|
yesterday.setDate(yesterday.getDate() - 1);
|
||||||
|
|
||||||
await models.Ticket.updateAll({id: ticket1.id}, {shipped: yesterday});
|
await models.Ticket.updateAll({id: ticket1.id}, {shipped: yesterday});
|
||||||
await models.MrwConfig.createShipment(expedition.id).catch(e => {
|
await models.MrwConfig.createShipment(expedition1.id).catch(e => {
|
||||||
error = e;
|
error = e;
|
||||||
}).finally(async() => {
|
}).finally(async() => {
|
||||||
expect(error.message).toEqual(`This ticket has a shipped date earlier than today`);
|
expect(error.message).toEqual(`This ticket has a shipped date earlier than today`);
|
||||||
|
@ -135,7 +136,7 @@ describe('MRWConfig createShipment()', () => {
|
||||||
|
|
||||||
it('should send mail if you are past the dead line and is not notified today', async() => {
|
it('should send mail if you are past the dead line and is not notified today', async() => {
|
||||||
await models.MrwConfig.updateAll({id: 1}, {expeditionDeadLine: '10:00:00', notified: null});
|
await models.MrwConfig.updateAll({id: 1}, {expeditionDeadLine: '10:00:00', notified: null});
|
||||||
await models.MrwConfig.createShipment(expedition.id);
|
await models.MrwConfig.createShipment(expedition1.id);
|
||||||
const notification = await getLastNotification();
|
const notification = await getLastNotification();
|
||||||
|
|
||||||
expect(notification.notificationFk).toEqual(filter.notificationFk);
|
expect(notification.notificationFk).toEqual(filter.notificationFk);
|
||||||
|
@ -143,7 +144,7 @@ describe('MRWConfig createShipment()', () => {
|
||||||
|
|
||||||
it('should send mail if you are past the dead line and it is notified from another day', async() => {
|
it('should send mail if you are past the dead line and it is notified from another day', async() => {
|
||||||
await models.MrwConfig.updateAll({id: 1}, {expeditionDeadLine: '10:00:00', notified: new Date()});
|
await models.MrwConfig.updateAll({id: 1}, {expeditionDeadLine: '10:00:00', notified: new Date()});
|
||||||
await models.MrwConfig.createShipment(expedition.id);
|
await models.MrwConfig.createShipment(expedition1.id);
|
||||||
const notification = await getLastNotification();
|
const notification = await getLastNotification();
|
||||||
|
|
||||||
expect(notification.notificationFk).toEqual(filter.notificationFk);
|
expect(notification.notificationFk).toEqual(filter.notificationFk);
|
||||||
|
@ -151,7 +152,7 @@ describe('MRWConfig createShipment()', () => {
|
||||||
|
|
||||||
it('should not send mail if you are past the dead line and it is notified', async() => {
|
it('should not send mail if you are past the dead line and it is notified', async() => {
|
||||||
await models.MrwConfig.updateAll({id: 1}, {expeditionDeadLine: '10:00:00', notified: Date.vnNew()});
|
await models.MrwConfig.updateAll({id: 1}, {expeditionDeadLine: '10:00:00', notified: Date.vnNew()});
|
||||||
await models.MrwConfig.createShipment(expedition.id);
|
await models.MrwConfig.createShipment(expedition1.id);
|
||||||
const notification = await getLastNotification();
|
const notification = await getLastNotification();
|
||||||
|
|
||||||
expect(notification).toEqual(null);
|
expect(notification).toEqual(null);
|
||||||
|
|
|
@ -1,112 +0,0 @@
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
|
||||||
const axios = require('axios');
|
|
||||||
|
|
||||||
module.exports = Self => {
|
|
||||||
Self.remoteMethod('optimize', {
|
|
||||||
description: 'Return optimized coords',
|
|
||||||
accessType: 'READ',
|
|
||||||
accepts: [{
|
|
||||||
arg: 'addressIds',
|
|
||||||
type: 'array',
|
|
||||||
required: true
|
|
||||||
}, {
|
|
||||||
arg: 'firstAddressId',
|
|
||||||
type: 'number',
|
|
||||||
required: false
|
|
||||||
}, {
|
|
||||||
arg: 'lastAddressId',
|
|
||||||
type: 'number',
|
|
||||||
required: false
|
|
||||||
}],
|
|
||||||
returns: {
|
|
||||||
type: 'object',
|
|
||||||
root: true
|
|
||||||
},
|
|
||||||
http: {
|
|
||||||
path: `/optimize`,
|
|
||||||
verb: 'GET'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Self.optimize = async(addressIds, firstAddressId, lastAddressId) => {
|
|
||||||
const models = Self.app.models;
|
|
||||||
try {
|
|
||||||
const osrmConfig = await models.OsrmConfig.findOne();
|
|
||||||
if (!osrmConfig) throw new UserError(`OSRM service is not configured`);
|
|
||||||
|
|
||||||
let coords = [];
|
|
||||||
if (firstAddressId) {
|
|
||||||
const address = await models.Address.findById(firstAddressId);
|
|
||||||
if (address.latitude && address.longitude) {
|
|
||||||
coords.push({
|
|
||||||
addressId: address.id,
|
|
||||||
latitude: address.latitude.toFixed(6),
|
|
||||||
longitude: address.longitude.toFixed(6)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const addressId of addressIds) {
|
|
||||||
const address = await models.Address.findById(addressId);
|
|
||||||
if (address.latitude && address.longitude) {
|
|
||||||
coords.push({
|
|
||||||
addressId,
|
|
||||||
latitude: address.latitude.toFixed(6),
|
|
||||||
longitude: address.longitude.toFixed(6)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lastAddressId) {
|
|
||||||
const firstAddress = await models.Address.findById(lastAddressId);
|
|
||||||
if (firstAddress.latitude && firstAddress.longitude) {
|
|
||||||
coords.push({
|
|
||||||
addressId: firstAddress.id,
|
|
||||||
latitude: firstAddress.latitude.toFixed(6),
|
|
||||||
longitude: firstAddress.longitude.toFixed(6)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!coords.length) throw new UserError('No address has coordinates');
|
|
||||||
|
|
||||||
const concatCoords = coords
|
|
||||||
.map(coord => `${coord.longitude},${coord.latitude}`)
|
|
||||||
.join(';');
|
|
||||||
const response = await axios.post(`
|
|
||||||
${osrmConfig.url}/trip/v1/driving/${concatCoords}?source=first&destination=last&roundtrip=true
|
|
||||||
`);
|
|
||||||
const tolerance = osrmConfig.tolerance;
|
|
||||||
for (const waypoint of response.data.waypoints) {
|
|
||||||
const longitude = waypoint.location[0];
|
|
||||||
const latitude = waypoint.location[1];
|
|
||||||
|
|
||||||
const matchedAddress = coords.find(coord =>
|
|
||||||
coord.position === undefined &&
|
|
||||||
Math.abs(coord.latitude - latitude) <= tolerance &&
|
|
||||||
Math.abs(coord.longitude - longitude) <= tolerance
|
|
||||||
);
|
|
||||||
if (matchedAddress)
|
|
||||||
matchedAddress.position = waypoint.waypoint_index;
|
|
||||||
}
|
|
||||||
coords.sort((a, b) => {
|
|
||||||
const posA = a.position !== undefined ? a.position : Infinity;
|
|
||||||
const posB = b.position !== undefined ? b.position : Infinity;
|
|
||||||
return posA - posB;
|
|
||||||
});
|
|
||||||
|
|
||||||
return coords;
|
|
||||||
} catch (err) {
|
|
||||||
switch (err.response?.data?.code) {
|
|
||||||
case 'NoTrips':
|
|
||||||
throw new UserError('No trips found because input coordinates are not connected');
|
|
||||||
case 'NotImplemented':
|
|
||||||
throw new UserError('This request is not supported');
|
|
||||||
case 'InvalidOptions':
|
|
||||||
throw new UserError('Invalid options or too many coordinates');
|
|
||||||
default:
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
|
@ -1,33 +0,0 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
|
||||||
|
|
||||||
describe('osrmConfig optimize()', function() {
|
|
||||||
it('should send coords, receive OSRM response, and return a correctly ordered result', async function() {
|
|
||||||
const result = await models.OsrmConfig.optimize([4, 3], 1, 2);
|
|
||||||
|
|
||||||
// Verifications
|
|
||||||
expect(Array.isArray(result)).toBe(true);
|
|
||||||
expect(result.length).toBe(4);
|
|
||||||
|
|
||||||
// Check the order
|
|
||||||
expect(result[0].addressId).toBe(1);
|
|
||||||
expect(result[1].addressId).toBe(4);
|
|
||||||
expect(result[2].addressId).toBe(3);
|
|
||||||
expect(result[3].addressId).toBe(2);
|
|
||||||
|
|
||||||
// Check the coordinates format
|
|
||||||
expect(result[0].latitude).toBe('10.111111');
|
|
||||||
expect(result[0].longitude).toBe('-74.111111');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should throw an error if no addresses are provided', async function() {
|
|
||||||
let error;
|
|
||||||
try {
|
|
||||||
await models.OsrmConfig.optimize([], null);
|
|
||||||
} catch (e) {
|
|
||||||
error = e;
|
|
||||||
}
|
|
||||||
|
|
||||||
expect(error).toBeDefined();
|
|
||||||
expect(error.message).toBe('No address has coordinates');
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -29,61 +29,35 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.sendToSupport = async(ctx, reason, additionalData) => {
|
Self.sendToSupport = async(ctx, reason, additionalData) => {
|
||||||
const userId = ctx.req.accessToken.userId;
|
|
||||||
const emailUser =
|
const emailUser =
|
||||||
await Self.app.models.EmailUser.findById(userId, {fields: ['email']});
|
await Self.app.models.EmailUser.findById(ctx.req.accessToken.userId, {fields: ['email']});
|
||||||
|
|
||||||
const tableStyle = 'width:100%; border-collapse: collapse; text-align: left;';
|
let html = `<strong>Motivo</strong>:<br/>${reason}<br/>`;
|
||||||
const thStyle = 'padding: 8px; border: 1px solid #ddd; background-color: #f4f4f4;';
|
html += `<strong>Usuario</strong>:<br/>${ctx.req.accessToken.userId} ${emailUser.email}<br/>`;
|
||||||
const tdStyle = 'padding: 8px; border: 1px solid #ddd;';
|
|
||||||
const tdBoldStyle = 'padding: 8px; border: 1px solid #ddd; font-weight: bold;';
|
|
||||||
const subTdStyle = 'padding: 6px; border: 1px solid #ddd;';
|
|
||||||
const subTdBoldStyle = 'padding: 6px; border: 1px solid #ddd; font-weight: bold;';
|
|
||||||
|
|
||||||
let html = `
|
delete additionalData.backError.config.headers.Authorization;
|
||||||
<h2>Motivo: ${reason}</h2>
|
const httpRequest = JSON.parse(additionalData?.httpRequest);
|
||||||
<h3>Usuario: ${userId} ${emailUser.email}</h3>
|
|
||||||
<h3>Additional Data:</h3>
|
|
||||||
<table style="${tableStyle}">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th style="${thStyle}">Clave</th><th style="${thStyle}">Valor</th></tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>`;
|
|
||||||
for (const [key, val] of Object.entries(additionalData)) {
|
|
||||||
if (key !== 'config') {
|
|
||||||
html += `<tr>
|
|
||||||
<td style="${tdBoldStyle}">${key}</td>
|
|
||||||
<td style="${tdStyle}">${parse(val)}</td>
|
|
||||||
</tr>`;
|
|
||||||
} else {
|
|
||||||
html += `<tr>
|
|
||||||
<td style="${tdBoldStyle}">${key}</td>
|
|
||||||
<td style="${tdStyle}">
|
|
||||||
<table style="${tableStyle}">
|
|
||||||
<tbody>`;
|
|
||||||
for (const [confKey, confVal] of Object.entries(val)) {
|
|
||||||
html += `<tr>
|
|
||||||
<td style="${subTdBoldStyle}">${confKey}</td>
|
|
||||||
<td style="${subTdStyle}">${parse(confVal)}</td>
|
|
||||||
</tr>`;
|
|
||||||
}
|
|
||||||
html += `</tbody></table></td></tr>`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
html += `</tbody></table>`;
|
|
||||||
|
|
||||||
const {message, path, name} = additionalData;
|
if (httpRequest)
|
||||||
const err = name && message ? `${name}: ${message}` : name || message || '';
|
delete httpRequest.config.headers.Authorization;
|
||||||
|
additionalData.httpRequest = httpRequest;
|
||||||
|
|
||||||
|
for (const data in additionalData)
|
||||||
|
html += `<strong>${data}</strong>:<br/>${tryParse(additionalData[data])}<br/>`;
|
||||||
|
|
||||||
|
const subjectReason = httpRequest?.data?.error;
|
||||||
await smtp.send({
|
await smtp.send({
|
||||||
to: `${config.app.reportEmail}, ${emailUser.email}`,
|
to: `${config.app.reportEmail}, ${emailUser.email}`,
|
||||||
subject: `[Support-Salix] ${path.split('?')[0]} ${err}`,
|
subject:
|
||||||
|
'[Support-Salix] ' +
|
||||||
|
additionalData?.frontPath + ' ' +
|
||||||
|
subjectReason?.name + ':' +
|
||||||
|
subjectReason?.message,
|
||||||
html
|
html
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
function parse(value) {
|
function tryParse(value) {
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
value = JSON.parse(value);
|
value = JSON.parse(value);
|
||||||
|
|
|
@ -11,6 +11,13 @@ module.exports = Self => {
|
||||||
arg: 'filter',
|
arg: 'filter',
|
||||||
type: 'object',
|
type: 'object',
|
||||||
description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string',
|
description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string',
|
||||||
|
http: {source: 'query'}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'search',
|
||||||
|
type: 'string',
|
||||||
|
description: 'Value to filter',
|
||||||
|
http: {source: 'query'}
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
returns: {
|
returns: {
|
||||||
|
@ -22,11 +29,13 @@ module.exports = Self => {
|
||||||
verb: 'GET',
|
verb: 'GET',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
Self.filter = async(filter = {}, options) => {
|
Self.filter = async(ctx, filter, options) => {
|
||||||
const myOptions = {};
|
const myOptions = {};
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
filter = ctx?.filter ?? {};
|
||||||
|
|
||||||
const conn = Self.dataSource.connector;
|
const conn = Self.dataSource.connector;
|
||||||
const where = buildFilter(filter?.where, (param, value) => {
|
const where = buildFilter(filter?.where, (param, value) => {
|
||||||
switch (param) {
|
switch (param) {
|
||||||
|
@ -41,33 +50,31 @@ module.exports = Self => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}) ?? {};
|
}) ?? {};
|
||||||
delete filter.where;
|
delete ctx.filter.where;
|
||||||
|
|
||||||
const stmts = [];
|
const stmts = [];
|
||||||
let stmt;
|
let stmt;
|
||||||
stmt = new ParameterizedSQL(`
|
stmt = new ParameterizedSQL(`
|
||||||
SELECT
|
SELECT
|
||||||
pc.townFk,
|
pc.townFk,
|
||||||
t.provinceFk,
|
t.provinceFk,
|
||||||
p.countryFk,
|
p.countryFk,
|
||||||
pc.code,
|
pc.code,
|
||||||
t.name as town,
|
t.name as town,
|
||||||
p.name as province,
|
p.name as province,
|
||||||
c.name country
|
c.name country
|
||||||
FROM
|
FROM
|
||||||
postCode pc
|
postCode pc
|
||||||
JOIN town t on t.id = pc.townFk
|
JOIN town t on t.id = pc.townFk
|
||||||
JOIN province p on p.id = t.provinceFk
|
JOIN province p on p.id = t.provinceFk
|
||||||
JOIN country c on c.id = p.countryFk
|
JOIN country c on c.id = p.countryFk
|
||||||
`);
|
`);
|
||||||
|
|
||||||
stmt.merge(conn.makeSuffix({where}));
|
stmt.merge(conn.makeSuffix({where, ...ctx}));
|
||||||
stmt.merge(conn.makeLimit(filter));
|
|
||||||
const itemsIndex = stmts.push(stmt) - 1;
|
const itemsIndex = stmts.push(stmt) - 1;
|
||||||
|
|
||||||
const sql = ParameterizedSQL.join(stmts, ';');
|
const sql = ParameterizedSQL.join(stmts, ';');
|
||||||
const result = await conn.executeStmt(sql, myOptions);
|
const result = await conn.executeStmt(sql, myOptions);
|
||||||
|
|
||||||
return itemsIndex === 0 ? result : result[itemsIndex];
|
return itemsIndex === 0 ? result : result[itemsIndex];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,9 +6,12 @@ describe('Postcode filter()', () => {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const results = await models.Postcode.filter({
|
const ctx = {
|
||||||
|
filter: {
|
||||||
|
},
|
||||||
limit: 1
|
limit: 1
|
||||||
}, options);
|
};
|
||||||
|
const results = await models.Postcode.filter(ctx, options);
|
||||||
|
|
||||||
expect(results.length).toEqual(1);
|
expect(results.length).toEqual(1);
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
|
@ -23,13 +26,16 @@ describe('Postcode filter()', () => {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const results = await models.Postcode.filter({
|
const ctx = {
|
||||||
where: {
|
filter: {
|
||||||
search: 46,
|
where: {
|
||||||
}
|
search: 46,
|
||||||
}, options);
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const results = await models.Postcode.filter(ctx, options);
|
||||||
|
|
||||||
expect(results.length).toEqual(5);
|
expect(results.length).toEqual(4);
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
|
@ -42,9 +48,14 @@ describe('Postcode filter()', () => {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const results = await models.Postcode.filter({where: {
|
const ctx = {
|
||||||
search: 'Alz',
|
filter: {
|
||||||
}}, options);
|
where: {
|
||||||
|
search: 'Alz',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const results = await models.Postcode.filter(ctx, options);
|
||||||
|
|
||||||
expect(results.length).toEqual(1);
|
expect(results.length).toEqual(1);
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
|
@ -59,11 +70,16 @@ describe('Postcode filter()', () => {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const results = await models.Postcode.filter({where: {
|
const ctx = {
|
||||||
search: 'one',
|
filter: {
|
||||||
}}, options);
|
where: {
|
||||||
|
search: 'one',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const results = await models.Postcode.filter(ctx, options);
|
||||||
|
|
||||||
expect(results.length).toEqual(5);
|
expect(results.length).toEqual(4);
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
|
@ -76,11 +92,14 @@ describe('Postcode filter()', () => {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const results = await models.Postcode.filter({
|
const ctx = {
|
||||||
where: {
|
filter: {
|
||||||
search: 'Ec',
|
where: {
|
||||||
}
|
search: 'Ec',
|
||||||
}, options);
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const results = await models.Postcode.filter(ctx, options);
|
||||||
|
|
||||||
expect(results.length).toEqual(1);
|
expect(results.length).toEqual(1);
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
|
|
|
@ -1,7 +1,22 @@
|
||||||
const {models} = require('vn-loopback/server/server');
|
const {models} = require('vn-loopback/server/server');
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('getStarredModules()', () => {
|
describe('getStarredModules()', () => {
|
||||||
const ctx = beforeAll.getCtx();
|
const activeCtx = {
|
||||||
|
accessToken: {userId: 9},
|
||||||
|
http: {
|
||||||
|
req: {
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const ctx = {req: activeCtx};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it(`should return the starred modules for a given user`, async() => {
|
it(`should return the starred modules for a given user`, async() => {
|
||||||
const newStarred = await models.StarredModule.create({workerFk: 9, moduleFk: 'customer', position: 1});
|
const newStarred = await models.StarredModule.create({workerFk: 9, moduleFk: 'customer', position: 1});
|
||||||
|
|
|
@ -1,8 +1,24 @@
|
||||||
const {models} = require('vn-loopback/server/server');
|
const {models} = require('vn-loopback/server/server');
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('setPosition()', () => {
|
describe('setPosition()', () => {
|
||||||
const ctx = beforeAll.getCtx();
|
const activeCtx = {
|
||||||
beforeAll.mockLoopBackContext();
|
accessToken: {userId: 9},
|
||||||
|
http: {
|
||||||
|
req: {
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const ctx = {
|
||||||
|
req: activeCtx
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should increase the orders module position by replacing it with clients and vice versa', async() => {
|
it('should increase the orders module position by replacing it with clients and vice versa', async() => {
|
||||||
const tx = await models.StarredModule.beginTransaction({});
|
const tx = await models.StarredModule.beginTransaction({});
|
||||||
|
|
|
@ -1,7 +1,24 @@
|
||||||
const {models} = require('vn-loopback/server/server');
|
const {models} = require('vn-loopback/server/server');
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
|
||||||
describe('toggleStarredModule()', () => {
|
describe('toggleStarredModule()', () => {
|
||||||
const ctx = beforeAll.getCtx();
|
const activeCtx = {
|
||||||
|
accessToken: {userId: 9},
|
||||||
|
http: {
|
||||||
|
req: {
|
||||||
|
headers: {origin: 'http://localhost'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const ctx = {
|
||||||
|
req: activeCtx
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
|
active: activeCtx
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should create a new starred module and then remove it by calling the method again with same args', async() => {
|
it('should create a new starred module and then remove it by calling the method again with same args', async() => {
|
||||||
const starredModule = await models.StarredModule.toggleStarredModule(ctx, 'order');
|
const starredModule = await models.StarredModule.toggleStarredModule(ctx, 'order');
|
||||||
|
@ -9,7 +26,7 @@ describe('toggleStarredModule()', () => {
|
||||||
|
|
||||||
expect(starredModules.length).toEqual(1);
|
expect(starredModules.length).toEqual(1);
|
||||||
expect(starredModule.moduleFk).toEqual('order');
|
expect(starredModule.moduleFk).toEqual('order');
|
||||||
expect(starredModule.workerFk).toEqual(ctx.req.accessToken.userId);
|
expect(starredModule.workerFk).toEqual(activeCtx.accessToken.userId);
|
||||||
expect(starredModule.position).toEqual(starredModules.length);
|
expect(starredModule.position).toEqual(starredModules.length);
|
||||||
|
|
||||||
await models.StarredModule.toggleStarredModule(ctx, 'order');
|
await models.StarredModule.toggleStarredModule(ctx, 'order');
|
||||||
|
|
|
@ -22,7 +22,7 @@ module.exports = Self => {
|
||||||
const url = await Self.app.models.Url.findOne({
|
const url = await Self.app.models.Url.findOne({
|
||||||
where: {
|
where: {
|
||||||
appName,
|
appName,
|
||||||
environment: process.env.NODE_ENV || 'development'
|
environment: process.env.NODE_ENV || 'dev'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return url?.url;
|
return url?.url;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('userConfig getUserConfig()', () => {
|
describe('userConfig getUserConfig()', () => {
|
||||||
const ctx = beforeAll.getCtx();
|
|
||||||
it(`should return the configuration data of a given user`, async() => {
|
it(`should return the configuration data of a given user`, async() => {
|
||||||
const tx = await models.Item.beginTransaction({});
|
const tx = await models.Item.beginTransaction({});
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const ctx = {req: {accessToken: {userId: 9}}};
|
||||||
const result = await models.UserConfig.getUserConfig(ctx, options);
|
const result = await models.UserConfig.getUserConfig(ctx, options);
|
||||||
|
|
||||||
expect(result.warehouseFk).toEqual(1);
|
expect(result.warehouseFk).toEqual(1);
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
module.exports = Self => {
|
|
||||||
Self.remoteMethodCtx('killSession', {
|
|
||||||
description: 'Kill session',
|
|
||||||
accepts: [{
|
|
||||||
arg: 'userId',
|
|
||||||
type: 'integer',
|
|
||||||
description: 'The user id',
|
|
||||||
required: true,
|
|
||||||
}, {
|
|
||||||
arg: 'created',
|
|
||||||
type: 'date',
|
|
||||||
description: 'The created time',
|
|
||||||
required: true,
|
|
||||||
}],
|
|
||||||
accessType: 'WRITE',
|
|
||||||
http: {
|
|
||||||
path: `/killSession`,
|
|
||||||
verb: 'POST'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Self.killSession = async function(ctx, userId, created) {
|
|
||||||
await Self.app.models.VnUser.userSecurity(ctx, ctx.req.accessToken.userId);
|
|
||||||
const tokens = await Self.app.models.AccessToken.find({where: {userId, created}});
|
|
||||||
if (!tokens?.length) return;
|
|
||||||
for (const token of tokens)
|
|
||||||
await Self.app.models.AccessToken.deleteById(token.id);
|
|
||||||
};
|
|
||||||
};
|
|
|
@ -19,7 +19,7 @@ module.exports = Self => {
|
||||||
if (acl.principalType == 'ROLE' && acl.permission == 'ALLOW') {
|
if (acl.principalType == 'ROLE' && acl.permission == 'ALLOW') {
|
||||||
const staticAcl = {
|
const staticAcl = {
|
||||||
model: model.name,
|
model: model.name,
|
||||||
property: acl.property,
|
property: '*',
|
||||||
accessType: acl.accessType,
|
accessType: acl.accessType,
|
||||||
permission: acl.permission,
|
permission: acl.permission,
|
||||||
principalType: acl.principalType,
|
principalType: acl.principalType,
|
||||||
|
|
|
@ -30,10 +30,16 @@ module.exports = Self => {
|
||||||
|
|
||||||
// Schedule to remove current token
|
// Schedule to remove current token
|
||||||
setTimeout(async() => {
|
setTimeout(async() => {
|
||||||
|
let exists;
|
||||||
try {
|
try {
|
||||||
await Self.logout(token.id);
|
exists = await models.AccessToken.findById(token.id);
|
||||||
|
exists && await Self.logout(token.id);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// FIXME: Crash if do throw new Error(error)
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(error);
|
||||||
|
const body = {error: error.message, now: Date.now(), userId: token?.userId ?? null, exists};
|
||||||
|
await handleError(body);
|
||||||
|
throw new Error(error);
|
||||||
}
|
}
|
||||||
}, courtesyTime * 1000);
|
}, courtesyTime * 1000);
|
||||||
|
|
||||||
|
@ -47,20 +53,14 @@ module.exports = Self => {
|
||||||
|
|
||||||
return {id: accessToken.id, ttl: accessToken.ttl};
|
return {id: accessToken.id, ttl: accessToken.ttl};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const body = {
|
const body = {error: error.message, now: Date.now(), userId: token?.userId ?? null, createTokenOptions, isNotExceeded};
|
||||||
error: error.message,
|
await handleError(body);
|
||||||
userId: token?.userId ?? null,
|
|
||||||
token: token?.id,
|
|
||||||
scopes: token?.scopes,
|
|
||||||
createTokenOptions,
|
|
||||||
isNotExceeded
|
|
||||||
};
|
|
||||||
await handleError(JSON.stringify(body));
|
|
||||||
throw new Error(error);
|
throw new Error(error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
async function handleError(body) {
|
async function handleError(body, tag = 'renewToken') {
|
||||||
await models.Application.rawSql('CALL util.debugAdd(?,?);', ['renewToken', body]);
|
body = JSON.stringify(body);
|
||||||
|
await models.Application.rawSql('CALL util.debugAdd(?,?);', [tag, body]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,9 +67,7 @@ module.exports = Self => {
|
||||||
if (vnUser.twoFactor === 'email') {
|
if (vnUser.twoFactor === 'email') {
|
||||||
const $ = Self.app.models;
|
const $ = Self.app.models;
|
||||||
|
|
||||||
const min = 100000;
|
const code = String(Math.floor(Math.random() * 999999));
|
||||||
const max = 999999;
|
|
||||||
const code = String(Math.floor(Math.random() * (max - min + 1)) + min);
|
|
||||||
const maxTTL = ((60 * 1000) * 5); // 5 min
|
const maxTTL = ((60 * 1000) * 5); // 5 min
|
||||||
await $.AuthCode.upsertWithWhere({userFk: vnUser.id}, {
|
await $.AuthCode.upsertWithWhere({userFk: vnUser.id}, {
|
||||||
userFk: vnUser.id,
|
userFk: vnUser.id,
|
||||||
|
|
|
@ -72,9 +72,9 @@ describe('Renew Token', () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(error).toBeDefined();
|
expect(error).toBeDefined();
|
||||||
|
const query = 'SELECT * FROM util.debug';
|
||||||
|
|
||||||
const query = 'SELECT * FROM util.debug WHERE variable = "renewToken"';
|
const debugLog = await models.Application.rawSql(query, null);
|
||||||
const debugLog = await models.Application.rawSql(query);
|
|
||||||
|
|
||||||
expect(debugLog.length).toEqual(1);
|
expect(debugLog.length).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
|
@ -22,12 +22,8 @@ module.exports = Self => {
|
||||||
description: 'The user email'
|
description: 'The user email'
|
||||||
}, {
|
}, {
|
||||||
arg: 'lang',
|
arg: 'lang',
|
||||||
type: 'any',
|
type: 'string',
|
||||||
description: 'The user lang'
|
description: 'The user lang'
|
||||||
}, {
|
|
||||||
arg: 'twoFactor',
|
|
||||||
type: 'any',
|
|
||||||
description: 'The user twoFactor'
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
http: {
|
http: {
|
||||||
|
@ -36,8 +32,8 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.updateUser = async(ctx, id, name, nickname, email, lang, twoFactor) => {
|
Self.updateUser = async(ctx, id, name, nickname, email, lang) => {
|
||||||
await Self.userSecurity(ctx, id);
|
await Self.userSecurity(ctx, id);
|
||||||
await Self.upsertWithWhere({id}, {name, nickname, email, lang, twoFactor});
|
await Self.upsertWithWhere({id}, {name, nickname, email, lang});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -58,7 +58,7 @@ module.exports = Self => {
|
||||||
fields: ['name', 'twoFactor']
|
fields: ['name', 'twoFactor']
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
if (user.name.toLowerCase() !== username.toLowerCase())
|
if (user.name !== username)
|
||||||
throw new UserError('Authentication failed');
|
throw new UserError('Authentication failed');
|
||||||
|
|
||||||
await authCode.destroy(myOptions);
|
await authCode.destroy(myOptions);
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
module.exports = Self => {
|
|
||||||
Self.remoteMethodCtx('add', {
|
|
||||||
description: 'Add activity if the activity is different or is the same but have exceed time for break',
|
|
||||||
accessType: 'WRITE',
|
|
||||||
accepts: [
|
|
||||||
{
|
|
||||||
arg: 'code',
|
|
||||||
type: 'string',
|
|
||||||
description: 'Code for activity'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
arg: 'model',
|
|
||||||
type: 'string',
|
|
||||||
description: 'Origin model from insert'
|
|
||||||
},
|
|
||||||
|
|
||||||
],
|
|
||||||
http: {
|
|
||||||
path: `/add`,
|
|
||||||
verb: 'POST'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Self.add = async(ctx, code, model, options) => {
|
|
||||||
const userId = ctx.req.accessToken.userId;
|
|
||||||
const myOptions = {};
|
|
||||||
|
|
||||||
if (typeof options == 'object')
|
|
||||||
Object.assign(myOptions, options);
|
|
||||||
|
|
||||||
return await Self.rawSql(`
|
|
||||||
INSERT INTO workerActivity (workerFk, workerActivityTypeFk, model)
|
|
||||||
SELECT ?, ?, ?
|
|
||||||
FROM workerTimeControlConfig wtcc
|
|
||||||
LEFT JOIN (
|
|
||||||
SELECT wa.workerFk,
|
|
||||||
wa.created,
|
|
||||||
wat.code
|
|
||||||
FROM workerActivity wa
|
|
||||||
LEFT JOIN workerActivityType wat ON wat.code = wa.workerActivityTypeFk
|
|
||||||
WHERE wa.workerFk = ?
|
|
||||||
ORDER BY wa.created DESC
|
|
||||||
LIMIT 1
|
|
||||||
) sub ON TRUE
|
|
||||||
WHERE sub.workerFk IS NULL
|
|
||||||
OR sub.code <> ?
|
|
||||||
OR TIMESTAMPDIFF(SECOND, sub.created, util.VN_NOW()) > wtcc.dayBreak;`
|
|
||||||
, [userId, code, model, userId, code], myOptions);
|
|
||||||
};
|
|
||||||
};
|
|
|
@ -1,30 +0,0 @@
|
||||||
const {models} = require('vn-loopback');
|
|
||||||
|
|
||||||
describe('workerActivity insert()', () => {
|
|
||||||
const ctx = beforeAll.getCtx(1106);
|
|
||||||
|
|
||||||
it('should insert in workerActivity', async() => {
|
|
||||||
const tx = await models.WorkerActivity.beginTransaction({});
|
|
||||||
let count = 0;
|
|
||||||
const options = {transaction: tx};
|
|
||||||
|
|
||||||
try {
|
|
||||||
await models.WorkerActivityType.create(
|
|
||||||
{'code': 'TEST', 'description': 'TEST'}, options
|
|
||||||
);
|
|
||||||
|
|
||||||
await models.WorkerActivity.add(ctx, 'TEST', 'APP', options);
|
|
||||||
|
|
||||||
count = await models.WorkerActivity.count(
|
|
||||||
{'workerFK': 1106}, options
|
|
||||||
);
|
|
||||||
|
|
||||||
await tx.rollback();
|
|
||||||
} catch (e) {
|
|
||||||
await tx.rollback();
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
|
|
||||||
expect(count).toEqual(1);
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -28,9 +28,6 @@
|
||||||
"Company": {
|
"Company": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"Config": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"Continent": {
|
"Continent": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
@ -79,19 +76,19 @@
|
||||||
"ImageCollectionSize": {
|
"ImageCollectionSize": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"ImageConfig": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"ImageContainer": {
|
"ImageContainer": {
|
||||||
"dataSource": "imageStorage"
|
"dataSource": "imageStorage"
|
||||||
},
|
},
|
||||||
"Language": {
|
"Language": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"OsrmConfig": {
|
"Machine": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"Machine": {
|
"MachineWorker": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"MachineWorkerConfig": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"MobileAppVersionControl": {
|
"MobileAppVersionControl": {
|
||||||
|
@ -118,9 +115,6 @@
|
||||||
"NotificationSubscription": {
|
"NotificationSubscription": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"OrmConfig": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"Province": {
|
"Province": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
@ -130,15 +124,9 @@
|
||||||
"Payment": {
|
"Payment": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"PbxConfig": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"Postcode": {
|
"Postcode": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"Prefix": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"ReferenceRate": {
|
"ReferenceRate": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
@ -148,12 +136,6 @@
|
||||||
"StarredModule": {
|
"StarredModule": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"SaySimpleCountry": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"SaySimpleConfig": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"TempContainer": {
|
"TempContainer": {
|
||||||
"dataSource": "tempStorage"
|
"dataSource": "tempStorage"
|
||||||
},
|
},
|
||||||
|
@ -184,15 +166,9 @@
|
||||||
"PrintConfig": {
|
"PrintConfig": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"QueueMember": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"ViaexpressConfig": {
|
"ViaexpressConfig": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"VnToken": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"VnUser": {
|
"VnUser": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,10 +16,6 @@
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
|
||||||
"hasDailyInvoice": {
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "Indicates if the autonomy has daily invoice enabled"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Config",
|
|
||||||
"base": "VnModel",
|
|
||||||
"options": {
|
|
||||||
"mysql": {
|
|
||||||
"table": "config"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"inventoried": {
|
|
||||||
"type": "date"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"acls": [
|
|
||||||
{
|
|
||||||
"accessType": "READ",
|
|
||||||
"principalType": "ROLE",
|
|
||||||
"principalId": "$authenticated",
|
|
||||||
"permission": "ALLOW"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -28,10 +28,6 @@
|
||||||
},
|
},
|
||||||
"continentFk": {
|
"continentFk": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
|
||||||
"hasDailyInvoice": {
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "Indicates if the autonomy has daily invoice enabled"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
@ -44,11 +40,6 @@
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Continent",
|
"model": "Continent",
|
||||||
"foreignKey": "continentFk"
|
"foreignKey": "continentFk"
|
||||||
},
|
|
||||||
"saySimpleCountry": {
|
|
||||||
"type": "hasOne",
|
|
||||||
"model": "SaySimpleCountry",
|
|
||||||
"foreignKey": "countryFk"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"acls": [
|
"acls": [
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"base": "VnModel",
|
"base": "VnModel",
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "salix.defaultViewMultiConfig"
|
"table": "salix.defaultViewConfig"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
|
@ -16,17 +16,17 @@
|
||||||
"url": {
|
"url": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"token": {
|
"cookie": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
|
||||||
"username": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"password": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"expired":{
|
|
||||||
"type": "number"
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"acls": [
|
||||||
|
{
|
||||||
|
"property": "*",
|
||||||
|
"accessType": "*",
|
||||||
|
"principalType": "ROLE",
|
||||||
|
"principalId": "$everyone",
|
||||||
|
"permission": "ALLOW"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
{
|
|
||||||
"name": "ImageConfig",
|
|
||||||
"base": "VnModel",
|
|
||||||
"options": {
|
|
||||||
"mysql": {
|
|
||||||
"table": "hedera.imageConfig"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"url": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"acls": [
|
|
||||||
{
|
|
||||||
"accessType": "READ",
|
|
||||||
"principalType": "ROLE",
|
|
||||||
"principalId": "$authenticated",
|
|
||||||
"permission": "ALLOW"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"name": "MachineWorkerConfig",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "vn.machineWorkerConfig"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true
|
||||||
|
},
|
||||||
|
"maxHours": {
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
module.exports = Self => {
|
||||||
|
require('../methods/machine-worker/updateInTime')(Self);
|
||||||
|
};
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"name": "MachineWorker",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "vn.machineWorker"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true
|
||||||
|
},
|
||||||
|
"workerFk": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"machineFk": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"inTime": {
|
||||||
|
"type": "date",
|
||||||
|
"mysql": {
|
||||||
|
"columnName": "inTimed"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"outTime": {
|
||||||
|
"type": "date",
|
||||||
|
"mysql": {
|
||||||
|
"columnName": "outTimed"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,26 +0,0 @@
|
||||||
{
|
|
||||||
"name": "OrmConfig",
|
|
||||||
"base": "VnModel",
|
|
||||||
"options": {
|
|
||||||
"mysql": {
|
|
||||||
"table": "ormConfig"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"type": "number",
|
|
||||||
"id": true
|
|
||||||
},
|
|
||||||
"selectLimit": {
|
|
||||||
"type": "number"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"acls": [
|
|
||||||
{
|
|
||||||
"accessType": "*",
|
|
||||||
"principalType": "ROLE",
|
|
||||||
"principalId": "$authenticated",
|
|
||||||
"permission": "ALLOW"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
module.exports = Self => {
|
|
||||||
require('../methods/osrm-config/optimize')(Self);
|
|
||||||
};
|
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
{
|
|
||||||
"name": "OsrmConfig",
|
|
||||||
"base": "VnModel",
|
|
||||||
"options": {
|
|
||||||
"mysql": {
|
|
||||||
"table": "osrmConfig"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"type": "number",
|
|
||||||
"id": true,
|
|
||||||
"required": true
|
|
||||||
},
|
|
||||||
"url": {
|
|
||||||
"type": "string",
|
|
||||||
"required": true
|
|
||||||
},
|
|
||||||
"tolerance": {
|
|
||||||
"type": "number",
|
|
||||||
"required": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -52,7 +52,7 @@
|
||||||
},
|
},
|
||||||
"payMethod": {
|
"payMethod": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "PayMethod",
|
"model": "PayMethodFk",
|
||||||
"foreignKey": "payMethodFk"
|
"foreignKey": "payMethodFk"
|
||||||
},
|
},
|
||||||
"company": {
|
"company": {
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
{
|
|
||||||
"name": "PbxConfig",
|
|
||||||
"base": "VnModel",
|
|
||||||
"options": {
|
|
||||||
"mysql": {
|
|
||||||
"table": "pbx.config"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"type": "number",
|
|
||||||
"id": true
|
|
||||||
},
|
|
||||||
"defaultPrefix": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"acls": [
|
|
||||||
{
|
|
||||||
"property": "*",
|
|
||||||
"accessType": "READ",
|
|
||||||
"principalType": "ROLE",
|
|
||||||
"principalId": "employee",
|
|
||||||
"permission": "ALLOW"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -9,8 +9,7 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"code": {
|
"code": {
|
||||||
"id": true,
|
"id": true,
|
||||||
"type": "string",
|
"type": "string"
|
||||||
"required": true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Prefix",
|
|
||||||
"base": "VnModel",
|
|
||||||
"options": {
|
|
||||||
"mysql": {
|
|
||||||
"table": "pbx.prefix"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"country": {
|
|
||||||
"type": "string",
|
|
||||||
"id": true
|
|
||||||
},
|
|
||||||
"prefix": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"acls": [
|
|
||||||
{
|
|
||||||
"property": "*",
|
|
||||||
"accessType": "READ",
|
|
||||||
"principalType": "ROLE",
|
|
||||||
"principalId": "employee",
|
|
||||||
"permission": "ALLOW"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -20,9 +20,6 @@
|
||||||
},
|
},
|
||||||
"backupPrinterNotificationDelay": {
|
"backupPrinterNotificationDelay": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
|
||||||
"itemOrderReviewHours": {
|
|
||||||
"type": "number"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,9 +16,6 @@
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
|
||||||
"autonomyFk": {
|
|
||||||
"type": "number"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
{
|
|
||||||
"name": "QueueMember",
|
|
||||||
"base": "VnModel",
|
|
||||||
"options": {
|
|
||||||
"mysql": {
|
|
||||||
"table": "pbx.queueMember"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"type": "number",
|
|
||||||
"id": true
|
|
||||||
},
|
|
||||||
"queue": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"extension": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"relations": {
|
|
||||||
"queueRelation": {
|
|
||||||
"type": "belongsTo",
|
|
||||||
"model": "Queue",
|
|
||||||
"foreignKey": "queue",
|
|
||||||
"primaryKey": "name"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"acls": [
|
|
||||||
{
|
|
||||||
"property": "*",
|
|
||||||
"accessType": "READ",
|
|
||||||
"principalType": "ROLE",
|
|
||||||
"principalId": "employee",
|
|
||||||
"permission": "ALLOW"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
{
|
|
||||||
"name": "SaySimpleConfig",
|
|
||||||
"base": "VnModel",
|
|
||||||
"options": {
|
|
||||||
"mysql": {
|
|
||||||
"table": "saySimpleConfig"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"type": "number",
|
|
||||||
"id": true
|
|
||||||
},
|
|
||||||
"url": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"defaultChannel": {
|
|
||||||
"type": "number"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"acls": [
|
|
||||||
{
|
|
||||||
"accessType": "READ",
|
|
||||||
"principalType": "ROLE",
|
|
||||||
"principalId": "$authenticated",
|
|
||||||
"permission": "ALLOW"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
{
|
|
||||||
"name": "SaySimpleCountry",
|
|
||||||
"base": "VnModel",
|
|
||||||
"options": {
|
|
||||||
"mysql": {
|
|
||||||
"table": "saySimpleCountry"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"countryFk": {
|
|
||||||
"type": "number",
|
|
||||||
"id": true
|
|
||||||
},
|
|
||||||
"channel": {
|
|
||||||
"type": "number"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"acls": [
|
|
||||||
{
|
|
||||||
"accessType": "READ",
|
|
||||||
"principalType": "ROLE",
|
|
||||||
"principalId": "$authenticated",
|
|
||||||
"permission": "ALLOW"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,13 +1,12 @@
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
describe('loopback model MailAliasAccount', () => {
|
describe('loopback model MailAliasAccount', () => {
|
||||||
const ctx = beforeAll.getCtx();
|
|
||||||
it('should add a mail Alias', async() => {
|
it('should add a mail Alias', async() => {
|
||||||
const tx = await models.MailAliasAccount.beginTransaction({});
|
const tx = await models.MailAliasAccount.beginTransaction({});
|
||||||
let error;
|
let error;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx, ctx};
|
const options = {transaction: tx, accessToken: {userId: 9}};
|
||||||
await models.MailAliasAccount.create({mailAlias: 2, account: 5}, options);
|
await models.MailAliasAccount.create({mailAlias: 2, account: 5}, options);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
|
@ -24,7 +23,7 @@ describe('loopback model MailAliasAccount', () => {
|
||||||
let error;
|
let error;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx, ctx};
|
const options = {transaction: tx, accessToken: {userId: 9}};
|
||||||
await models.MailAliasAccount.create({mailAlias: 3, account: 5}, options);
|
await models.MailAliasAccount.create({mailAlias: 3, account: 5}, options);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
|
|
|
@ -12,8 +12,7 @@
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string"
|
||||||
"required": true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"base": "VnModel",
|
"base": "VnModel",
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "userMultiConfig"
|
"table": "userConfig"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
const vnModel = require('vn-loopback/common/models/vn-model');
|
|
||||||
module.exports = function(Self) {
|
|
||||||
vnModel(Self);
|
|
||||||
require('../methods/vn-token/killSession')(Self);
|
|
||||||
};
|
|
|
@ -1,22 +0,0 @@
|
||||||
{
|
|
||||||
"name": "VnToken",
|
|
||||||
"base": "AccessToken",
|
|
||||||
"options": {
|
|
||||||
"mysql": {
|
|
||||||
"table": "salix.AccessToken"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"properties": {
|
|
||||||
"created": {
|
|
||||||
"type": "date"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"relations": {
|
|
||||||
"user": {
|
|
||||||
"type": "belongsTo",
|
|
||||||
"model": "VnUser",
|
|
||||||
"foreignKey": "userId"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"hidden": ["id"]
|
|
||||||
}
|
|
|
@ -101,10 +101,9 @@ module.exports = function(Self) {
|
||||||
const headers = httpRequest.headers;
|
const headers = httpRequest.headers;
|
||||||
const origin = headers.origin;
|
const origin = headers.origin;
|
||||||
|
|
||||||
const defaultHash = '!/reset-password?access_token=$token$';
|
const defaultHash = '/reset-password?access_token=$token$';
|
||||||
const recoverHashes = {
|
const recoverHashes = {
|
||||||
hedera: '!verificationToken=$token$',
|
hedera: 'verificationToken=$token$'
|
||||||
lilium: '/resetPassword?access_token=$token$'
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const app = info.options?.app;
|
const app = info.options?.app;
|
||||||
|
@ -116,7 +115,7 @@ module.exports = function(Self) {
|
||||||
const params = {
|
const params = {
|
||||||
recipient: info.email,
|
recipient: info.email,
|
||||||
lang: user.lang,
|
lang: user.lang,
|
||||||
url: origin + '/#' + recoverHash
|
url: origin + '/#!' + recoverHash
|
||||||
};
|
};
|
||||||
|
|
||||||
const options = Object.assign({}, info.options);
|
const options = Object.assign({}, info.options);
|
||||||
|
|
|
@ -54,8 +54,7 @@
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"hasGrant": {
|
"hasGrant": {
|
||||||
"type": "boolean",
|
"type": "boolean"
|
||||||
"default": false
|
|
||||||
},
|
},
|
||||||
"passExpired": {
|
"passExpired": {
|
||||||
"type": "date"
|
"type": "date"
|
||||||
|
@ -166,10 +165,8 @@
|
||||||
"hasGrant",
|
"hasGrant",
|
||||||
"realm",
|
"realm",
|
||||||
"email",
|
"email",
|
||||||
"emailVerified",
|
"emailVerified"
|
||||||
"twoFactor"
|
|
||||||
]
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,9 +25,6 @@
|
||||||
"isManaged": {
|
"isManaged": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"isDestiny": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"countryFk": {
|
"countryFk": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
module.exports = Self => {
|
|
||||||
require('../methods/workerActivity/add')(Self);
|
|
||||||
};
|
|
|
@ -22,18 +22,18 @@
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
|
||||||
},
|
|
||||||
"relations": {
|
|
||||||
"workerFk": {
|
|
||||||
"type": "belongsTo",
|
|
||||||
"model": "Worker",
|
|
||||||
"foreignKey": "workerFk"
|
|
||||||
},
|
},
|
||||||
"workerActivityTypeFk": {
|
"relations": {
|
||||||
"type": "belongsTo",
|
"workerFk": {
|
||||||
"model": "WorkerActivityType",
|
"type": "belongsTo",
|
||||||
"foreignKey": "workerActivityTypeFk"
|
"model": "Worker",
|
||||||
|
"foreignKey": "workerFk"
|
||||||
|
},
|
||||||
|
"workerActivityTypeFk": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "WorkerActivityType",
|
||||||
|
"foreignKey": "workerActivityTypeFk"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
apps:
|
||||||
|
- script: ./loopback/server/server.js
|
||||||
|
name: salix-back
|
||||||
|
instances: 1
|
||||||
|
max_restarts: 3
|
||||||
|
restart_delay: 15000
|
||||||
|
node_args: --tls-min-v1.0 --openssl-legacy-provider
|
|
@ -10,6 +10,7 @@ async function init() {
|
||||||
host: process.env.DB_HOST,
|
host: process.env.DB_HOST,
|
||||||
port: process.env.DB_PORT
|
port: process.env.DB_PORT
|
||||||
});
|
});
|
||||||
|
|
||||||
const bootOptions = {dataSources};
|
const bootOptions = {dataSources};
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
app.boot(bootOptions,
|
app.boot(bootOptions,
|
||||||
|
@ -32,4 +33,3 @@ module.exports = {
|
||||||
|
|
||||||
if (require.main === module)
|
if (require.main === module)
|
||||||
init();
|
init();
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ async function test() {
|
||||||
'loopback/**/*[sS]pec.js',
|
'loopback/**/*[sS]pec.js',
|
||||||
'modules/*/back/**/*.[sS]pec.js'
|
'modules/*/back/**/*.[sS]pec.js'
|
||||||
],
|
],
|
||||||
helpers: [`back/vn-jasmine.js`],
|
helpers: []
|
||||||
};
|
};
|
||||||
|
|
||||||
if (PARALLEL) {
|
if (PARALLEL) {
|
||||||
|
@ -114,6 +114,7 @@ async function test() {
|
||||||
if (opts.ci)
|
if (opts.ci)
|
||||||
runner.jasmine.DEFAULT_TIMEOUT_INTERVAL = SPEC_TIMEOUT;
|
runner.jasmine.DEFAULT_TIMEOUT_INTERVAL = SPEC_TIMEOUT;
|
||||||
|
|
||||||
|
// runner.loadConfigFile('back/jasmine.json');
|
||||||
runner.loadConfig(config);
|
runner.loadConfig(config);
|
||||||
process.env.SPEC_IS_RUNNING = true;
|
process.env.SPEC_IS_RUNNING = true;
|
||||||
await runner.execute();
|
await runner.execute();
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
|
|
||||||
const LoopBackContext = require('loopback-context');
|
|
||||||
const getAccessToken = (userId = 9) => {
|
|
||||||
return {accessToken: {userId}};
|
|
||||||
};
|
|
||||||
const DEFAULT_HEADERS = {headers: {origin: 'http://localhost'}};
|
|
||||||
const default_before_all = userId => {
|
|
||||||
return {
|
|
||||||
req: {
|
|
||||||
...getAccessToken(userId),
|
|
||||||
...DEFAULT_HEADERS,
|
|
||||||
...{__: value => value}
|
|
||||||
|
|
||||||
},
|
|
||||||
args: {}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
const default_loopback_ctx = userId => {
|
|
||||||
return {
|
|
||||||
...getAccessToken(userId),
|
|
||||||
...default_before_all(userId),
|
|
||||||
http: {
|
|
||||||
...default_before_all(userId)
|
|
||||||
},
|
|
||||||
args: {}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
function vnBeforeAll() {
|
|
||||||
Object.assign(beforeAll, {getCtx: default_before_all, mockLoopBackContext});
|
|
||||||
}
|
|
||||||
|
|
||||||
const mockLoopBackContext = userId => {
|
|
||||||
const activeCtx = default_loopback_ctx(userId);
|
|
||||||
beforeAll(() => {
|
|
||||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
|
||||||
active: activeCtx
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return activeCtx;
|
|
||||||
};
|
|
||||||
module.exports = {
|
|
||||||
mockLoopBackContext
|
|
||||||
};
|
|
||||||
|
|
||||||
(function init() {
|
|
||||||
vnBeforeAll();
|
|
||||||
})();
|
|
|
@ -9,7 +9,7 @@
|
||||||
},
|
},
|
||||||
"vn": {
|
"vn": {
|
||||||
"view": {
|
"view": {
|
||||||
"expeditionPallet_Print": "04fc5f2967ce53bfbb85f7f48b9a3dca4a4f7111ac41e1775f4cc7d6538774b2"
|
"expeditionPallet_Print": "ced2b84a114fcb99fce05f0c34f4fc03f3fa387bef92621be1bc306608a84345"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,14 +1 @@
|
||||||
-- Executed before dump
|
-- Executed before dump
|
||||||
|
|
||||||
CREATE USER 'vn'@'localhost';
|
|
||||||
|
|
||||||
GRANT SELECT,
|
|
||||||
INSERT,
|
|
||||||
UPDATE,
|
|
||||||
DELETE,
|
|
||||||
DROP,
|
|
||||||
CREATE TEMPORARY TABLES,
|
|
||||||
EXECUTE,
|
|
||||||
EVENT,
|
|
||||||
TRIGGER
|
|
||||||
ON *.* TO 'vn'@'localhost';
|
|
||||||
|
|
|
@ -10,6 +10,9 @@ SET foreign_key_checks = 0;
|
||||||
INSERT INTO util.config (id, environment, mockTime, mockUtcTime, mockEnabled)
|
INSERT INTO util.config (id, environment, mockTime, mockUtcTime, mockEnabled)
|
||||||
VALUES (1, 'local', '2001-01-01 12:00:00', '2001-01-01 11:00:00', TRUE);
|
VALUES (1, 'local', '2001-01-01 12:00:00', '2001-01-01 11:00:00', TRUE);
|
||||||
|
|
||||||
|
INSERT INTO util.binlogQueue (code,logName, `position`)
|
||||||
|
VALUES ('mylogger', 'bin.000001', 4);
|
||||||
|
|
||||||
/* #5483
|
/* #5483
|
||||||
INSERT INTO vn.entryConfig (defaultEntry, mailToNotify, inventorySupplierFk, maxLockTime, defaultSupplierFk)
|
INSERT INTO vn.entryConfig (defaultEntry, mailToNotify, inventorySupplierFk, maxLockTime, defaultSupplierFk)
|
||||||
VALUES(1, NULL, 1, 300, 1);
|
VALUES(1, NULL, 1, 300, 1);
|
||||||
|
@ -77,8 +80,8 @@ INSERT INTO `vn`.`agency` (`name`, `warehouseFk`, `isOwn`, `isAnyVolumeAllowed`)
|
||||||
('Otra agencia ', '1', '0', '0');
|
('Otra agencia ', '1', '0', '0');
|
||||||
|
|
||||||
INSERT INTO `vn`.`expedition` (`agencyModeFk`, `ticketFk`, `isBox`, `counter`, `workerFk`, `externalId`, `packagingFk`, `hostFk`, `itemPackingTypeFk`, `hasNewRoute`) VALUES
|
INSERT INTO `vn`.`expedition` (`agencyModeFk`, `ticketFk`, `isBox`, `counter`, `workerFk`, `externalId`, `packagingFk`, `hostFk`, `itemPackingTypeFk`, `hasNewRoute`) VALUES
|
||||||
('1', '1', 1, '1', '1', '1', '1', 'pc1', 'F', 0),
|
('1', '1', 1, '1', '1', '1', '1', 'pc00', 'F', 0),
|
||||||
('1', '1', 1, '2', '1', '1', '1', 'pc1', 'F', 0);
|
('1', '1', 1, '2', '1', '1', '1', 'pc00', 'F', 0);
|
||||||
|
|
||||||
INSERT INTO vn.client (id,name,defaultAddressFk,street,fi,email,dueDay,isTaxDataChecked,accountingAccount,city,provinceFk,postcode,socialName,contact,credit,countryFk,quality,riskCalculated) VALUES
|
INSERT INTO vn.client (id,name,defaultAddressFk,street,fi,email,dueDay,isTaxDataChecked,accountingAccount,city,provinceFk,postcode,socialName,contact,credit,countryFk,quality,riskCalculated) VALUES
|
||||||
(100,'root',110,'Valle de la muerte','74974747G','root@mydomain.com',0,1,'4300000078','ALGEMESI',1,'46680','rootSocial','rootContact',500.0,1,10,'2025-01-01');
|
(100,'root',110,'Valle de la muerte','74974747G','root@mydomain.com',0,1,'4300000078','ALGEMESI',1,'46680','rootSocial','rootContact',500.0,1,10,'2025-01-01');
|
||||||
|
@ -311,4 +314,5 @@ INSERT INTO mysql.roles_mapping (`User`, `Host`, `Role`, `Admin_option`)
|
||||||
SELECT SUBSTR(`User`, @prefixLen + 1), `Host`, `Role`, `Admin_option`
|
SELECT SUBSTR(`User`, @prefixLen + 1), `Host`, `Role`, `Admin_option`
|
||||||
FROM mysql.roles_mapping
|
FROM mysql.roles_mapping
|
||||||
WHERE `User` LIKE @prefixedLike AND `Host` = @genRoleHost;
|
WHERE `User` LIKE @prefixedLike AND `Host` = @genRoleHost;
|
||||||
|
|
||||||
FLUSH PRIVILEGES;
|
FLUSH PRIVILEGES;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,12 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `account`.`mailAliasAccount_afterDelete`
|
|
||||||
AFTER DELETE ON `mailAliasAccount`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
INSERT INTO userLog
|
|
||||||
SET `action` = 'delete',
|
|
||||||
`changedModel` = 'MailAliasAccount',
|
|
||||||
`changedModelId` = OLD.id,
|
|
||||||
`userFk` = account.myUser_getId();
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,8 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `account`.`mailAliasAccount_beforeInsert`
|
|
||||||
BEFORE INSERT ON `mailAliasAccount`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,8 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `account`.`mailAliasAccount_beforeUpdate`
|
|
||||||
BEFORE UPDATE ON `mailAliasAccount`
|
|
||||||
FOR EACH ROW
|
|
||||||
BEGIN
|
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -7,7 +7,8 @@ AS SELECT `u`.`id` AS `id`,
|
||||||
`u`.`email` AS `email`,
|
`u`.`email` AS `email`,
|
||||||
`u`.`nickname` AS `nickname`,
|
`u`.`nickname` AS `nickname`,
|
||||||
`u`.`lang` AS `lang`,
|
`u`.`lang` AS `lang`,
|
||||||
`u`.`role` AS `role`
|
`u`.`role` AS `role`,
|
||||||
|
`u`.`recoverPass` AS `recoverPass`
|
||||||
FROM `account`.`user` `u`
|
FROM `account`.`user` `u`
|
||||||
WHERE `u`.`name` = `myUser_getName`()
|
WHERE `u`.`name` = `myUser_getName`()
|
||||||
WITH CASCADED CHECK OPTION
|
WITH CASCADED CHECK OPTION
|
||||||
|
|
|
@ -19,14 +19,14 @@ BEGIN
|
||||||
bultos)
|
bultos)
|
||||||
SELECT r.id,
|
SELECT r.id,
|
||||||
r.agencyModeFk,
|
r.agencyModeFk,
|
||||||
r.dated,
|
r.created,
|
||||||
SUM(sv.volume / ebv.m3)
|
SUM(sv.volume / ebv.m3)
|
||||||
FROM vn.route r
|
FROM vn.route r
|
||||||
JOIN vn.ticket t ON t.routeFk = r.id
|
JOIN vn.ticket t ON t.routeFk = r.id
|
||||||
LEFT JOIN vn.`zone` z ON z.id = t.zoneFk
|
LEFT JOIN vn.`zone` z ON z.id = t.zoneFk
|
||||||
JOIN vn.saleVolume sv ON sv.ticketFk = t.id
|
JOIN vn.saleVolume sv ON sv.ticketFk = t.id
|
||||||
JOIN vn.expeditionBoxVol ebv ON ebv.code = 'transportBox'
|
JOIN vn.expeditionBoxVol ebv ON ebv.code = 'transportBox'
|
||||||
WHERE r.dated BETWEEN vDatedFrom AND vDatedTo
|
WHERE r.created BETWEEN vDatedFrom AND vDatedTo
|
||||||
AND z.isVolumetric
|
AND z.isVolumetric
|
||||||
GROUP BY r.id;
|
GROUP BY r.id;
|
||||||
|
|
||||||
|
@ -38,12 +38,12 @@ BEGIN
|
||||||
Bultos)
|
Bultos)
|
||||||
SELECT r.id,
|
SELECT r.id,
|
||||||
r.agencyModeFk,
|
r.agencyModeFk,
|
||||||
r.dated,
|
r.created,
|
||||||
SUM(t.packages)
|
SUM(t.packages)
|
||||||
FROM vn.route r
|
FROM vn.route r
|
||||||
JOIN vn.ticket t ON t.routeFk = r.id
|
JOIN vn.ticket t ON t.routeFk = r.id
|
||||||
LEFT JOIN vn.`zone` z ON z.id = t.zoneFk
|
LEFT JOIN vn.`zone` z ON z.id = t.zoneFk
|
||||||
WHERE r.dated BETWEEN vDatedFrom AND vDatedTo
|
WHERE r.created BETWEEN vDatedFrom AND vDatedTo
|
||||||
AND NOT z.isVolumetric
|
AND NOT z.isVolumetric
|
||||||
GROUP BY r.id
|
GROUP BY r.id
|
||||||
ON DUPLICATE KEY UPDATE Bultos = Bultos + VALUES(Bultos);
|
ON DUPLICATE KEY UPDATE Bultos = Bultos + VALUES(Bultos);
|
||||||
|
@ -59,8 +59,8 @@ BEGIN
|
||||||
JOIN vn.saleComponent sc ON sc.saleFk = s.id
|
JOIN vn.saleComponent sc ON sc.saleFk = s.id
|
||||||
JOIN vn.component c ON c.id = sc.componentFk
|
JOIN vn.component c ON c.id = sc.componentFk
|
||||||
JOIN vn.componentType ct ON ct.id = c.typeFk
|
JOIN vn.componentType ct ON ct.id = c.typeFk
|
||||||
WHERE ct.code = 'freight'
|
WHERE ct.code = 'FREIGHT'
|
||||||
AND r.dated BETWEEN vDatedFrom AND vDatedTo
|
AND r.created BETWEEN vDatedFrom AND vDatedTo
|
||||||
GROUP BY r.id
|
GROUP BY r.id
|
||||||
) sub ON sub.routeFk = r.Id_Ruta
|
) sub ON sub.routeFk = r.Id_Ruta
|
||||||
SET r.practico = IFNULL(sub.totalPractice / r.Bultos, 0);
|
SET r.practico = IFNULL(sub.totalPractice / r.Bultos, 0);
|
||||||
|
@ -77,7 +77,7 @@ BEGIN
|
||||||
JOIN vn.address ad ON ad.id = t.addressFk
|
JOIN vn.address ad ON ad.id = t.addressFk
|
||||||
JOIN vn.client c ON c.id = ad.clientFk
|
JOIN vn.client c ON c.id = ad.clientFk
|
||||||
LEFT JOIN vn.`zone` z ON z.id = t.zoneFk
|
LEFT JOIN vn.`zone` z ON z.id = t.zoneFk
|
||||||
WHERE r.dated BETWEEN vDatedFrom AND vDatedTo
|
WHERE r.created BETWEEN vDatedFrom AND vDatedTo
|
||||||
AND NOT z.isVolumetric
|
AND NOT z.isVolumetric
|
||||||
GROUP BY t.routeFk
|
GROUP BY t.routeFk
|
||||||
) sub ON r.Id_Ruta = sub.routeFk
|
) sub ON r.Id_Ruta = sub.routeFk
|
||||||
|
@ -93,7 +93,7 @@ BEGIN
|
||||||
JOIN vn.saleVolume sf ON sf.ticketFk = t.id
|
JOIN vn.saleVolume sf ON sf.ticketFk = t.id
|
||||||
JOIN vn.client c ON c.id = t.clientFk
|
JOIN vn.client c ON c.id = t.clientFk
|
||||||
JOIN vn.`zone` z ON z.id = t.zoneFk
|
JOIN vn.`zone` z ON z.id = t.zoneFk
|
||||||
WHERE r.dated BETWEEN vDatedFrom AND vDatedTo
|
WHERE r.created BETWEEN vDatedFrom AND vDatedTo
|
||||||
AND z.isVolumetric
|
AND z.isVolumetric
|
||||||
GROUP BY t.routeFk
|
GROUP BY t.routeFk
|
||||||
) sub ON r.Id_Ruta = sub.routeFk
|
) sub ON r.Id_Ruta = sub.routeFk
|
||||||
|
@ -108,7 +108,7 @@ BEGIN
|
||||||
JOIN vn.route r ON r.id = t.routeFk
|
JOIN vn.route r ON r.id = t.routeFk
|
||||||
JOIN vn.greuge g ON g.ticketFk = t.id
|
JOIN vn.greuge g ON g.ticketFk = t.id
|
||||||
JOIN vn.greugeType gt ON gt.id = g.greugeTypeFk
|
JOIN vn.greugeType gt ON gt.id = g.greugeTypeFk
|
||||||
WHERE r.dated BETWEEN vDatedFrom AND vDatedTo
|
WHERE r.created BETWEEN vDatedFrom AND vDatedTo
|
||||||
AND gt.code = 'freightDifference'
|
AND gt.code = 'freightDifference'
|
||||||
GROUP BY t.routeFk
|
GROUP BY t.routeFk
|
||||||
) sub ON r.Id_Ruta = sub.routeFk
|
) sub ON r.Id_Ruta = sub.routeFk
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `bi`.`rotacion`
|
||||||
|
AS SELECT `ic`.`itemFk` AS `Id_Article`,
|
||||||
|
`ic`.`warehouseFk` AS `warehouse_id`,
|
||||||
|
`ic`.`quantity` AS `total`,
|
||||||
|
`ic`.`rotation` AS `rotacion`,
|
||||||
|
`ic`.`cm3` AS `cm3`,
|
||||||
|
`ic`.`storage` AS `almacenaje`,
|
||||||
|
`ic`.`handling` AS `manipulacion`,
|
||||||
|
`ic`.`extraCharge` AS `auxiliar`,
|
||||||
|
`ic`.`wasted` AS `mermas`,
|
||||||
|
`ic`.`cm3delivery` AS `cm3reparto`,
|
||||||
|
`ic`.`grams` AS `grams`
|
||||||
|
FROM `vn`.`itemCost` `ic`
|
|
@ -2,7 +2,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
SQL SECURITY DEFINER
|
SQL SECURITY DEFINER
|
||||||
VIEW `bi`.`tarifa_componentes_series`
|
VIEW `bi`.`tarifa_componentes_series`
|
||||||
AS SELECT `ct`.`id` AS `tarifa_componentes_series_id`,
|
AS SELECT `ct`.`id` AS `tarifa_componentes_series_id`,
|
||||||
`ct`.`name` AS `Serie`,
|
`ct`.`type` AS `Serie`,
|
||||||
`ct`.`isBase` AS `base`,
|
`ct`.`isBase` AS `base`,
|
||||||
`ct`.`isMargin` AS `margen`
|
`ct`.`isMargin` AS `margen`
|
||||||
FROM `vn`.`componentType` `ct`
|
FROM `vn`.`componentType` `ct`
|
||||||
|
|
|
@ -6,27 +6,25 @@ BLOCK1: BEGIN
|
||||||
DECLARE vShipped DATE;
|
DECLARE vShipped DATE;
|
||||||
DECLARE vPreviousShipped DATE;
|
DECLARE vPreviousShipped DATE;
|
||||||
DECLARE vDone boolean;
|
DECLARE vDone boolean;
|
||||||
|
DECLARE cur cursor for
|
||||||
|
|
||||||
DECLARE cur CURSOR FOR
|
SELECT clientFk, firstShipped
|
||||||
SELECT clientFk, firstShipped
|
FROM bs.clientNewBorn;
|
||||||
FROM bs.clientNewBorn;
|
|
||||||
|
|
||||||
DECLARE continue HANDLER FOR NOT FOUND SET vDone = TRUE;
|
DECLARE continue HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||||
SET vDone := FALSE;
|
SET vDone := FALSE;
|
||||||
|
|
||||||
DELETE FROM bs.clientNewBorn WHERE isModified = FALSE;
|
DELETE FROM bs.clientNewBorn WHERE isModified = FALSE;
|
||||||
|
|
||||||
INSERT INTO clientNewBorn(clientFk, firstShipped, lastShipped)
|
INSERT INTO clientNewBorn(clientFk, firstShipped, lastShipped)
|
||||||
SELECT c.id, DATE(MAX(t.shipped)), DATE(MAX(t.shipped))
|
SELECT c.id, MAX(t.shipped), MAX(t.shipped)
|
||||||
FROM vn.client c
|
FROM vn.client c
|
||||||
JOIN vn.ticket t ON t.clientFk = c.id
|
JOIN vn.ticket t on t.clientFk = c.id
|
||||||
LEFT JOIN clientNewBorn cb ON cb.clientFk = c.id
|
LEFT JOIN clientNewBorn cb on cb.clientFk = c.id
|
||||||
WHERE t.shipped BETWEEN util.VN_CURDATE() - INTERVAL 1 YEAR
|
WHERE t.shipped BETWEEN TIMESTAMPADD(YEAR, -1, util.VN_CURDATE()) AND util.VN_CURDATE() AND cb.isModified is null
|
||||||
AND util.VN_CURDATE()
|
GROUP BY c.id;
|
||||||
AND cb.isModified IS NULL
|
|
||||||
GROUP BY c.id;
|
|
||||||
|
|
||||||
OPEN cur;
|
OPEN cur;
|
||||||
|
|
||||||
LOOP1: LOOP
|
LOOP1: LOOP
|
||||||
SET vDone := FALSE;
|
SET vDone := FALSE;
|
||||||
FETCH cur INTO vClientFk, vShipped;
|
FETCH cur INTO vClientFk, vShipped;
|
||||||
|
|
|
@ -32,7 +32,7 @@ BEGIN
|
||||||
CREATE OR REPLACE TEMPORARY TABLE tVisible
|
CREATE OR REPLACE TEMPORARY TABLE tVisible
|
||||||
SELECT itemFk, SUM(visible) totalVisible
|
SELECT itemFk, SUM(visible) totalVisible
|
||||||
FROM vn.itemShelving ish
|
FROM vn.itemShelving ish
|
||||||
JOIN vn.shelving sh ON sh.id = ish.shelvingFk
|
JOIN vn.shelving sh ON sh.code = ish.shelvingFk
|
||||||
JOIN vn.parking p ON p.id = sh.parkingFk
|
JOIN vn.parking p ON p.id = sh.parkingFk
|
||||||
JOIN vn.sector sc ON sc.id = p.sectorFk
|
JOIN vn.sector sc ON sc.id = p.sectorFk
|
||||||
WHERE sc.warehouseFk = vWarehouseFk
|
WHERE sc.warehouseFk = vWarehouseFk
|
||||||
|
@ -65,7 +65,7 @@ BEGIN
|
||||||
JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
||||||
JOIN vn.alertLevel al ON al.id = ts.alertLevel
|
JOIN vn.alertLevel al ON al.id = ts.alertLevel
|
||||||
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
|
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
|
||||||
AND NOT s.isPicked
|
AND s.isPicked = FALSE
|
||||||
AND al.code = 'FREE'
|
AND al.code = 'FREE'
|
||||||
AND t.warehouseFk = vWarehouseFk
|
AND t.warehouseFk = vWarehouseFk
|
||||||
GROUP BY s.itemFk
|
GROUP BY s.itemFk
|
||||||
|
@ -73,6 +73,7 @@ BEGIN
|
||||||
) s ON s.itemFk = v.item_id
|
) s ON s.itemFk = v.item_id
|
||||||
WHERE v.calc_id = vCalc
|
WHERE v.calc_id = vCalc
|
||||||
AND NOT v.visible <=> tv.totalVisible;
|
AND NOT v.visible <=> tv.totalVisible;
|
||||||
|
|
||||||
END LOOP;
|
END LOOP;
|
||||||
CLOSE cWarehouses;
|
CLOSE cWarehouses;
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ BEGIN
|
||||||
|
|
||||||
DELETE FROM bs.ventas_contables
|
DELETE FROM bs.ventas_contables
|
||||||
WHERE year = vYear
|
WHERE year = vYear
|
||||||
AND month = vMonth;
|
AND month = vMonth;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list;
|
DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list;
|
||||||
CREATE TEMPORARY TABLE tmp.ticket_list
|
CREATE TEMPORARY TABLE tmp.ticket_list
|
||||||
|
|
|
@ -1,83 +1,31 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSales`(
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSales`()
|
||||||
vDateFrom DATE,
|
|
||||||
vDateTo DATE
|
|
||||||
)
|
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
DECLARE vWeek INT;
|
||||||
* Recalcula las mermas de un periodo.
|
DECLARE vYear INT;
|
||||||
*
|
|
||||||
* @param vDateFrom Fecha desde
|
|
||||||
* @param vDateTo Fecha hasta
|
|
||||||
*/
|
|
||||||
DECLARE vDaysInYear INT;
|
|
||||||
SET vDaysInYear = DATEDIFF(util.lastDayOfYear(CURDATE()), util.firstDayOfYear(CURDATE()));
|
|
||||||
|
|
||||||
SET vDateFrom = COALESCE(vDateFrom, util.VN_CURDATE());
|
SELECT week, year
|
||||||
SET vDateTo = COALESCE(vDateTo, util.VN_CURDATE());
|
INTO vWeek, vYear
|
||||||
|
FROM vn.time
|
||||||
IF DATEDIFF(vDateTo, vDateFrom) > vDaysInYear THEN
|
WHERE dated = util.VN_CURDATE();
|
||||||
CALL util.throw('The period cannot be longer than one year');
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
-- Obtiene el primer día de la semana de esa fecha
|
|
||||||
SET vDateFrom = DATE_SUB(vDateFrom, INTERVAL ((WEEKDAY(vDateFrom) + 1) % 7) DAY);
|
|
||||||
|
|
||||||
-- Obtiene el último día de la semana de esa fecha
|
|
||||||
SET vDateTo = DATE_ADD(vDateTo, INTERVAL (6 - ((WEEKDAY(vDateTo) + 1) % 7)) DAY);
|
|
||||||
|
|
||||||
CALL cache.last_buy_refresh(FALSE);
|
|
||||||
|
|
||||||
REPLACE bs.waste
|
REPLACE bs.waste
|
||||||
SELECT YEARWEEK(t.shipped, 6) DIV 100,
|
SELECT *, 100 * mermas / total as porcentaje
|
||||||
WEEK(t.shipped, 6),
|
FROM (
|
||||||
it.workerFk,
|
SELECT buyer,
|
||||||
it.id,
|
year,
|
||||||
s.itemFk,
|
week,
|
||||||
SUM((b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity),
|
family,
|
||||||
SUM(IF(aw.`type`, s.quantity, 0)),
|
itemFk,
|
||||||
SUM(IF(
|
itemTypeFk,
|
||||||
aw.`type` = 'external',
|
floor(sum(value)) as total,
|
||||||
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
|
floor(sum(IF(typeFk = 'loses', value, 0))) as mermas
|
||||||
0
|
FROM vn.saleValue
|
||||||
)
|
where year = vYear and week = vWeek
|
||||||
),
|
|
||||||
SUM(IF(
|
GROUP BY family, itemFk
|
||||||
aw.`type` = 'fault',
|
|
||||||
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
|
) sub
|
||||||
0
|
ORDER BY mermas DESC;
|
||||||
)
|
|
||||||
),
|
|
||||||
SUM(IF(
|
|
||||||
aw.`type` = 'container',
|
|
||||||
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
|
|
||||||
0
|
|
||||||
)
|
|
||||||
),
|
|
||||||
SUM(IF(
|
|
||||||
aw.`type` = 'break',
|
|
||||||
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
|
|
||||||
0
|
|
||||||
)
|
|
||||||
),
|
|
||||||
SUM(IF(
|
|
||||||
aw.`type` = 'other',
|
|
||||||
(b.buyingValue + b.freightValue + b.comissionValue + b.packageValue) * s.quantity,
|
|
||||||
0
|
|
||||||
)
|
|
||||||
)
|
|
||||||
FROM vn.sale s
|
|
||||||
JOIN vn.item i ON i.id = s.itemFk
|
|
||||||
JOIN vn.itemType it ON it.id = i.typeFk
|
|
||||||
JOIN vn.ticket t ON t.id = s.ticketFk
|
|
||||||
JOIN vn.address a FORCE INDEX (PRIMARY) ON a.id = t.addressFk
|
|
||||||
LEFT JOIN vn.addressWaste aw ON aw.addressFk = a.id
|
|
||||||
JOIN vn.warehouse w ON w.id = t.warehouseFk
|
|
||||||
JOIN cache.last_buy lb ON lb.item_id = i.id
|
|
||||||
AND lb.warehouse_id = w.id
|
|
||||||
JOIN vn.buy b ON b.id = lb.buy_id
|
|
||||||
WHERE t.shipped BETWEEN vDateFrom AND util.dayEnd(vDateTo)
|
|
||||||
AND w.isManaged
|
|
||||||
GROUP BY YEARWEEK(t.shipped, 6) DIV 100, WEEK(t.shipped, 6), i.id;
|
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `bs`.`waste_addSalesLauncher`()
|
|
||||||
BEGIN
|
|
||||||
CALL waste_addSales(NULL, NULL);
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -53,7 +53,7 @@ proc: BEGIN
|
||||||
WHERE t.landed BETWEEN vInventoryDate AND vStartDate
|
WHERE t.landed BETWEEN vInventoryDate AND vStartDate
|
||||||
AND t.warehouseInFk = vWarehouse
|
AND t.warehouseInFk = vWarehouse
|
||||||
AND s.name != 'INVENTARIO'
|
AND s.name != 'INVENTARIO'
|
||||||
AND NOT t.isRaid
|
AND NOT e.isRaid
|
||||||
GROUP BY b.itemFk
|
GROUP BY b.itemFk
|
||||||
) c
|
) c
|
||||||
JOIN vn.item i ON i.id = c.itemFk
|
JOIN vn.item i ON i.id = c.itemFk
|
||||||
|
@ -117,7 +117,7 @@ proc: BEGIN
|
||||||
)sub
|
)sub
|
||||||
GROUP BY sub.itemFk;
|
GROUP BY sub.itemFk;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE tmp.itemCalc, tItemRange, tmp.itemList;
|
DROP TEMPORARY TABLE tmp.itemCalc, tItemRange;
|
||||||
CALL cache_calc_end (vCalc);
|
CALL cache_calc_end (vCalc);
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue