it-for-us/todo

implement create card

Opened this issue · 0 comments

as backend
I want to create a new card into the system by using list Id, title,description and Authorization header. Order number will be generated automatically.
So that the user should be able to create new card
Sample request

POST api/v1/card
{
  "title": "string",
  "description": "string",
  "listId": 123

}

Acceptance criteria 1
Given create new card request sent to the create new card endpoint
When card title, description, list id is in right format and Authorization header is valid
Then backend generate order number andmust return successful create card response

HTTP/1.1 201 CREATED
Content-Type: application/json  
{
  "id": 1234,
  "title": "string",
  "description": "string",
  "orderNumber": 1234,
  "listId": 1234
}

Acceptance criteria 2
Given create new card request sent to the create new card endpoint
When card title, description, list id is in right format are incorrect format
Then backend must return bad request exception

HTTP/1.1 400 Bad Request
Content-Type: application/json  
{ 
  "message":” card title, description or list id is in incorrect format", 
  "code": 400
}

Acceptance criteria 3
Given create card request sent to the create new card endpoint
When card has already been created
Then the backend must return forbidden request exception

HTTP/1.1403 Forbidden 
Content-Type: application/json  
{ 
  "message":” card is already exist", 
  "code": 403
}

Acceptance criteria 4
Given create card request sent to the create new card endpoint
When list is belong to another user
Then the backend must return forbidden request exception

HTTP/1.1 401 Unauthorised 
Content-Type: application/json  
{ 
  "message":”Board belongs to another user", 
  "code": 401
}