feat: ordering update - #40
Merged
Merged
Conversation
Snapshots 0010 and 0011 both recorded 0009 as prevId, so drizzle-kit refused to diff the schema and no new migration could be generated. Only the lineage pointer was wrong: 0011's snapshot already contained both 0010's `name_changed_at` column and its own `sim_export_cache` table, and the two migrations touch unrelated tables. No applied SQL changes, so no environment needs re-migrating. Claude-Session: https://claude.ai/code/session_01GvXPAmtJMzagwAWdiEeWiH
Both "Back" buttons passed a next/link into `render` while `nativeButton` still defaulted to true, so Base UI warned that a non-<button> was dropping native button semantics, which affects forms and accessibility. Matches the pattern already used in OrderTable and the orders index. Claude-Session: https://claude.ai/code/session_01GvXPAmtJMzagwAWdiEeWiH
Ordering took six clicks and a full page round-trip per item, and every item re-asked for the fund type and STF bucket. Members also had to know the finance model to file a request at all. Members now submit items only. The form drops fund type and bucket, and one submission can carry up to 50 items: "Add another item" grows the single-item form into a full-width grid, and "Paste a list" ingests rows copied out of a spreadsheet. Items submitted together share a batchId. Vendor is guessed from the link's domain when left blank. Officers own the finance model instead. The queue splits pending orders into "Needs triage" and "Ready to review", and acts on a multi-select: POST /api/orders/assign sets fund, bucket and quarter, and POST /api/orders/bulk-action approves or denies. Balance checks move from submit time to assign/approve time. A member has no bucket to check against, and a balance checked at submit is stale by review. Two consequences: - Approving a selection checks each fund/bucket group's total at once. Checking one at a time would let a batch overdraw a bucket that every individual order fits inside. - Assigning counts the selection plus everything already queued against that bucket. Pending orders don't reduce a bucket's remaining balance, so otherwise an officer could park more there than could be approved. fund_type is now nullable, which forces a SQLite table rebuild. The generated INSERT selected the three new columns from the old table; SQLite's double-quoted-identifier fallback turned them into string literals rather than erroring, writing assigned_by='assigned_by' into every existing row. The migration selects NULL for those columns instead. Claude-Session: https://claude.ai/code/session_01GvXPAmtJMzagwAWdiEeWiH
Adds an ordering-workflow section to the architecture overview covering the member/officer split, the two triage endpoints, and why balance checks run at assign and approve time rather than at submission. The forms guide used OrderForm as its cross-field superRefine example, which no longer applies now that the form validates an array of items; it points at orderAssignSchema instead and gains a repeatable-rows section for useFieldArray and the paste panel. Claude-Session: https://claude.ai/code/session_01GvXPAmtJMzagwAWdiEeWiH
matejstastny
approved these changes
Aug 21, 2026
matejstastny
left a comment
Member
There was a problem hiding this comment.
Tested, works well, good change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rewrote ordering system for clarity.