Skip to content

feat(scheduling): employer-side slot and link methods - #17

Merged
thinkclay merged 1 commit into
mainfrom
feat/employer-scheduling
Aug 11, 2026
Merged

thinkclay merged 1 commit into
mainfrom
feat/employer-scheduling

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

The employer half of interview scheduling. Pairs with Scaffald/SaaS#561, which added the /v1/employer/scheduling routes.

Why

Scheduling had two methods, both the candidate's: getLink(token) and bookSlot(token, slotId). Nothing could create a slot or mint a link. That is why the office scheduling screen renders MOCK_SLOTS / MOCK_LINKS — there was no employer API to call, so the screen was never wired (Scaffald/SaaS#525, #540).

What

method route
listSlots(params?) GET /v1/employer/scheduling/slots
createSlot(params) POST /v1/employer/scheduling/slots
listLinks(params?) GET /v1/employer/scheduling/links
createLink(params) POST /v1/employer/scheduling/links

Two decisions

application_id is optional on the list calls. The office screen is organisation-wide, so omitting it lists across every organisation the caller can act for. The param is omitted rather than stringified — application_id=undefined would 400 against the uuid schema. Tested directly.

New types rather than reusing the existing ones. SchedulingSlot / SchedulingLink are the candidate's redacted view behind a link token. EmployerInterviewSlot / EmployerSchedulingLink carry application_id, organization_id, status, proposed_by. Same concept, different projections; collapsing them would leak employer fields into the candidate type.

createLink takes no token — it is generated server-side (encode(gen_random_bytes(32), 'hex')). A client-chosen token would be a guessable-URL vulnerability, so the params type cannot express one.

Verification

  • 6 new tests; full suite 777 passed.
  • Mutation-checked: returning the {data} envelope instead of unwrapping it, and always appending application_id, each turn a test red.
  • pnpm lint clean (the one remaining info is pre-existing in http-client.test.ts), pnpm typecheck clean, pnpm build clean.
  • The routes themselves were driven end to end against a live local API before this PR: org-wide reads return only the caller's organisation, and a cross-org probe 404s.

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.
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.

1 participant