-
-
Notifications
You must be signed in to change notification settings - Fork 178
Fix api, and add api resource response. #1257
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
base: development
Are you sure you want to change the base?
Conversation
AVMG20
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good changes! I like the implementation of resource classes—this helps a lot with consistency in the API.
Besides some minor issues, it's a good PR for making the API better!
…ists filters in UserResouce.
|
@Ferks-FK can you post an update here on github? |
|
After further analyzing the purpose of the PR, I decided to remove the API documentation using the scribe. |
Refactor all API endpoints to use JsonResource for responses.
As well as fix fields related to displaying and updating credits. (#1256)
it is necessary to decide on the maximum amount of credits a user can have on their account, in this PR it is currently set to 50K, this should be discussed before merging.
Due to the use of JsonResource in this PR's API responses, the format in which the data is delivered has changed slightly.
Responses from a list of resources, for example:
/api/usersnow have more organized pagination fields and the user data comes within attribute “data” array.Example:
{ "data": [ { "id": 1, "name": "Ferks", "email": "[email protected]", "credits": 50000, "server_limit": 25, } ] }The same “data” attribute will be present on specific resource routes, such as
/api/users/1.Also adds nested includes that can be useful for user routes.
This makes it possible to do:
api/users?include=servers.productandapi/users?include=vouchers.users.