Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I your application you need to let users perforn the following operations on tasks: ( 1 ) create,read,update,delete; ( 2 ) describe; ( 3 )

I your application you need to let users perforn the following operations on tasks:
(1) create,read,update,delete;
(2) describe;
(3)get all;
(4) describe all.
----Requirements-----
1. Create one:
.Request
.URL:/task
.Method:POST
.Payload(example):{"title":"Task1","description":"Some description"}
.Response
.Status:200
.Body(example)13
.Comments
.Duringcreation you can only set the title and description of a Task
.Response body is the id of the newly created Task
2. Read One:
.Request
.URL:/task/{id}
.Method:GET
.Response
.Scenario 1:Task found
.Status:200
.Body(example):
{"id":"1","title":"Task1","description":"Some description","status":"CREATED"}
.Scenario 2:Task Not found
.Status:204
3. Update One:
.Request
.URL:/task/{id}
.Method:PUT
.Payload(example):{"title":"Task1.1","description":"New description","status":"BLOCKED"}
.Response
.Scenario 1:Task found
.Status:200
.Scenario 2:Task not found
.Status:204
.Scenario 3:Invalid status given
.Status:200
.Body:Available statuses are:
CREATED,APPROVAL,REJECTED,BLOCKED,DONE
.Additional requirements:
.Payload does not have to contain values for all fields.Modify only those that are different from null.
4.Delete One:
.Request
.URL:/task/{id}
.Method:DELETE
.Response
.Scenario 1:Task found
.Status:200
.Scenario 2:Task not found
.Status:204
5. Describe one:
.Request
.URL:/task/describe/{id}
.Method:GET
.Response
.Scenario 1:Task found
.Status:200
.Body(example):
["Description of Task[13:Name] is:Some description"]
.Scenario 2:Task not found
.Status:200
.Body(example):
[""Task with id=13 does not exist"]
6.Find all tasks:
.Request
.URL:/tasks
.Method:GET
.Response
.Status:200
.Body(example):
[{"id":"1","title":"Task1","description":"Some description","status":"CREATED"},
{"id":"2","title":"Task2","description":"Another description","status":"CREATED"}]
7. Describe all tasks:
.Request
.URL:/tasks/describe
.Method:GET
.Response
.Status:200
.Body(example):
["Description of Task [1:Task 1] is:Some description","Description of Task [2:Task 2] is:Another description"]
TaskRepository.java
import org.springframework.data.repository.CrudRepository;
public interface TaskRepository extends CrudRepository {
}
Task.java
@Entity
public class Task {
@Id
@GeneratedValue
private Long id;
private String title;
private String description;
private TaskStatus status= CREATED;
}
public TaskDto toDto()
{
return new TaskDto(String.valueOf(id),title.
}
TaskDto.java
public class TaskDto {private String id;private String title;private String description;private String status;
TaskStatus.java
public enum TaskStatus {CREATED,APPROVED,REJECTED,BLOCKED,DONE}
TaskController.java
all End point need implement

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

8th Edition

013460153X, 978-0134601533

More Books

Students also viewed these Databases questions