Package com.dataset.service.rest.v1
Class DataSetController
java.lang.Object
com.dataset.service.rest.v1.DataSetController
DataSetController handles operations related to datasets and their records.
This controller provides two REST endpoints in which 1st endpoint is for creating record based on input dataset provided. 2nd endpoint is to query the dataset record based on grouping and sorting criteria.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<RecordCreateResponseVO>
createRecord
(String datasetName, RecordDTO recordDTO) Creates a record for the specified dataset.org.springframework.http.ResponseEntity<RecordResponseVO>
groupByQuery
(String datasetName, String groupBy, String sortBy, String order) Queries the list of records for the specified dataset, with optional groupBy, sortBy operations
-
Constructor Details
-
DataSetController
public DataSetController()
-
-
Method Details
-
createRecord
@PostMapping("/{datasetName}/record") public org.springframework.http.ResponseEntity<RecordCreateResponseVO> createRecord(@PathVariable("datasetName") String datasetName, @RequestBody RecordDTO recordDTO) Creates a record for the specified dataset.- Parameters:
datasetName
- This is the name of dataset in which the record should be created.recordDTO
- The payload containing the record details.- Returns:
- ResponseEntity containing the result of record creation.
-
groupByQuery
@GetMapping("/{datasetName}/query") public org.springframework.http.ResponseEntity<RecordResponseVO> groupByQuery(@PathVariable String datasetName, @RequestParam(required=false,defaultValue="departmentName") String groupBy, @RequestParam(required=false,defaultValue="age") String sortBy, @RequestParam(required=false,defaultValue="ASC") String order) Queries the list of records for the specified dataset, with optional groupBy, sortBy operations- Parameters:
datasetName
- This is the datasetName to which query is performed.groupBy
- This contains the name of the field to perform groupBy.sortBy
- This contains the name of the field to perform sortBy.order
- This is the order i.e. ASC or DESC.- Returns:
- RecordResponseVO which contains the groupBy or sortBy records.
-