Class DataSetController

java.lang.Object
com.dataset.service.rest.v1.DataSetController

@RestController @RequestMapping("/api/v1/datasets") public class DataSetController extends Object
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 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.