Added main structure
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package be.naaturel.boardmateapi.configurations;
|
||||
|
||||
import be.naaturel.boardmateapi.Interceptor;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package be.naaturel.boardmateapi;
|
||||
package be.naaturel.boardmateapi.configurations;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
@@ -0,0 +1,26 @@
|
||||
package be.naaturel.boardmateapi.controllers;
|
||||
|
||||
import org.apache.coyote.Response;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class PartyController {
|
||||
|
||||
|
||||
public PartyController(){
|
||||
|
||||
}
|
||||
|
||||
public ResponseEntity<?> CreateParty(){
|
||||
return null;
|
||||
}
|
||||
|
||||
public ResponseEntity<?> RetrieveParty(int id){
|
||||
return null;
|
||||
}
|
||||
|
||||
public ResponseEntity<?> AddMove(){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package be.naaturel.boardmateapi.models;
|
||||
|
||||
public class Coordinate {
|
||||
|
||||
private int row;
|
||||
private String file;
|
||||
|
||||
public Coordinate(int row, String file){
|
||||
this.row = row;
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return String.format("%s%d", file, row);
|
||||
}
|
||||
|
||||
}
|
||||
13
api/src/main/java/be/naaturel/boardmateapi/models/Move.java
Normal file
13
api/src/main/java/be/naaturel/boardmateapi/models/Move.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package be.naaturel.boardmateapi.models;
|
||||
|
||||
public class Move {
|
||||
|
||||
private Piece piece;
|
||||
private Coordinate coordinate;
|
||||
|
||||
public Move(Piece piece, Coordinate coordinate){
|
||||
this.piece = piece;
|
||||
this.coordinate = coordinate;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package be.naaturel.boardmateapi.models;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Party {
|
||||
|
||||
private List<Move> moves;
|
||||
|
||||
}
|
||||
11
api/src/main/java/be/naaturel/boardmateapi/models/Piece.java
Normal file
11
api/src/main/java/be/naaturel/boardmateapi/models/Piece.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package be.naaturel.boardmateapi.models;
|
||||
|
||||
public class Piece {
|
||||
|
||||
|
||||
|
||||
public Piece(){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package be.naaturel.boardmateapi.repository;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
@Document(collection = "parties")
|
||||
public class PartyDto {
|
||||
@Id
|
||||
private String id;
|
||||
private String[] moves;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package be.naaturel.boardmateapi.repository;
|
||||
|
||||
import be.naaturel.boardmateapi.models.Party;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface PartyRepo extends MongoRepository<Party, String> {
|
||||
Optional<Party> findById(String id);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package be.naaturel.boardmateapi.repository.test;
|
||||
|
||||
import be.naaturel.boardmateapi.models.Party;
|
||||
|
||||
public interface CustomPartyRepo {
|
||||
public Party find(String id);
|
||||
public String create();
|
||||
public String registerMove();
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package be.naaturel.boardmateapi.repository.test;
|
||||
|
||||
import be.naaturel.boardmateapi.models.Party;
|
||||
|
||||
public class CustomPartyRepoImpl implements CustomPartyRepo{
|
||||
|
||||
@Override
|
||||
public Party find(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String create() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String registerMove() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package be.naaturel.boardmateapi.services;
|
||||
|
||||
import be.naaturel.boardmateapi.models.Party;
|
||||
import be.naaturel.boardmateapi.repository.test.CustomPartyRepoImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class PartyService {
|
||||
|
||||
private final CustomPartyRepoImpl repo;
|
||||
|
||||
public PartyService(CustomPartyRepoImpl repo){
|
||||
this.repo = repo;
|
||||
}
|
||||
|
||||
public Party retrieveParty(String id){
|
||||
return null;
|
||||
}
|
||||
|
||||
public String create(){
|
||||
return null;
|
||||
}
|
||||
|
||||
public String addMove(){
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user