-
-
Save Fabien-V/3020b0560afe4b157a69196ae3653783 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.demo.controllers; | |
import com.example.demo.callNP6.SegmentsServices; | |
import com.example.demo.entities.Segment; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.web.bind.annotation.*; | |
@RestController | |
@RequestMapping("/apiCifeaNp6") | |
public class SegmentController { | |
@Autowired | |
SegmentsServices segmentsServices; | |
/*GET ALL SEGMENTS*/ | |
@GetMapping("/segments") | |
public Segment[] getAllSegments() { | |
return segmentsServices.getAllSegments(); | |
} | |
/*GET A SPECIFIC SEGMENTS*/ | |
@GetMapping("/segments/{ID}") | |
public Segment getSpecificSegment(@PathVariable String ID) { | |
return segmentsServices.getSpecificSegment(ID); | |
} | |
/*CREATE SEGMENTS*/ | |
@PostMapping("/segments") | |
public Segment createSegment(@RequestBody String segment) { | |
return segmentsServices.createSegment(segment); | |
} | |
/*UPDATE A SPECIFIC SEGMENT*/ | |
@PutMapping("segments/{ID}") | |
public Segment updateSegment(@PathVariable("ID") String ID, @RequestBody String segment){ | |
return segmentsServices.updateSegment(ID, segment); | |
} | |
/*EMPTY A SPECIFIC SEGMENT*/ | |
@DeleteMapping("segments/{ID}/targets") | |
public Segment emptySegment(@PathVariable String ID) { | |
return segmentsServices.emptySegment(ID); | |
} | |
/*DELETE A SPECIFIC SEGMENTS*/ | |
@DeleteMapping("segments/{ID}") | |
public Segment deleteSegment(@PathVariable String ID) { | |
return segmentsServices.deleteSegment(ID); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment