Backend Task for Creation/Updation of Software requirement ticket
PORT=3000
MONGO_URI=mongodb://localhost:27017
SECRET_KEY=car
npm install
npm start
The REST API to the example app is described below.
POST /users/new
{
"email": "[email protected]",
"role": "admin",
"password": "123"
}
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImFAZ21haWwuY29tIiwidWlkIjoiUEUzcHRrcUZqIiwiaWF0IjoxNjY5OTA3NDAwfQ.RCwjOBlLVLDemBiPfm_cwSVCmagejbpckzlfrs47CMk"
}
POST /users/login
{
"email": "[email protected]",
"password": "123"
}
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImJAZ21haWwuY29tIiwidWlkIjoiM3NmdjhBYzA2IiwiaWF0IjoxNjY5OTA3NDU4fQ.Qtp1eiB6YYoqFTZIS3G2c5RjioBlvGC3BWEPBFEdw4w"
}
POST /tickets/new
{
"title": "new",
"description": "asdasdasdasdasd"
}
{
"status": "ToDo",
"_id": "6388c45fc6cc0cbad084ea95",
"uid": "N_KEkiywN",
"title": "new",
"description": "asdasdasdasdasd",
"createdAt": "2022-12-01T15:12:31.446Z",
"updatedAt": "2022-12-01T15:12:31.446Z",
"__v": 0
}
POST /tickets/assign/:id
{
"assignedTo": "[email protected]"
}
{
"Message": "Ticket successfully assigned to: [email protected]"
}
POST /tickets/done/:id
{
"Messege": "6388b14a0bbdb90498e866b5 marked as Done"
}
GET /tickets/
[
{
"_id": "6388b14a0bbdb90498e866b5",
"status": "Done",
"uid": "Uo5RiWXgZ",
"title": "new",
"description": "asdasdasdasdasd",
"createdAt": "2022-12-01T13:51:06.229Z",
"updatedAt": "2022-12-01T14:04:48.440Z",
"__v": 0
}
]
PATCH /tickets/:id
{ "title": "old", "description": "neggar", "status": "InProgress" }
{
"Messege": "Uo5RiWXgZ updated"
}
DELETE /users/delete
{
"Message": "User deleted Successfully"
}