Backend deployed at herokug https://bwdevdesk.herokuapp.com](https://bwdevdesk.herokuapp.com/)
Postman Documentation: https://documenter.getpostman.com/view/9969236/SWTEdx1A?version=latest
Deploy Site: https://dev-desk.now.sh/
- PostgresQL
- Node.js
- Express.js
- Knex.js
- JWT Token
- Bcrypt
- Jest
- Supertest
DevDesk Que Backend consists of three types of users:
- student - can access ticket list, a single ticket, create, and delete a ticket
- staff - can claim a ticket, edit a solution to a ticket
- both - can access and edit all resources
Each users are assigned a JWT token upon login. The JWT token determines which URI a user can access.
The user attempted to access the path that they are not allowed will receive unauthorized message in their response.
Method | Data Type | Usage |
---|---|---|
id | Integer | Primary Key |
name | String | User's name |
String | User's login | |
String | User's password | |
role | String | User's role |
Method | Data Type | Usage |
---|---|---|
id | Integer | Primary Key |
title | String | Ticket's title/ topic as posted by student user |
description | String | Ticket's description created by student user |
status | String | Ticket status, can be open, claimed, or closed |
attamptedSolutions | String | Student's attempted solutions |
category | String | Ticket's category |
solution | Object | Default to null, where solution object will be assigned to |
createdAt | Automatically created upon ticket creation |
Method | Data Type | Usage |
---|---|---|
id | Integer | Primary Key |
ticketId | Integer | Foreign Key, points to ticket ID |
body | String | Solutions posted by staff user |
answerer | String | Staff that response to this ticket |
createdAt | Automatically created upon solution creation |
Method | Endpoint | Access Control | Description |
---|---|---|---|
POST | /auth/register |
all users | Creat a new user with preferred role |
POST | /auth/login |
all users | Return tokens for designated user |
Register
{
name: STRING
email: STRING
password: STRING
role: STRING
}
Login
{
email: STRING
password: STRING
role: STRING
}
Method | Endpoint | Access Control | Description |
---|---|---|---|
GET | /api/tickets |
all users | Returns list of all tickets |
GET | /api/tickets/:id |
all users | Return a single ticket |
POST | /api/tickets |
student / both users | Create a new ticket with description and attempted solution |
PUT | /api/tickets/:id |
staff / both users | Update ticket status to either "open", "claimed", or "closed" |
DELETE | /api/tickets/:id |
student / both users | Delete a ticket |
POST Create New Ticket
{
title: STRING,
status: STRING,
description: STRING,
attemptedSolutions: STRING,
category: STRING
}
POST Claim Ticket
{
status: STRING,
}
Method | Endpoint | Access Control | Description |
---|---|---|---|
POST | /api/tickets/:id/solutions |
staff / both users | Add a solution to a ticket |
PUT | /api/tickets/:id/solutions |
staff / both users | Edit a solution of a ticket |
DEL | /api/tickets/:id/solutions |
staff / both users | Delete a solution of a ticket |
POST & PUT Solutions
{
body: STRING,
}
Method | Endpoint | Access Control | Description |
---|---|---|---|
GET | /api/mytickets |
all users | Return a list of tickets the user. For student, the list will be the tickets created by the student. For staff, the list will be the tickets that was assigned to them |
Method | Endpoint | Access Control | Description |
---|---|---|---|
GET | /api/user/:id |
the owner of the ID | Return the user ID. Can only be accessed byt the owner of that ID |
PUT | /api/user/:id |
the owner of the ID | Edit user information |
{
name: STRING
email: STRING
role: STRING
}