Skip to main content

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.

nameduration_daysunit_cost
"1 Month"3050
"3 Months"90100

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.

We chose not to use two other places for the price.

Rejected placeWhy it lost
A Billing::ProductA product is what Jod sells for money, and a job posting price is what a company spends in credits
One number in an app settingSales 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.
ContextDetails
AggregateJobPostingPrice has no children.
LayerThe Careers price list, which Billing never reads
Upstream dependenciesNone: instrument names the Billing credit as a string, with no foreign key
Downstream dependentsCareers::JobPosting, which points at the price it copied

State Machine​

A price is active or inactive, in the column is_active.

FromToTriggerNotes
(new)is_active: trueUC-1A new price shows on the job form at once
is_active: trueis_active: falseUC-3Employers can no longer pick it
is_active: falseis_active: trueUC-4Employers can pick it again

Use Cases​

IDUse CaseTriggerActor
UC-1Create a job posting price that employers can buySales sets up a price, or marketing decides a new priceSales
UC-2Edit the name, the days or the credit cost of a job posting priceMarketing changes a priceSales
UC-3Deactivate a job posting price so employers can no longer pick itSales stops selling a priceSales
UC-4Activate a job posting price again so employers can pick itSales sells an old price againSales
UC-5View every job posting price in the Team PortalSales opens the job posting prices pageSales
UC-6View the active job posting prices on the job form and the renew dialogAn HQ manager posts or renews a jobHQ manager

UC-1: Create a job posting price that employers can buy​

FieldDetails
ActorIdentities::Admin (sales)
TriggerSales sets up a price, or marketing decides a new price

Preconditions:

  • None.

System Behaviour:

  1. Sales enters name, duration_days and unit_cost.
  2. The database sets instrument to its default, 'placement'.
  3. The system creates the price with is_active: true.
  4. 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.

Business Rules:

  • duration_days is a whole number greater than 0.
  • unit_cost is a whole number greater than 0.
    • A spend of 0 units raises a 500 in Billing::SpendService, so a free price cannot exist.
  • name is 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 JobPostingPrice exists.
  • 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​

FieldDetails
ActorIdentities::Admin (sales)
TriggerMarketing changes a price

Preconditions:

  • The price exists.

System Behaviour:

  1. Sales changes name, duration_days or unit_cost.
  2. 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::JobPosting copies duration_days and unit_cost when it is created.
    • So an edit changes only the job postings that jobs buy after it.
  • 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::JobPosting created before the edit keeps its copied values.

UC-3: Deactivate a job posting price so employers can no longer pick it​

FieldDetails
ActorIdentities::Admin (sales)
TriggerSales stops selling a price

Preconditions:

  • The price has is_active: true.

System Behaviour:

  1. Sales deactivates the price.
  2. The system sets is_active: false.

Business Rules:

  • Every Careers::JobPosting created before the change stays the same, and its Careers::Job stays posted until its ends_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​

FieldDetails
ActorIdentities::Admin (sales)
TriggerSales sells an old price again

Preconditions:

  • The price has is_active: false.

System Behaviour:

  1. Sales activates the price.
  2. 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​

FieldDetails
ActorIdentities::Admin (sales)
TriggerSales opens the job posting prices page

Preconditions:

  • None.

System Behaviour:

  1. The system lists every price with its name, duration_days, unit_cost and is_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​

FieldDetails
ActorOrg::Membership (HQ manager)
TriggerAn HQ manager posts or renews a job

Preconditions:

  • None.

System Behaviour:

  1. The system lists the prices with is_active: true, ordered by duration_days.
  2. The form shows each price with its credit cost, such as "1 Month, 50 credits".
  3. 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​

  1. duration_days is greater than 0, by the CHECK duration_days > 0.
  2. unit_cost is greater than 0, by the CHECK unit_cost > 0.
  3. name is unique across every Careers price.
  4. instrument is one value of the Rails enum on Careers::JobPostingPrice, which holds only placement.
    • Careers passes it to Billing::SpendValidator and Billing::SpendService.consume_now, so Careers code writes no :placement.
  5. A change to a price never changes a Careers::JobPosting that exists.
  6. 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 ModelRelationshipInteraction
Billing::SpendServicenoneinstrument names the credit that consume_now spends, as a string with no foreign key
Careers::JobPostinghas_manyA job posting copies duration_days and unit_cost when a job pays, and keeps careers_job_posting_price_id
Careers::JobnoneA job never points at a price, and it reaches the price only through its job postings
Identities::AdminnoneSales creates and edits prices in the Team Portal, and the table stores no author

Related pages: