Skip to content

Add Next.js API for probe test assignments - #11

Open
charrmint wants to merge 3 commits into
mainfrom
feature/7-assignment-api
Open

charrmint wants to merge 3 commits into
mainfrom
feature/7-assignment-api

Conversation

@charrmint

Copy link
Copy Markdown

Add Next.js API for probe test assignments

Summary

Adds local Next.js API routes for managing probe test assignments:

  • Lists available probes and their current assignments.
  • Lists available test revisions.
  • Assigns or clears a probe’s test revision.
  • Separates route handling, service logic, data access, and shared Supabase client creation.
  • Restricts the routes to development until authentication and authorization are available.
  • Documents the required server-side Supabase configuration and API usage.

Related issue

Closes #7

Testing

  • npm ci — passed
  • npm run test:unit — 4 tests passed
  • npm run build — passed
  • npm test — 3 tests passed
  • npx supabase test db — 85 tests passed
  • Verified listing, assigning, rejecting an unknown revision, and clearing an assignment against local Supabase.

Checklist

  • I ran all tests and they passed, and I have recorded the results above.
  • I have updated all docs where necessary.
  • I have reviewed the code and can explain the changes.

@charrmint
charrmint requested a review from Ani-nem November 26, 2026 08:01

@Ani-nem Ani-nem left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each of your routes creates an assignment service and then calls one method on it. For both the GET routes- the method simply calls a function that is already defined in data.ts.

I don't really see the advantage of this 'service' middle layer you have- i think it would be cleaner/easier to follow if we removed the service layer and each route would just import and call the function it needs.

@Ani-nem

Ani-nem commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

another thing would be to see if we can make the tests run the apis against a dispoable local supabase instance. You could start with the data already in seed.sql and add testdata if needed. Fairly certain this is possible- might need to do some research as to how.

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.

Read and update probe assignments through the API

2 participants