34 lines
1.1 KiB
Java
34 lines
1.1 KiB
Java
package com.pmumali.ch11_quinteplus.controller;
|
|
|
|
|
|
|
|
import com.pmumali.ch11_quinteplus.model.Cagnotte;
|
|
import com.pmumali.ch11_quinteplus.service.ServiceCagnotte;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import java.util.List;
|
|
|
|
@RestController
|
|
@RequestMapping("/api/cagnotte")
|
|
public class ControleurCagnotte {
|
|
|
|
@Autowired
|
|
private ServiceCagnotte serviceCagnotte;
|
|
|
|
@GetMapping("/montant")
|
|
public ResponseEntity<Double> getMontantCagnotteActive() {
|
|
return ResponseEntity.ok(serviceCagnotte.getMontantCagnotteActive());
|
|
}
|
|
|
|
@GetMapping("/historique")
|
|
public ResponseEntity<List<Cagnotte>> getHistoriqueCagnottes() {
|
|
return ResponseEntity.ok(serviceCagnotte.getHistoriqueCagnottes());
|
|
}
|
|
|
|
@PostMapping("/gerer-cas-particuliers")
|
|
public ResponseEntity<String> gererCasParticuliers() {
|
|
serviceCagnotte.gererCasParticuliersCagnotte();
|
|
return ResponseEntity.ok("Cas particuliers de cagnotte gérés avec succès");
|
|
}
|
|
} |