se añadio websocket para terminar el remate
Some checks failed
Deploy Spring Boot App / build-and-deploy (push) Has been cancelled

This commit is contained in:
2025-11-29 10:46:26 -04:00
commit f1077c108c
53 changed files with 2932 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
package com.example.fercoganbackend.controller;
import com.example.fercoganbackend.entity.Puja;
import com.example.fercoganbackend.service.PujaService;
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/pujas")
public class PujaController {
@Autowired
private PujaService pujaService;
@GetMapping
public List<Puja> getAll() {
return pujaService.findAll();
}
@GetMapping("/id/{id}")
public ResponseEntity<Puja> getById(@PathVariable Long id) {
return pujaService.findById(id)
.map(ResponseEntity::ok)
.orElse(ResponseEntity.notFound().build());
}
@GetMapping("/informe/{remateId}")
public List<Puja> getForInforme(@PathVariable Long remateId){
return pujaService.fingForReporte(remateId);
}
@GetMapping("/remate/{id}")
public List<Puja> getForRemate(@PathVariable Long id){
return pujaService.findForRemtae(id);
}
//get coincidir con lote y remate
@GetMapping("/loteyremate/{loteId}/{remateId}")
public List<Puja> getForLoteAndRemate(@PathVariable Long loteId,@PathVariable Long remateId){
return pujaService.findForLoteAndRemate(loteId,remateId);
}
@PostMapping
public Puja create(@RequestBody Puja puja) {
return pujaService.save(puja);
}
@PutMapping("/{id}")
public ResponseEntity<Puja> update(@PathVariable Long id, @RequestBody Puja remate) {
return pujaService.findById(id)
.map(r -> {
remate.setId(id);
return ResponseEntity.ok(pujaService.save(remate));
})
.orElse(ResponseEntity.notFound().build());
}
@DeleteMapping("/{id}")
public ResponseEntity<Void> delete(@PathVariable Long id) {
pujaService.delete(id);
return ResponseEntity.noContent().build();
}
}