Add score controller

This commit is contained in:
Laurent
2024-10-22 12:15:00 +02:00
parent 3281365194
commit 0d65628bd7
4 changed files with 52 additions and 4 deletions

View File

@@ -7,9 +7,6 @@ import org.springframework.stereotype.Component;
@Component
public class AppConfigurations {
@Value("${storage.location}")
public String storageLocation = "";
@Value("${sec.cors.authorizedHots}")
public String[] authorizedHosts;
@@ -19,5 +16,4 @@ public class AppConfigurations {
@Value("${sec.cors.authorizedHeader}")
public String[] authorizedHeaders;
}

View File

@@ -0,0 +1,21 @@
package be.naaturel.unluckiest.controllers;
import be.naaturel.unluckiest.models.Score;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class ScoreController {
@Autowired
public ScoreController(){
}
@PostMapping("/api/submit")
public ResponseEntity<?> register(@RequestBody Score s){
return null;
}
}

View File

@@ -0,0 +1,18 @@
package be.naaturel.unluckiest.entities;
import jakarta.persistence.*;
@Entity(name = "Score")
public class ScoreEntity {
@Id
@GeneratedValue(strategy = GenerationType.UUID)
public String id;
@Column
public String owner;
@Column
public int value;
}

View File

@@ -0,0 +1,13 @@
package be.naaturel.unluckiest.models;
public class Score {
private String owner;
private int value;
public Score(String owner, int value){
this.owner = owner;
this.value = value;
}
}