Commit Graph

56 Commits

Author SHA1 Message Date
Nathnael
f55645fea9 chore(scripts): add the OCC July 2026 seed, drop the throwaway ops scripts
seed-occ-july-2026 loads the OCC plan and operated figures the operations
reports were built against, so the plan-versus-actual tables have real
numbers to check.

tmp-ops-plan, tmp-ops-verify, tmp-mkdb and tmp-ops-reconcile were
scratch: written to reconcile those figures while the reports were being
built, and superseded by the seed above.
2026-08-20 11:37:12 +00:00
Nathnael
62f7b91315 feat(exports): dataset-driven table export, starting with bookings
Adds a parallel export system the reports module can also draw on. A dataset
describes a table's exportable fields — including related-entity detail the
list page never shows — and the engine assembles a query from whichever fields
the caller picked.

GET /exports                 catalog (metadata only; select/requires never ship)
GET /exports/:key/count      exact row count + per-format caps
GET /exports/:key/download   csv | xlsx | pdf

Two invariants carry the design:

- Every lazy join is a LEFT join, and ExportJoin has no 'kind' field to make
  anything else expressible. An inner join added because a checkbox was ticked
  would change the rowset, so two exports of the same filters would disagree on
  their row count.
- Because of that, the count cannot depend on field selection, so /count runs
  base + alwaysJoin only and is exact rather than an estimate. Verified: count
  and the delivered file both report 223 rows.

One-to-many relations (a booking's containers) aggregate in a correlated
subquery rather than joining, so a row can never multiply.

Export rides each dataset's existing view permission — no new permission keys
and no seeder change. Sensitive columns are simply never declared as fields:
raw gateway payloads, signature blobs, error dumps, raw jsonb snapshots,
internal user UUIDs and review notes are all absent by construction.

bookings ships 77 fields across 10 groups. scripts/validate-export-datasets.ts
EXPLAINs every dataset's widest query, its count query, and each field on its
own against the real database — the per-field pass is what catches a field
referencing a join it forgot to declare, which otherwise only fails when that
one field is picked alone.
2026-08-20 05:29:04 +00:00
Nathnael
fb21ad1541 feat(WIP): filtering, exporting and more reports 2026-08-19 13:51:18 +00:00
Nathnael
a1bcdfb692 refactor(companies): one verified identity per company, no general manager
Replaces the owner/general-manager/PoA trio with a single identity whose
subject is the PoA when the company declares one and the owner otherwise.

- Drop the general manager everywhere: entity columns, DTOs, required-field
  list, self-service attributes, gm* identity handling.
- New explicit poaDeclared answer ("yes"/"no") replaces poaSameAsOwner. A
  DARS delegation letter is required iff it is "yes"; a freight forwarder is
  forced to "yes" server-side and gets no waiver.
- Owner name/email/phone become typeable and required, prefilled from the
  eTrade lookup, never falling back to the authenticated account.
- Store eTrade's manager separately (etradeManagerName/Phone) and expose
  ownerMatchesEtrade so backoffice compares the asserted owner against the
  licence instead of against itself.
- Foreign companies satisfy the identity with Fayda or a passport number, on
  whichever subject is verifying (poaPassportNumber added).
- Write companies.email/phone from the owner unconditionally, so a company
  without a Fayda-verified owner still has a notification address.
2026-08-11 11:53:26 +00:00
Nathnael Wondisha
a9d0a7e9e6 Merge pull request #1170 from Tria-plc/freight/nati-2
fix: iam migration
2026-08-08 01:19:40 +03:00
Nathnael
7f1d8fa260 fix: iam migration 2026-08-07 22:18:41 +00:00
Nathnael Wondisha
55e0c6fb0b Merge pull request #1168 from Tria-plc/freight/nati-2
fix: rm iam migration from migrate
2026-08-08 01:10:56 +03:00
Nathnael
d44c3f3a38 fix: rm iam migration from migrate 2026-08-07 22:10:05 +00:00
Hagernesh
2644d5e52d feat(eims): add invoice mapper and signed EIMS transport
Map EDR invoices onto the MoR EIMS /v1/register document and add the
cryptographic transport needed to talk to core.mor.gov.et.

Mapper: DTOs mirror the supplied Postman collection section by section.
Tax is resolved per line via a caller-supplied resolver and throws when
unresolved -- the app models no tax at all (invoice.taxAmount is always 0,
invoice_lines and the rate catalogue carry no fiscal columns), so a
zero-rated default would assert a tax position the codebase cannot support.
Seller identity, document number, counters and previous IRN are passed in
explicitly; the mapper stays pure.

Transport: config, credential loading, RSA-SHA512 signing and /auth/login
with an in-memory token cache. Signing reproduces the process that produced
a working live token -- compact JSON of the inner request only, exact UTF-8
bytes, base64 signature, and base64 of the certificate file's exact bytes
with no parsing or re-encoding. Concurrent callers share one login via an
in-flight promise. Refresh is deliberately unimplemented: the collection
shows an unsigned refresh body but also ships unsigned examples of calls
that do require signing, so an expired token re-logs in instead.

Errors normalise to EimsApiException carrying only the gateway's own error
fields; secrets, signature, certificate and tokens never reach logs.
Key and certificate file patterns are gitignored.

Nothing calls EIMS automatically and no invoice entity, migration or UI is
touched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-07 15:08:40 +00:00
Hagernesh
1f4d659ffb Last mile confirmation request , approval, payment Feature 2026-08-05 20:01:48 +00:00
ghost2023
97eca6bed9 chore: squash the freight migration 2026-08-05 10:46:02 +03:00
ghost2023
321f3612ec refactor(freight-api): split migration histories between IAM and freight 2026-08-05 10:26:25 +03:00
Hagernesh
50fab52b1c feat(warehouses): filters, pagination and charts on container returns
Returned-containers list now uses the shared DataTable + useListControls
(search, inclusive date range, status select, pagination) instead of a
hand-rolled table. Adds two charts below the list — returns per day by
truck type and returns by status — driven by the same filtered rows.
Series colors validated for CVD separation and surface contrast.
2026-08-04 09:54:15 +00:00
Hagernesh
035369af43 fix intercity unloading at facility 2026-08-02 23:07:59 +00:00
Nathnael
784f6ac6f2 Merge branch 'dev' into update-freight-migrations 2026-08-01 10:59:41 +00:00
Hagernesh
af1d64d0bd fix 2026-08-01 08:34:59 +00:00
Yonas Tewabe
36f8fe2a7e Merge branch 'dev' into update-freight-migrations 2026-07-24 14:04:11 +03:00
yonastewabe
16a7aebadd update migration to before deployment in freight api 2026-07-24 14:01:21 +03:00
natib21
dc4512c15b gMerge branch 'dev' of github.com:Tria-plc/edr-platform into dev 2026-07-18 09:04:52 +00:00
natib21
20eb54521b fix 2026-07-18 08:34:43 +00:00
natib21
6ee771c953 fix search 2026-07-17 15:01:30 +00:00
natib21
47780c614a fix 2026-07-17 11:59:00 +00:00
natib21
149e4105f4 seed vehicle 2026-07-17 11:30:25 +00:00
natib21
57f49a9333 fix 2026-07-17 11:03:23 +00:00
natib21
a9d65e04fc fix number of wagon 2026-07-17 10:12:43 +00:00
Marshal
7b7e7c3f62 fix schule issue and contianer type issue 2026-07-17 09:16:35 +00:00
natib21
a4b3309412 add seed 2026-07-16 07:43:54 +00:00
Marshal
4b7f6d2548 enhance contract and booking services with server-side search and validation improvements
- Added  parameter to  and  for server-side free-text search on contract reference, company name, and booking details.
- Introduced new validation errors in  for container clashes and space issues when creating bookings.
- Implemented paginated dropdown settings retrieval in .
- Updated  to fetch active yards using a new method that handles pagination.
- Enhanced  with a  method to fetch all records by walking through pages.
- Refactored  to support filtering and pagination in schedule listings.
- Improved  to return a paginated list of facilities.
- Updated UI components in  and  to utilize debounced search inputs for better performance.
- Added alerts in  to inform users about booking constraints related to splits and capacity.
- Enhanced  to display notifications for split bookings and capacity usage.
2026-07-12 10:51:31 +00:00
Marshal
61ec67cc2e Refactor wagon specifications to rely on wagon type; remove tare weight and max payload from wagon entity and related components 2026-07-09 07:42:02 +00:00
Marshal
ddddcfb71f Refactor wagon type handling and container wagon calculations
- Removed maxWagonsPerTrain from WagonType entity and related DTOs.
- Updated containerWagonsForLines function to calculate required wagons based on container lines more accurately.
- Added unit tests for containerWagonsForLines to ensure correct calculations.
- Adjusted related services and scripts to reflect the removal of maxWagonsPerTrain.
- Enhanced booking and contract components to use new status labels for better user experience.
- Implemented validation for unique container numbers in shipment forms.
2026-07-09 03:36:35 +00:00
Marshal
b57840c907 add CUSTOMS type to priority configs and update related logic 2026-07-07 16:42:57 +00:00
Hagernesh
18f47481d7 Handover customer sign 2026-07-04 06:31:23 +00:00
hagiye
5af45c2643 Customer Truck Assignment and Portal Delivary Approval 2026-07-02 15:54:16 +03:00
ghost2023
cdc2592bc7 fix: script fial 2026-07-02 13:30:09 +03:00
hagiye
ad9f9de7a8 Truck Assign by customer plus Handover signature on portal 2026-07-02 12:32:18 +03:00
ghost2023
174df0b7aa chore: fix script and add seed company 2026-07-01 15:46:25 +03:00
ghost2023
b7be6d6229 feat: add the seed schedules 2026-07-01 14:37:47 +03:00
ghost2023
abdf459289 feat: add the seed contracts 2026-07-01 14:26:32 +03:00
ghost2023
c88c5ee450 chore: setup script 2026-07-01 12:26:37 +03:00
hagiye
831ac59a8e Merge branch 'dev' of github.com:Tria-plc/edr-platform into importhandover 2026-06-30 07:20:10 +03:00
hagiye
9f5c22c1ee Goods recieved notes and Booking delivery 2026-06-30 07:19:12 +03:00
Nathnael Wondisha
4cf8e89780 Merge branch 'dev' into freight/feat/invoice 2026-06-29 17:24:29 +03:00
Nathnael
c37e8acfdc Merge branch 'dev' into freight/feat/invoice 2026-06-29 10:58:12 +00:00
hagiye
d55f9312bf Marshaling document Receive Export and import handover to customer 2026-06-29 12:24:14 +03:00
hagiye
2a038c59db Import operation gate pass 2026-06-27 21:22:18 +03:00
hagiye
fee4365b70 Import operation gate pass 2026-06-27 21:04:27 +03:00
hagiye
3decc9aeea interchange document generation and acknowledgement 2026-06-27 13:39:42 +03:00
Nathnael
98e34593c4 feat: add government support to the companies. add seeding and constrain on booking 2026-06-27 09:08:15 +00:00
hagiye
4efef9bab3 inspection status column fix 2026-06-26 13:20:26 +03:00
hagiye
f4a90755c2 api 2026-06-25 11:00:40 +03:00