Add endpoint for admins to delete instruments added in error#136
Open
sfoale wants to merge 2 commits into
Open
Add endpoint for admins to delete instruments added in error#136sfoale wants to merge 2 commits into
sfoale wants to merge 2 commits into
Conversation
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.
There was a problem hiding this comment.
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
DeleteInstrumentResponseschema 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.
… assert create success in test helper.
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.
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.