fix merge conflict
This commit is contained in:
@@ -19,43 +19,6 @@ public class StockController {
|
|||||||
|
|
||||||
private final StockService stockService;
|
private final StockService stockService;
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
// Ajouter un stock
|
|
||||||
@PostMapping
|
|
||||||
public ResponseEntity<Map<String, Object>> create(@RequestBody Stock stock) {
|
|
||||||
stockService.add(stock);
|
|
||||||
Map<String, Object> response = new HashMap<>();
|
|
||||||
response.put("message", "Stock added");
|
|
||||||
response.put("status", true);
|
|
||||||
response.put("data", new HashMap<>());
|
|
||||||
|
|
||||||
return ResponseEntity.ok(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Chercher des stocks par id
|
|
||||||
@GetMapping("/{id}")
|
|
||||||
public ResponseEntity<Map<String, Object>> findById(@PathVariable Long id) {
|
|
||||||
Optional<Stock> result = stockService.findById(id);
|
|
||||||
Map<String, Object> response = new HashMap<>();
|
|
||||||
response.put("message", "List of Clients found");
|
|
||||||
response.put("status", 200);
|
|
||||||
response.put("data", result);
|
|
||||||
|
|
||||||
return ResponseEntity.ok(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Trouver les jeux par nom et compter le result par nom
|
|
||||||
// ACCESS PUBLIC
|
|
||||||
@GetMapping("/{name}")
|
|
||||||
public ResponseEntity<Map<String, Object>> findByName(@PathVariable String name) {
|
|
||||||
List<StockCount> result = stockService.findAllByName(name);
|
|
||||||
Map<String, Object> response = new HashMap<>();
|
|
||||||
response.put("message", "List of Clients found");
|
|
||||||
response.put("status", 200);
|
|
||||||
response.put("data", result);
|
|
||||||
return ResponseEntity.ok(response);
|
|
||||||
}
|
|
||||||
=======
|
|
||||||
// Ajouter un stock
|
// Ajouter un stock
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public ResponseEntity<Map<String, Object>> create(@RequestBody Stock stock) {
|
public ResponseEntity<Map<String, Object>> create(@RequestBody Stock stock) {
|
||||||
@@ -63,14 +26,21 @@ public class StockController {
|
|||||||
return buildResponse("Stock added", true, new HashMap<>());
|
return buildResponse("Stock added", true, new HashMap<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Chercher un stock par id
|
// Chercher des stocks par id
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ResponseEntity<Map<String, Object>> findById(@PathVariable Long id) {
|
public ResponseEntity<Map<String, Object>> findById(@PathVariable Long id) {
|
||||||
Optional<Stock> result = stockService.findById(id);
|
Optional<Stock> result = stockService.findById(id);
|
||||||
return buildResponse("Stock found", true, result);
|
return buildResponse("Stock added", true, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Trouver les jeux par nom et compter le result par nom
|
||||||
|
// ACCESS PUBLIC
|
||||||
|
@GetMapping("/{name}")
|
||||||
|
public ResponseEntity<Map<String, Object>> findByName(@PathVariable String name) {
|
||||||
|
List<StockCount> result = stockService.findAllByName(name);
|
||||||
|
return buildResponse("Stock added", true, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reponse formatée
|
|
||||||
private ResponseEntity<Map<String, Object>> buildResponse(String message, boolean status, Object data) {
|
private ResponseEntity<Map<String, Object>> buildResponse(String message, boolean status, Object data) {
|
||||||
Map<String, Object> response = new HashMap<>();
|
Map<String, Object> response = new HashMap<>();
|
||||||
response.put("message", message);
|
response.put("message", message);
|
||||||
@@ -78,5 +48,4 @@ public class StockController {
|
|||||||
response.put("data", data);
|
response.put("data", data);
|
||||||
return ResponseEntity.ok(response);
|
return ResponseEntity.ok(response);
|
||||||
}
|
}
|
||||||
>>>>>>> c09dfc497575d616cee9f47afcc62667dbb08b0c
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user