-
Notifications
You must be signed in to change notification settings - Fork 0
Users
Users, as the name implies, are the ones who will use our API through a front-end, the endpoints will specify what can you do with a user.
The users are separeted between underages
and adults
and between normal users
(non admins) and admins
.
field | field type | field options |
---|---|---|
id |
integer |
!null , auto , f++ , unq , pk
|
name |
string | !null |
age |
integer | |
surname |
string | |
email |
string |
!null , unq
|
nickname |
string | unq |
password |
string | hashed |
isAdmin |
boolean | dft<false> |
createdAt |
date |
!null , auto
|
updatedAt |
date |
!null , auto
|
The email
and the nickname
of the users are unique so you can't have two users with the same of any of these two fields.
The field age
is resposible to allow access of only adults parts of the api.
The field isAdmin
is a boolean that, if is true, will set the user as admin, allowing it to use all endpoints and do some things more than normal users in some endpoints.
The default endpoint is <path>:<port>/users
.
Example: http://localhost:3000/users
, path
is http://localhost
, port
is 3000
.
To see the expected response click on the function, you'll be redirected to the page that specifies its behavior.
The path /
is for the default endpoint, whatever after it will be after the default endpoint (/email
=> <path>:<port>/users/email
)
method | function | path | check |
---|---|---|---|
POST | create new user | / | |
POST | find user by email | auth | |
POST | login the user | /login | |
GET | return all users | / | auth |
GET | return user with specified pk | /:pk<integer> | auth |
PUT | change user with specified pk | /:pk<integer> | auth |
PUT | change password of user with specified pk | /:pk<integer>/update-password | auth |
DELETE | delete user with specified pk | /:pk<integer> | auth, adm |