package com.platform2easy.genesis.web.controller; import com.platform2easy.genesis.domain.model.Wallet; import com.platform2easy.genesis.domain.service.WalletService; import lombok.AllArgsConstructor; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @RequestMapping("/api/wallet") @AllArgsConstructor public class WalletController { private final WalletService service; @GetMapping @ResponseStatus(HttpStatus.OK) public List listAll() { return service.listarTodos(); } @GetMapping("/{id}") @ResponseStatus(HttpStatus.OK) public Wallet getById(@PathVariable Long id) { return service.buscarPorId(id); } @PostMapping @ResponseStatus(HttpStatus.CREATED) public Wallet create(@RequestBody Wallet wallet) { wallet.setId(null); return service.salvar(wallet); } @PutMapping("/{id}") @ResponseStatus(HttpStatus.OK) public Wallet update(@PathVariable Long id, @RequestBody Wallet wallet) { wallet.setId(id); return service.salvar(wallet); } @DeleteMapping("/{id}") @ResponseStatus(HttpStatus.NO_CONTENT) public void delete(@PathVariable Long id) { service.deletarPorId(id); } }