Skip to content

Dev hung - #48

Merged
laithanhhung merged 5 commits into
devfrom
dev-hung
Aug 26, 2026
Merged

laithanhhung merged 5 commits into
devfrom
dev-hung

Conversation

@laithanhhung

Copy link
Copy Markdown
Member

No description provided.

laithanhhung and others added 5 commits August 26, 2026 16:13
…ep drafts out of the order list

The cart is the server Draft order, and it used to adopt whichever draft came
back first — a cart abandoned last week reappeared as if the buyer had left it
there minutes ago, priced against a session that has since closed.

A draft is now adopted only when its creation date is the current session's
trading day (Asia/Ho_Chi_Minh, off the session's closesAt) and that session is
still open. No session in view falls back to the newest draft, so a buyer who
has not picked a market is not left with an empty cart.

The same drafts were also sitting in the buyer's order history: "all" sends no
status filter, so the server returns them with everything else. The API has no
"except this status" filter and the grouped path crawls every page, so "all"
drops drafts from the page it renders and subtracts their count from the total —
the pager then stops offering a last page that comes back empty. The trade-off
is a page shorter than 20 when the buyer holds drafts.

Backend untouched.

Note: this slice carries in-flight work already in the tree for the cart,
checkout, order tabs and the realtime services these files import — they do not
compile apart.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…i.json

Picks up what the backend has added since the last generate: the
`GET /admin/order-groups/{batchId}` detail endpoint, `proofImageUrl` on
`FileClaimRequest`, and `UpdateDraftOrderRequest`, plus the invoices and
claims operations the generator had not seen.

Generated output only — `npm run generate:api`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… the raw client

Four things, all in the admin console.

**Staff panel.** Who counts as "already assigned" was read off the chợ's whole
roster, whatever the role. But a hub-scoped role is assigned to *one* hub —
`hub_staff_assignments` is keyed on `(hub_id, user_id)`, so one person may work
several. Judging a hub pick by the chợ meant everyone already on the first hub
showed as taken, and a chợ's second hub could not be staffed with any of them.
The check now reads the selected hub's own roster, changing the hub reloads the
candidate list, and picks made against the previous hub are dropped rather than
carried over.

**Hub-day.** A `DateOnly` parameter is serialised by the generated client as
`toISOString().substring(0, 10)`, which is UTC. A `Date` built from local *now*
therefore names the previous day anywhere east of Greenwich: before 07:00 in
Hanoi the procurement plan asked the hub about yesterday. The day is now chosen
in `Asia/Ho_Chi_Minh` and pinned to UTC midnight, which survives the conversion.

**Generated client.** `getOrderGroup` and `fileClaim` used `rawApi.send` because
the endpoints postdated the checked-in `openapi.json`. They no longer do, so
both move onto `adminApi` / `claimsApi` — `proofImageUrl` is now part of
`FileClaimRequest`, and the serialiser carries it instead of stripping it as an
unknown field. The 404 fallback in `getOrderGroup` stays for older backends.

**Restaurants list.** The approve and account-toggle columns come off the table;
the approval pill is what reads that rule now. Their tests go with them, and the
`isApproved` fallback is re-asserted through `approvalKey`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…n the glyph

**Live over SignalR.** `@microsoft/signalr` joins the deps, and the catalog grid
and the notification bell hold a connection for as long as they are on screen.
A `PriceUpdated` broadcast patches the listing in place — price and stock on
hand only, never availability, which the pricing hub does not know: overwriting
it with stock-on-hand would quietly offer more than can be ordered. The bell
still does its first read, since the hub replays nothing, and re-asks on sign-in
because a guest's `connect()` is a no-op.

`getValidAccessToken` refreshes an expired token *before* handing it out. HTTP
does not need this — the 401 middleware refreshes and retries — but a SignalR
negotiate has no second chance, and the client reuses whatever the factory
returned for every reconnect, so an expired token would fail until a reload.

**Aisle counts.** The landing board counted the whole catalogue through
`GET /products`, which is `[Authorize]`-only. A signed-out visitor got 401,
every count fell to zero, and the board on the front page of a deliberately open
storefront reported no aisles at all. It now counts the selected chợ's own
listings through the anonymous market endpoint — the honest number anyway, since
a buyer walking into "Thuỷ sản" gets what this chợ sells today — and re-counts
when the market changes. No extra request: it reduces the listing already cached.

**Badges.** The hand-rolled count spans on the cart, favourites and bell become
Material `matBadge`, placed on the icon rather than the button: a
`mat-icon-button` is a 48px target around a 24px glyph, so a badge pinned to the
button's corner floats away from what it counts. The pop animation follows.

**Images** move to `public/images/pages/`, out of the shared background folder.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…art need

Both bundles, en and vi:

- `orders.tabs.processing` / `awaiting` / `delivered` / `cancelled`, and
  `orders.tabs.all` widened to "All statuses" — the buyer's list is indexed by
  stage now, not by each of the eight statuses an order passes through.
- `cart.overStock`, for the line the cart shows when it has taken all there is.
- `admin.markets.staff.alreadyOnHub`, so a hub-scoped pick says "already on this
  hub" rather than claiming the person is already on the chợ.

The first two belong to work committed earlier in this branch; the keys land
here because they share a file with the third.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ca44b3f4-2aa6-49c5-9ec2-187a415a1cb9


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kody-ai

kody-ai Bot commented Aug 26, 2026 •

Copy link
Copy Markdown

Code Review Could Not Complete ⚠️

The review failed before suggestions could be generated.

Reason: The configured API key (google_gemini) is out of credits or has hit its billing limit. Top up the account or adjust the plan.

After fixing the issue, comment @kody review on this PR to re-run the review.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Validate Business Logic: Ask Kody to validate your code against business rules by adding a comment with the @kody -v business-logic command.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ✅

Access your configuration settings here.

​

@laithanhhung
laithanhhung merged commit 9eae573 into dev Aug 26, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant