Skip to content

Add endpoint for admins to delete instruments added in error#136

Open
sfoale wants to merge 2 commits into
masterfrom
ins-delete-endpoint
Open

Add endpoint for admins to delete instruments added in error#136
sfoale wants to merge 2 commits into
masterfrom
ins-delete-endpoint

Conversation

@sfoale

@sfoale sfoale commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Add DELETE /api/v1/instruments/{id}, restricted to the instrument's submitter or an admin. Removes the instrument's footprint CCD rows and refuses with 409 if any pointing still references the instrument, to avoid orphaning observation records.

submitter or an admin. Removes the instrument's footprint CCD rows and
refuses with 409 if any pointing still references the instrument, to
avoid orphaning observation records.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds an authenticated DELETE endpoint to remove instruments that were added incorrectly, including cleanup of associated footprint_ccd rows and protection against deleting instruments still referenced by pointings.

Changes:

  • Add DELETE /api/v1/instruments/{instrument_id} route with submitter/admin authorization, pointing reference checks (409), and footprint cleanup.
  • Introduce DeleteInstrumentResponse schema for consistent deletion responses.
  • Add FastAPI integration tests covering success and key error cases (401/403/404/409).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
tests/fastapi/test_instrument.py Adds a new test suite validating instrument deletion behaviors and authorization rules.
server/schemas/instrument.py Adds a response schema for the delete-instrument endpoint.
server/routes/instrument/router.py Registers the new delete-instrument router with the instrument routes.
server/routes/instrument/delete_instrument.py Implements the delete endpoint, including permission checks, pointing conflict protection, and footprint cleanup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/fastapi/test_instrument.py Outdated
Comment thread server/routes/instrument/delete_instrument.py
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.

2 participants