Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dont throw when no relations are provided for some or all #928

Merged
merged 2 commits into from
Feb 10, 2025

Conversation

3mcd
Copy link
Member

@3mcd 3mcd commented Feb 6, 2025

Issue(s) Resolved

Resolves #871

High-level Explanation of PR

An error is thrown in removeAllPubRelationsBySlugs when the array of provided slugs is empty. This PR returns an empty array early in such cases, preventing the error.

Test Plan

  1. Delete a single relation using the DELETE /relations endpoint, e.g.
DELETE https://app.pubpub.org/api/v0/c/arcadia-dev/site/pubs/c7e02fdc-e3bf-4422-a5f7-8e112e3b3e8d/relations
Authorization: Bearer <token>
Prefer: "return=representation"
Accept: "*/*"
Content-Type: "application/json",

{
  "arcadia-dev:pub-content-types": [ "0a8b81c9-e025-4e08-94aa-f669630b62f0" ]
}
  1. The relation should be deleted with a response status code of 200.

Screenshots (if applicable)

Notes

@3mcd 3mcd force-pushed the em/fix-delete-relations branch from 86544b0 to bf8eaab Compare February 6, 2025 17:26
@3mcd 3mcd requested review from tefkah and allisonking February 10, 2025 16:24
Copy link
Contributor

@allisonking allisonking left a comment

Choose a reason for hiding this comment

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

confirmed I get a 200 now!

@3mcd 3mcd merged commit 54fc1e8 into main Feb 10, 2025
6 checks passed
@3mcd 3mcd deleted the em/fix-delete-relations branch February 10, 2025 20:16
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.

DELETE <pub>/relations API returns 400 when it should return 200
2 participants