Careers::JobPostingPrice
Purpose
JobPostingPrice is one price for a job posting, with its number of days and its credit cost.
- Sales keeps the list of prices in the Team Portal.
- An employer picks one price when it posts or renews a job.
- The job then pays the credit cost in placement credits, and it stays posted for the number of days.
The model serves two user stories.
- As Sales, I want to change the job posting prices without a deploy, so we can apply new prices.
- As an HQ manager, I want to see the period and its cost before I post.
Alvin and marketing set the first prices, with 1 credit = SGD 1.
name | duration_days | unit_cost |
|---|---|---|
| "1 Month" | 30 | 50 |
| "3 Months" | 90 | 100 |
Schema truth: jodapp-api/docs/db/careers.dbml, table careers_job_posting_prices.
Why the price lives in Careers
Each product domain owns its price list, and Billing owns only the credits.
- Billing D18 — Product domains spend credits only through SpendService rules this.
- A Careers price has a number of posting days, which is a word that only Careers uses.
- So Billing never reads
careers_job_posting_prices.
We chose not to use two other places for the price.
| Rejected place | Why it lost |
|---|---|
A Billing::Product | A product is what Jod sells for money, and a job posting price is what a company spends in credits |
| One number in an app setting | Sales could not change it without an engineer, and the old prices would be lost |
Model Context
Legend:
- The orange node is the subject of this page.
- Lavender nodes belong to the Careers domain, and grey nodes belong to other domains.
| Context | Details |
|---|---|
| Aggregate | JobPostingPrice has no children. |
| Layer | The Careers price list, which Billing never reads |
| Upstream dependencies | None: instrument names the Billing credit as a string, with no foreign key |
| Downstream dependents | Careers::JobPosting, which points at the price it copied |
State Machine
A price is active or inactive, in the column is_active.
| From | To | Trigger | Notes |
|---|---|---|---|
| (new) | is_active: true | UC-1 | A new price shows on the job form at once |
is_active: true | is_active: false | UC-3 | Employers can no longer pick it |
is_active: false | is_active: true | UC-4 | Employers can pick it again |
Use Cases
| ID | Use Case | Trigger | Actor |
|---|---|---|---|
| UC-1 | Create a job posting price that employers can buy | Sales sets up a price, or marketing decides a new price | Sales |
| UC-2 | Edit the name, the days or the credit cost of a job posting price | Marketing changes a price | Sales |
| UC-3 | Deactivate a job posting price so employers can no longer pick it | Sales stops selling a price | Sales |
| UC-4 | Activate a job posting price again so employers can pick it | Sales sells an old price again | Sales |
| UC-5 | View every job posting price in the Team Portal | Sales opens the job posting prices page | Sales |
| UC-6 | View the active job posting prices on the job form and the renew dialog | An HQ manager posts or renews a job | HQ manager |
UC-1: Create a job posting price that employers can buy
| Field | Details |
|---|---|
| Actor | Identities::Admin (sales) |
| Trigger | Sales sets up a price, or marketing decides a new price |
Preconditions:
- None.
System Behaviour:
- Sales enters
name,duration_daysandunit_cost. - The database sets
instrumentto its default,'placement'. - The system creates the price with
is_active: true. - The system gives the price a
uuid, which the employer endpoints use to name it.- Team endpoints and Team Portal addresses name the price by its
id, because only Jod staff use them.
- Team endpoints and Team Portal addresses name the price by its
Business Rules:
duration_daysis a whole number greater than 0.unit_costis a whole number greater than 0.- A spend of 0 units raises a 500 in
Billing::SpendService, so a free price cannot exist.
- A spend of 0 units raises a 500 in
nameis unique across every Careers price, active or inactive.- Sales never picks the
instrument, because a Careers job always pays with placement credits.
Postconditions:
- One new active
JobPostingPriceexists. - The job form and the renew dialog show it.
UC-2: Edit the name, the days or the credit cost of a job posting price
| Field | Details |
|---|---|
| Actor | Identities::Admin (sales) |
| Trigger | Marketing changes a price |
Preconditions:
- The price exists.
System Behaviour:
- Sales changes
name,duration_daysorunit_cost. - The system saves the price.
Business Rules:
- The rules of UC-1 hold for the new values.
- An edit is allowed even when job postings point at the price.
- Each
Careers::JobPostingcopiesduration_daysandunit_costwhen it is created. - So an edit changes only the job postings that jobs buy after it.
- Each
- The job posting copies no
name.- The ledger entry of a past job posting keeps the old name.
- Billing copied that text when the job paid.
Postconditions:
- The next post or renew with this price uses the new values.
- Every
Careers::JobPostingcreated before the edit keeps its copied values.
UC-3: Deactivate a job posting price so employers can no longer pick it
| Field | Details |
|---|---|
| Actor | Identities::Admin (sales) |
| Trigger | Sales stops selling a price |
Preconditions:
- The price has
is_active: true.
System Behaviour:
- Sales deactivates the price.
- The system sets
is_active: false.
Business Rules:
- Every
Careers::JobPostingcreated before the change stays the same, and itsCareers::Jobstays posted until itsends_at. - When no price is active, no company can post or renew a job.
- The job form shows "Posting a job is not available right now. Please contact Jod support."
Postconditions:
- The job form and the renew dialog no longer show the price.
UC-4: Activate a job posting price again so employers can pick it
| Field | Details |
|---|---|
| Actor | Identities::Admin (sales) |
| Trigger | Sales sells an old price again |
Preconditions:
- The price has
is_active: false.
System Behaviour:
- Sales activates the price.
- The system sets
is_active: true.
Business Rules:
- The price keeps its
uuid, its days and its credit cost.
Postconditions:
- The job form and the renew dialog show the price again.
UC-5: View every job posting price in the Team Portal
| Field | Details |
|---|---|
| Actor | Identities::Admin (sales) |
| Trigger | Sales opens the job posting prices page |
Preconditions:
- None.
System Behaviour:
- The system lists every price with its
name,duration_days,unit_costandis_active.
Business Rules:
- The list shows active and inactive prices.
Postconditions:
- Read-only operation — no data changes.
UC-6: View the active job posting prices on the job form and the renew dialog
| Field | Details |
|---|---|
| Actor | Org::Membership (HQ manager) |
| Trigger | An HQ manager posts or renews a job |
Preconditions:
- None.
System Behaviour:
- The system lists the prices with
is_active: true, ordered byduration_days. - The form shows each price with its credit cost, such as "1 Month, 50 credits".
- The form sends the picked price by its
uuid.
Business Rules:
- The employer never sees an inactive price.
- The job pays the price that is saved when the employer submits.
- If Sales changes the price while the form is open, the job pays the new cost.
Postconditions:
- Read-only operation — no data changes.
Invariants
duration_daysis greater than 0, by the CHECKduration_days > 0.unit_costis greater than 0, by the CHECKunit_cost > 0.nameis unique across every Careers price.instrumentis one value of the Rails enum onCareers::JobPostingPrice, which holds onlyplacement.- Careers passes it to
Billing::SpendValidatorandBilling::SpendService.consume_now, so Careers code writes no:placement.
- Careers passes it to
- A change to a price never changes a
Careers::JobPostingthat exists. - Nobody deletes a price, because job postings point at it with a foreign key.
- Sales deactivates a price that it stops selling.
Model Interactions
| Related Model | Relationship | Interaction |
|---|---|---|
Billing::SpendService | none | instrument names the credit that consume_now spends, as a string with no foreign key |
Careers::JobPosting | has_many | A job posting copies duration_days and unit_cost when a job pays, and keeps careers_job_posting_price_id |
Careers::Job | none | A job never points at a price, and it reaches the price only through its job postings |
Identities::Admin | none | Sales creates and edits prices in the Team Portal, and the table stores no author |
Related pages:
Careers::JobPosting, the record that a price is copied into.- Billing D17 — A Careers job post buys a job posting, paid by a direct consume.
- Billing Integration Phase 3.2 — Design Plan.