Repository navigation
feat(api): employer-side interview scheduling — the loop closes - #561
Merged
Merged
Conversation
`/v1/scheduling` is the candidate's half: two token-addressed routes for viewing and booking a slot. There was no employer half at all — nothing in the system could create a slot or mint a link — so the office scheduling screen had nothing to call and rendered MOCK_ constants (#525). #540 reads as "wire the screen to the scheduling SDK resource". That resource has two methods, `getLink` and `bookSlot`, and both are the candidate's. The tables have existed since migration 307 and became reachable when 335 added the grants they were created without; only the endpoints were missing. Adds GET/POST for interview slots and scheduling links under /v1/employer/scheduling, authorised with resolveApplicationOrgAccess and PIPELINE_ROLES, 404 before 403 so application ids cannot be probed. The link token is deliberately not accepted from the client: the column defaults to encode(gen_random_bytes(32), 'hex'), so the secret is generated in the database and cannot be chosen or predicted by a caller. ## The loop closes Verified against a live local API, end to end: 1. employer POSTs a slot -> status "proposed" 2. employer POSTs a link -> token generated by the DB 3. candidate GETs /v1/scheduling/{token} -> org "Unicorn", job "Senior Software Engineer", 1 slot offered 4. candidate POSTs .../book -> booked 5. slot status -> "booked" That flow has never been possible before: the candidate half existed but nothing could produce the slots and links it consumes. Access control checked rather than assumed: candidate proposes a slot on their own application -> 403 candidate lists slots -> 403 nonexistent application -> 404, not 403 slot_end before slot_start -> 400 ## Not covered Calendar connections. core.calendar_connections stores access_token_encrypted / refresh_token_encrypted / provider_account_id for Google and Outlook — that is an OAuth integration, not a CRUD endpoint. The "Connect Google/Outlook" panel stays disabled and the screen keeps its sample-data label until that is real. Availability windows are similarly untouched; they are configuration rather than the scheduling loop. Client wiring needs SDK methods, which is a submodule change — next step. Refs #540
Contributor
📊 Performance Benchmark Results |
thinkclay
added a commit
to Scaffald/sdk
that referenced
this pull request
Aug 11, 2026
The scheduling resource had only the candidate's two token-addressed methods (getLink, bookSlot). There was no employer half at all, which is why the office scheduling screen rendered MOCK_ constants — there was nothing to call. Adds listSlots / createSlot / listLinks / createLink against the /v1/employer/scheduling routes (Scaffald/SaaS#561). Two things worth noting: - `application_id` is optional on the list calls. The office scheduling screen is organisation-wide — "Upcoming Interviews" spans every open application — so omitting it lists across every organisation the caller can act for. Appending `application_id=undefined` would 400 against the uuid schema, so the param is omitted rather than stringified; there is a test for exactly that. - `EmployerInterviewSlot` / `EmployerSchedulingLink` are deliberately separate from the existing `SchedulingSlot` / `SchedulingLink`. Those are the candidate's redacted view behind a link token; these carry the application, organisation and lifecycle status the pipeline needs. Same concept, different projections — collapsing them would leak employer fields into the candidate type. `createLink` takes no token: it is generated server-side, and a client-chosen token would be a guessable-URL vulnerability. 6 tests, mutation-checked — reverting the envelope unwrap or the optional param turns them red.
thinkclay
added a commit
that referenced
this pull request
Aug 11, 2026
Completes the client half of #540. The scheduling API landed in #561; this is the SDK and the screen. Backend change first: the two list routes now take `application_id` as *optional*. #561 required it, which turned out to be the wrong shape — the office scheduling screen is organisation-wide ("Upcoming Interviews" spans every open application, as the mock it replaces did), so with no application_id the routes list across every organisation the caller can act for. A caller with no organisations gets an empty list rather than a 403; a personal account should see an empty schedule, not an error. Screen: - Slots and links come from `/v1/employer/scheduling`. Loading, error and empty states, none of which existed. - Candidate names are resolved by joining the org's applications. The scheduling tables carry `application_id` and nothing about the person, so the name is looked up rather than denormalised. - Both modals write. "Propose Time" and "Create Link" previously opened forms whose submit button only closed the modal, so a user could believe they had scheduled an interview with a candidate who would never hear about it. They now validate and POST, with the errors surfaced. - Stat tiles derive from real slots. `no_show` is folded into completed — it exists in the database but not in this screen's union, and it is a finished interview, not an upcoming one. Two bugs found while wiring: - The link row rendered `schedule.scaffald.com/<token>`. That host does not exist; the real route is `/schedule/[token]`. A recruiter who copied that link sent a dead URL. Copy now yields a URL that resolves. - Link status read `is_active` alone. That flag is the employer's kill switch, not the clock, so an expired link showed as "Active". Expiry is now checked too. `USES_SAMPLE_DATA` narrowed to `CALENDAR_USES_SAMPLE_DATA` rather than disappearing, and the notice moved from the whole screen onto the Calendar Connections tab. Connections and availability are still placeholders, and not because a CRUD endpoint is missing: `core.calendar_connections` stores `access_token_encrypted` / `refresh_token_encrypted` / `provider_account_id` for Google and Outlook, which is an OAuth integration. Availability feeds slot generation, which does not exist either. Those two write paths stay disabled. So #540 is done; the calendar integration is not, and the label stays until it is. Verification: the existing test file said to replace its sample-data assertions with real ones rather than delete them, so it now has 12 tests covering the transform, both write paths, the URL and the expiry logic. Mutation-checked — dropping the no_show remap, judging links by is_active alone, or restoring the fabricated host each turns a test red. 248 office + utils tests pass. The routes were also driven from a real browser session: cross-origin preflight, auth and both list endpoints, returning only the caller's organisation.
This was referenced Aug 11, 2026
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.
First half of #540. The issue reads "wire the screen to the scheduling SDK resource" — but that resource has two methods,
getLinkandbookSlot, and both are the candidate's.There was no employer half at all
/v1/schedulingexposes two token-addressed routes for viewing and booking a slot. Nothing in the system could create a slot or mint a link. So the office scheduling screen had nothing to call and renderedMOCK_constants (#525).The tables have existed since migration 307 and became reachable when 335 added the grants they were created without. Only the endpoints were missing — same shape as #527, where the candidate side existed and the employer side didn't.
Adds
GET/POSTfor slots and links under/v1/employer/scheduling, authorised withresolveApplicationOrgAccess+PIPELINE_ROLES.The link token is deliberately not accepted from the client — the column defaults to
encode(gen_random_bytes(32), 'hex'), so the secret is generated in the database and can't be chosen or predicted.The loop closes
Verified end to end against a live local API:
That flow has never been possible. The candidate half existed but nothing could produce what it consumes.
Access control checked rather than assumed:
What this deliberately doesn't cover
Calendar connections.
core.calendar_connectionsstoresaccess_token_encrypted/refresh_token_encrypted/provider_account_idfor Google and Outlook — that's an OAuth integration, not a CRUD endpoint. The "Connect Google/Outlook" panel stays disabled and the screen keeps its sample-data label until that's real.Availability windows are untouched too — configuration rather than the scheduling loop.
Client wiring needs SDK methods, which is a submodule change: next step.
81 backend tests, zero new typecheck errors in the new file. Test data cleaned up — slots, links and bookings all back to 0 rows.
🤖 Generated with Claude Code