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

Update Category Endpoint #263

Closed
Tracked by #258
TheTedder opened this issue Jan 5, 2025 · 0 comments · Fixed by #276
Closed
Tracked by #258

Update Category Endpoint #263

TheTedder opened this issue Jan 5, 2025 · 0 comments · Fixed by #276
Assignees
Labels
enhancement New feature or request high priority

Comments

@TheTedder
Copy link
Contributor

PATCH /category/{id}.

The server must return a 401 error if the client is not authenticated.

The server must return a 403 error if the current user's role is not ADMIN.

The server must return a 404 error if the given ID does not correspond to a category in the database.

The endpoint accepts a JSON request body containing an object that must contain one or several of the following fields:

  • Name: string
  • Slug: string
  • Info: string
  • SortDirection: 'Ascending' | 'Descending'

If the request body does not contain at least one of the above fields, the server must return a 422 error.

If the provided slug is already in use by a non-deleted category belonging to the same leaderboard, the server must return a 409 error including the conflicting category in the JSON response body and the server must not update any of the category's fields.

If the provided slug is present and not between 2 and 80 characters inclusive and not comprised solely of alphanumeric digits, hyphens, and underscores, the server must return a 422 error and not update any of the category's fields.

Upon a successful request, the specified fields of the category with ID id must be updated to the supplied values in the database, the category's UpdatedAt field must be set to the current time, and a 204 status code must be returned.

None of the category's fields other than those specified above may be accepted.

@TheTedder TheTedder added enhancement New feature or request high priority labels Jan 5, 2025
@zysim zysim self-assigned this Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request high priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants