Links | Endpoints |
---|---|
POST Registration | /api/auth/register |
POST Login | /api/auth/login |
GET Prisons | /api/prisons |
GET Prisons by ID | /api/prisons/:id |
GET Prisoners | /api/prisoners |
GET Prisoners by ID | /api/prisoners/:id |
GET Skills | /api/skills |
GET Skills by Prisoner ID | /api/prisoners/:id/skills |
Links | Endpoints |
---|---|
POST Prisoners | /api/prisoners |
PUT Prisoner by ID | /api/prisoners/:id |
DEL Prisoner by ID | /api/prisoners/:id |
POST Prison | /api/prisons/ |
PUT Prison by ID | /api/prisons/:id |
DEL Prison by ID | /api/prison/:id |
POST Skills | /api/skills |
PUT Skills by Skill ID | /api/skills/:id |
DEL Skills by Skill ID | /api/skills/:id/ |
{
"username": "janedoe1",
"password": "DoePass"
}
Returns id, username, and hashed password:
{
"id": 1,
"username": "janedoe1",
"password": "hashed"
}
{
"username": "janedoe1",
"password": "DoePass"
}
Returns:
{
"message": "Welcome Jane!",
"token": "keeping it secret!"
}
[
{
id: integer,
name: string,
address: string,
user_id: string // the admin assigned to the prison
},
.
.
.
]
{
id: integer,
name: string,
address: string,
user_id: string
}
.
.
.
]
}
Requires the following in JSON body:
{
name: string,
address: string,
user_id: string
}
Returns:
{
"removed": {
prison object
}
}
[
{
"id": 4,
"name": "Morgan Ensley",
"gender": "Female",
"canHaveWorkLeave": 1,
"prison_id": 1
},
.
.
.
]
{
"id": 2,
"name": "Sally Mason",
"gender": "Female",
"canHaveWorkLeave": 0,
"prison_id": 2,
"skills": [
{
"id": 2,
"name": "Cleaning",
"prisoner_id": 2
},
{
"id": 3,
"name": "Dancing",
"prisoner_id": 2
}
]
}
Required in JSON body:
{
"name" : "John Smith",
"gender" : "Male",
"canHaveWorkLeave" : true,
"prison_id" : 2
}
Returns:
{
"id": 4,
"name": "John Smith",
"gender": "Male",
"canHaveWorkLeave": 1,
"prison_id": 2
}
Required in JSON body
{
"name" : "Alex Smith",
"gender" : "Male",
"canHaveWorkLeave" : true,
"prison_id" : 2
}
Returns:
{
"name" : "Alex Smith",
"gender" : "Male",
"canHaveWorkLeave" : true,
"prison_id" : 2
}
{
"id": 1,
"name": "Billy Bob",
"gender": "Male",
"canHaveWorkLeave": 1,
"prison_id": 1,
"skills": [
{
"id": 1,
"name": "Interior painting",
"prisoner_id": 1
},
{
"id": 2,
"name": "Cleaning",
"prisoner_id": 1
}
]
}
{
"name" : "Structural Engineering",
"prisoner_id" : "4"
}
Returns:
{
"id": 5,
"name": "Structural Engineering",
"prisoner_id": 4
}
Returns:
{
"removed": {
prisoner object
}
}
Returns:
{
"removed": {
prison object
}
}
Returns:
{
"removed": {
prisoner object
}
}