- Node
- Express
- Postgres
- JWT
- Typescript
- TypeORM
- I assumed that the user will specify the acount type when creating a new user
- POST
http://localhost:3001/api/auth/register
to register an account
{
"firstName": "Kingsley",
"lastName": "Obot",
"email": "[email protected]",
"password": "secret",
"role": "Admin" // Optional, default is user
}
- POST
http://localhost:3001/api/auth/login
to login
{
"email": "[email protected]",
"password": "secret"
}
- POST
http://localhost:3001/api/tickets
to create a ticket. Add tokenx-access-token
in the header
{
"summary": "Setup Heroku",
"description": "Set up heroku server on the project",
"type": "BugFix",
"complexity": "Low",
"completionTime": 2,
"cost": 2000,
"status": "New"
}
- GET
http://localhost:3001/api/tickets
to get all tickets (Admin role). Add tokenx-access-token
in the header
- GET
http://localhost:3001/api/tickets/{id}
to get a single ticket. You can only get a ticket you created. Add tokenx-access-token
in the header
- PUT
http://localhost:3001/api/tickets/{id}
to make changes to a ticket (Admin role). Add tokenx-access-token
in the header
{
"type": "Enhancement",
"status": "Accepted" // Note: You can change other fields also.
}
Improvements
- Unfortunately, due to time constraints, I couldn't refactor the controller to make use of a Service.