Skip to content

feat(order-forms): add OrderForm REST API#5360

Open
toommz wants to merge 8 commits into
mainfrom
feat/order-forms/read-order-form-rest
Open

feat(order-forms): add OrderForm REST API#5360
toommz wants to merge 8 commits into
mainfrom
feat/order-forms/read-order-form-rest

Conversation

@toommz
Copy link
Copy Markdown
Contributor

@toommz toommz commented Apr 17, 2026

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:

  • #this — OrderForm REST (merges first)
  • OrderForm GraphQL (stacked)
  • Order REST (stacked)
  • Order GraphQL (stacked)

Description

Add OrderForm read-only REST API plus the shared infrastructure used by all the stacked branches:

  • OrderFormsController with inlined index and show actions
  • V1::OrderFormSerializer for REST API serialization
  • OrderFormsQuery with filters: status, customer_id, number, quote_number, owner_id, created_at range, expires_at range
  • Queries::OrderFormsQueryFiltersContract for filter validation
  • OrderForm factory with traits (signed, expired, voided, expiring_tomorrow, expired_yesterday)
  • Route resources :order_forms, only: %i[show index]
  • ApiKey::RESOURCES updated with order_form
  • Full specs for serializer, query, controller, and model

Comment thread app/controllers/api/v1/order_forms_controller.rb Outdated
@rinasergeeva rinasergeeva force-pushed the feat/epic/order-forms branch 17 times, most recently from 2c38e9c to 6c7aa47 Compare April 27, 2026 09:08
@groyoh groyoh force-pushed the feat/epic/order-forms branch 2 times, most recently from b380867 to da8acfa Compare April 29, 2026 14:20
@groyoh groyoh force-pushed the feat/epic/order-forms branch from c23fa2f to 144faf7 Compare May 7, 2026 13:04
Base automatically changed from feat/epic/order-forms to main May 7, 2026 14:12
@toommz toommz force-pushed the feat/order-forms/read-order-form-rest branch 2 times, most recently from fc38c49 to 78c39ac Compare May 18, 2026 15:23
@toommz toommz force-pushed the feat/order-forms/read-order-form-rest branch from 78c39ac to 580e579 Compare May 18, 2026 15:41
Comment thread app/models/order_form.rb
toommz added 8 commits May 19, 2026 14:15
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.
@toommz toommz force-pushed the feat/order-forms/read-order-form-rest branch from ba54221 to 85174ca Compare May 19, 2026 12:15
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.

2 participants