You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The request body must include the following fields:
Name: string
Slug: string
Info: string?
SortDirection: 'Ascending' | 'Descending'
RunType: 'Time' | 'Score'
If the client is not authenticated, the server must return a 401 error .
If the current user's role is not ADMIN, the server must return a 403 error.
If the specified ID does not correspond to a leaderboard in the database, the server must return a 404 error.
If the leaderboard identified by the specified ID already contains a non-deleted category with the specified slug, the server must return a 409 error and return the conflicting category in the response body.
If any of the following conditions are met, the server must return a 422 error.
Slug is not between 2 and 80 characters inclusive.
Slug is not comprised solely of alphanumeric digits, hyphens, and underscores.
Name is absent or null.
Slug is absent or null.
SortDirection is absent or an invalid value.
RunType is absent or an invalid value.
Upon successful category creation, the server must return a 201 CREATED status with a response body that includes the newly-created category as well as its location on the server.
The text was updated successfully, but these errors were encountered:
SortDirection and RunType validation's a little weird to implement. To obey the rules we've set; we need to add a FluentValidation rule to catch absent cases, and the best candidate is the NotEmpty() method (otherwise; an absent field will trigger a 400, instead). However; that method also triggers for default values, and both SortDirection and RunType's enums start from the default enum value. In other words; submitting a valid request can still trigger a validation error. So we've got three choices:
Create a custom validation rule (frankly don't know how to do this)
Make the fields in the request body nullable (ew)
Not sure what to go for here. What do you think?
Also; how do we want to represent the cat's location on the server? The CategoryViewModel returns its ID and slug; admins should already know the path for it, as well. Do we want to return a field for a cat's full qualified path? I don't think that's necessary, right?
zysim
linked a pull request
Jan 6, 2025
that will
close
this issue
POST
/leaderboard/{id}/categories/create
.The request body must include the following fields:
If the client is not authenticated, the server must return a 401 error .
If the current user's role is not
ADMIN
, the server must return a 403 error.If the specified ID does not correspond to a leaderboard in the database, the server must return a 404 error.
If the leaderboard identified by the specified ID already contains a non-deleted category with the specified slug, the server must return a 409 error and return the conflicting category in the response body.
If any of the following conditions are met, the server must return a 422 error.
Upon successful category creation, the server must return a 201 CREATED status with a response body that includes the newly-created category as well as its location on the server.
The text was updated successfully, but these errors were encountered: