Add some structure

This commit is contained in:
2025-12-10 06:41:26 +01:00
parent 413f5b7cfc
commit a89628cd10
71 changed files with 140 additions and 29 deletions

View File

@@ -1,26 +1,59 @@
package be.naaturel.boardmateapi.controllers;
import org.apache.coyote.Response;
import be.naaturel.boardmateapi.models.Move;
import be.naaturel.boardmateapi.models.Party;
import be.naaturel.boardmateapi.services.PartyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
@RestController
public class PartyController {
private final PartyService service;
public PartyController(){
@Autowired
public PartyController(PartyService service){
this.service = service;
}
public ResponseEntity<?> CreateParty(){
return null;
@GetMapping("/party/{id}")
public ResponseEntity<?> RetrieveParty(@PathVariable String id){
try{
service.retrieveParty(id);
return ResponseEntity
.status(HttpStatus.INTERNAL_SERVER_ERROR)
.build();
} catch (Exception e){
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
}
}
public ResponseEntity<?> RetrieveParty(int id){
return null;
@PostMapping("/create")
public ResponseEntity<?> CreateParty(@RequestBody Party party){
try{
service.create();
return ResponseEntity.
status(HttpStatus.INTERNAL_SERVER_ERROR)
.build();
} catch (Exception e){
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
}
}
public ResponseEntity<?> AddMove(){
return null;
@PostMapping("/moves/add")
public ResponseEntity<?> AddMove(@RequestBody Move move){
try{
service.addMove();
return ResponseEntity
.status(HttpStatus.OK)
.build();
} catch (Exception e){
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
}
}
}