Class ProdottoController
java.lang.Object
it.unicam.cs.ids2425.FilieraAgricola.controller.ProdottoController
Controller REST per la gestione dei Prodotti.
Espone gli endpoint per la creazione, consultazione e sottomissione dei
prodotti.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<ProdottoResponse> aggiornaProdotto(Long id, ProdottoRequest request) Aggiorna le informazioni di un prodotto.org.springframework.http.ResponseEntity<ProdottoResponse> creaProdotto(ProdottoRequest request) Endpoint per la creazione di un nuovo prodotto.org.springframework.http.ResponseEntity<Void> eliminaProdotto(Long id) Elimina un prodotto.org.springframework.http.ResponseEntity<List<ProdottoResponse>> Ritorna tutti i prodotti APPROVATI (visibili pubblicamente).org.springframework.http.ResponseEntity<List<ProdottoResponse>> getProdottiByUtente(Long utenteId) Ritorna i prodotti associati a un utente specifico.org.springframework.http.ResponseEntity<ProdottoResponse> getProdottoById(Long id) Ritorna i dettagli di un singolo prodotto tramite ID.org.springframework.http.ResponseEntity<Void> Endpoint usato dal proprietario per sottomettere il proprio prodotto (da BOZZA a IN_REVISIONE).
-
Constructor Details
-
ProdottoController
public ProdottoController()
-
-
Method Details
-
creaProdotto
@PostMapping @PreAuthorize("hasAnyRole(\'PRODUTTORE\', \'TRASFORMATORE\')") public org.springframework.http.ResponseEntity<ProdottoResponse> creaProdotto(@RequestBody ProdottoRequest request) Endpoint per la creazione di un nuovo prodotto. All'inizio il prodotto sarĂ nello stato BOZZA. -
sottomettiProdotto
@PostMapping("/{id}/sottometti") @PreAuthorize("hasAnyRole(\'PRODUTTORE\', \'TRASFORMATORE\')") public org.springframework.http.ResponseEntity<Void> sottomettiProdotto(@PathVariable Long id) Endpoint usato dal proprietario per sottomettere il proprio prodotto (da BOZZA a IN_REVISIONE). -
getAllProdotti
Ritorna tutti i prodotti APPROVATI (visibili pubblicamente). -
getProdottoById
@GetMapping("/{id}") public org.springframework.http.ResponseEntity<ProdottoResponse> getProdottoById(@PathVariable Long id) Ritorna i dettagli di un singolo prodotto tramite ID. -
getProdottiByUtente
@GetMapping("/utente/{utenteId}") @PreAuthorize("hasAnyRole(\'PRODUTTORE\', \'TRASFORMATORE\', \'GESTORE\', \'CURATORE\')") public org.springframework.http.ResponseEntity<List<ProdottoResponse>> getProdottiByUtente(@PathVariable Long utenteId) Ritorna i prodotti associati a un utente specifico. -
aggiornaProdotto
@PutMapping("/{id}") @PreAuthorize("hasAnyRole(\'PRODUTTORE\', \'TRASFORMATORE\')") public org.springframework.http.ResponseEntity<ProdottoResponse> aggiornaProdotto(@PathVariable Long id, @RequestBody ProdottoRequest request) Aggiorna le informazioni di un prodotto. -
eliminaProdotto
@DeleteMapping("/{id}") @PreAuthorize("hasAnyRole(\'PRODUTTORE\', \'TRASFORMATORE\', \'GESTORE\', \'CURATORE\')") public org.springframework.http.ResponseEntity<Void> eliminaProdotto(@PathVariable Long id) Elimina un prodotto.
-