Add the Job data model, its invariants, and a believable seed - #17
Open
shiftyp wants to merge 1 commit into
Open
Add the Job data model, its invariants, and a believable seed#17shiftyp wants to merge 1 commit into
shiftyp wants to merge 1 commit into
Conversation
The skeleton gains its domain: User, Job, and an append-only JobEvent history, plus the three promises every later feature leans on — every query scoped by userId, soft delete via deletedAt, and history written in the same transaction as the change it records. - schema + 0001_init migration (enums, indexes, cascades) - domain: CreateJob validation at the boundary; listJobs/getJob/createJob (createJob writes Job + CREATED event atomically) - seed: idempotent six-week job search — statuses across the pipeline, events spread over weeks, follow-ups due soon and overdue - specs: docs/specs/jobs/data-model.md and docs/specs/jobs/seed.md - tests: integration suite exercising all three promises on PGlite Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BEm9bvh3JdTEnbsQaddiid
shiftyp
commented
Sep 4, 2026
| // complete: every later feature deepens a table that already exists. | ||
| // | ||
| // Three promises every query keeps (see docs/specs/jobs/data-model.md): | ||
| // 1. Every read and write is scoped by userId. |
Contributor
Author
There was a problem hiding this comment.
I don't understand this, please explain more in the comment
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.
What & why
The skeleton gains its domain. Two tables and three promises — a
User,their
Jobs, and an append-onlyJobEventhistory, with the ground rulesevery later feature leans on: every query scoped by the current user, soft
delete via
deletedAt, and history written in the same transaction as thechange it records. Plus a seed that reads like a real six-week job search,
because the data model demos as well as its data.
Closes #1
Docs rode along
docs/specs/jobs/data-model.md,docs/specs/jobs/seed.md) — evergreen, present tense,no issue numbers or history inside the spec
Verified
pnpm testandpnpm typecheckpass locallyidentical counts; browse
Job/JobEventin Prisma Studio)ids trusted; foreign resources resolve to nothing
For the reviewer
Start with the two specs — they state the three promises the tests then
exercise. The schema deliberately has no auth tables (dev-identity era)
and no
[userId, followUpDate]index (no query reads by follow-up dateyet; indexes arrive with the queries that earn them). The seed is
skip-if-present idempotent — run it twice and check the counts.
The least-sure spot:
CreateJob's salary refine puts the error onsalaryMin— argue forsalaryMaxif you feel strongly.