Commit Graph

21 Commits

Author SHA1 Message Date
Marshal
f4fd469643 per-user trade-direction access scope 2026-08-02 22:29:58 +00:00
Nathnael
dcc94643d0 feat(companies): enforce customers:* permissions on customer endpoints
The customers:* keys were seeded and present in the backoffice constants but
enforced nowhere except reset-password. Customer CRUD sat behind the coarse
edr_freight_app:admin umbrella, and every company read endpoint was unguarded.

Two routes could not be gated on the route alone, because the authority they
need depends on the request BODY, not the path:

  - PATCH /companies/:id carries `status` (UpdateCompanyDto extends
    PartialType(CreateCompanyDto)), so it both edits fields and blacklists.
  - PATCH /company-profiles/:profileId/status is approve, reject, suspend and
    blacklist on one route.

Both now take a one-of route guard and assert per-status against a shared
STATUS_PERM map: approving/reactivating needs customers:verify, suspending or
blacklisting needs customers:deactivate. PATCH /companies/:id additionally
requires customers:update when any non-status field is present, so a caller
holding only deactivate cannot rename a company. The backoffice mirrors the
same map so no button is offered that the server would reject.

GET /companies/:companyId/documents is left authenticated-only with the split
in the handler: it is dual-audience. The portal reads its own documents during
onboarding, and the contract-request detail page (gated on contracts:view)
reads the applicant's. Gating it on customers:view alone would have 403'd
customers on their own documents and blanked the contract reviewer's panel.

The two by-company customer-view reads take a one-of guard for the same reason
— otherwise a staffer granted only customers:view gets a detail page whose tabs
403 individually.

Frontend: the customers routes were sidebar-filtered but not wrapped in
RequirePermission, so direct URL navigation rendered them for anyone.

Verified: freight-api type-check clean; backoffice type-check unchanged from
HEAD (pre-existing errors only); 25 tests pass across the companies and
freight-permission suites. Not exercised against a running API.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 13:48:42 +00:00
Nathnael
0056dec924 style: clean up the invoice and setup event for warehouse. 2026-06-30 13:28:14 +00:00
Nathnael
4be4286fbf feat: rewired up the billing and payment with the booking 2026-06-29 09:25:46 +00:00
Nathnael
a6f3fd5643 feat: finish company profile in the backoffice 2026-06-23 06:45:29 +00:00
Marshal
2de3f78fb0 Add payments management features including summary and listing, and integrate with the dashboard 2026-06-17 04:35:43 +00:00
Marshal
648f4f2ee4 Add fleet management and admin permissions, and update controllers to enforce new permissions 2026-06-17 01:56:56 +00:00
marshal
0aed9824ae cac payemnt integration and cbe rate exchange webscrabing 2026-06-15 14:54:20 +03:00
marshal
484151d909 payments 2026-06-14 15:59:52 +03:00
Eyosiyas
a1940c4901 telebirr out in the payment 2026-06-08 11:49:50 +03:00
Eyosiyas
b5f64bc9ad providers 2026-06-06 11:32:14 +03:00
Eyosiyas Girma
10f3c517f3 Merge branch 'freight/develop' into freight/feature/payment 2026-06-06 08:17:17 +03:00
Tria
828f93d160 minor update 2026-06-06 08:13:38 +03:00
hagiye
788de5381e feat: complete train scheduling integration 2026-06-06 05:52:47 +03:00
Tria
ebe59f491a payment | webhook 2026-06-05 17:34:33 +03:00
Tria
6786bdd210 receipt template 2026-06-05 17:23:21 +03:00
Tria
21bc6948e8 receipt 2026-06-05 15:56:29 +03:00
Tria
02018c339d payment 2026-06-05 12:57:44 +03:00
Tria
c0dc9f5fc5 payment 2026-06-05 12:54:35 +03:00
Tria
7c124d9845 telebirr configured 2026-06-05 11:01:01 +03:00
Tria
93020b3153 working on payment 2026-06-04 16:18:14 +03:00