feat(order-forms): add OrderForm REST API#5360
Open
toommz wants to merge 8 commits into
Open
Conversation
This was referenced Apr 17, 2026
vincent-pochet
approved these changes
Apr 20, 2026
2c38e9c to
6c7aa47
Compare
b380867 to
da8acfa
Compare
c23fa2f to
144faf7
Compare
fc38c49 to
78c39ac
Compare
78c39ac to
580e579
Compare
vincent-pochet
approved these changes
May 19, 2026
OrderForm read-only REST API for listing and showing order forms, with filters (status, customer_id, number, quote_number, owner_id, and created_at / expires_at ranges). Split from the combined read-order-form branch to unblock REST QA independently of frontend. Add OrderForm model extensions, query object with filters, REST controller (index and show) with inlined index action, serializer, and routes. Register order_form in ApiKey::RESOURCES.
## Context The `order_forms` table has a nullable `signed_by_user_id` foreign key to `users`, but the `OrderForm` model was missing the corresponding Active Record association. The `:signed` factory trait worked around the gap by setting the foreign key directly via `association(:user).id`. ## Description Declare `belongs_to :signed_by_user, class_name: "User", optional: true` on `OrderForm`, update the `:signed` factory trait to use the association, and assert it in the model spec.
## Context `OrderForm` declares `belongs_to :customer`, but the `Customer` model was missing the inverse `has_many :order_forms`. This left the association one-sided and prevented querying a customer's order forms through the usual Active Record idiom (mirroring `has_many :quotes`, which is already in place). ## Description Declare `has_many :order_forms` on `Customer` and assert it in the model spec.
ba54221 to
85174ca
Compare
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.
Roadmap Task
👉 Quotes & Order Forms
Context
This is PR 1 of 4 in a stacked split of the original combined read-only branch. REST is separated from GraphQL so it can be QA'd via curl/Postman and shipped independently of frontend availability.
Stack:
Description
Add OrderForm read-only REST API plus the shared infrastructure used by all the stacked branches:
OrderFormsControllerwith inlinedindexandshowactionsV1::OrderFormSerializerfor REST API serializationOrderFormsQuerywith filters: status, customer_id, number, quote_number, owner_id, created_at range, expires_at rangeQueries::OrderFormsQueryFiltersContractfor filter validationOrderFormfactory with traits (signed, expired, voided, expiring_tomorrow, expired_yesterday)resources :order_forms, only: %i[show index]ApiKey::RESOURCESupdated withorder_form