Ce que tu veux
This commit is contained in:
parent
2e42f45201
commit
2f7db91628
9 changed files with 97 additions and 0 deletions
|
|
@ -22,6 +22,7 @@ dependencies {
|
||||||
implementation("org.springframework.boot:spring-boot-starter-web")
|
implementation("org.springframework.boot:spring-boot-starter-web")
|
||||||
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
|
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
|
||||||
implementation("org.jetbrains.kotlin:kotlin-reflect")
|
implementation("org.jetbrains.kotlin:kotlin-reflect")
|
||||||
|
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
|
||||||
developmentOnly("org.springframework.boot:spring-boot-devtools")
|
developmentOnly("org.springframework.boot:spring-boot-devtools")
|
||||||
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
||||||
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
|
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package fr.teamflash.fencerjudgeback.entities
|
||||||
|
|
||||||
|
import jakarta.persistence.Entity
|
||||||
|
import jakarta.persistence.Id
|
||||||
|
import jakarta.persistence.Table
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name="match")
|
||||||
|
data class MatchBean(
|
||||||
|
@Id
|
||||||
|
val id:Long?=null,
|
||||||
|
val player1:PlayerBean?=null,
|
||||||
|
val player2:PlayerBean?=null,
|
||||||
|
val referee: RefereeBean?=null,
|
||||||
|
val score1:Int=0,
|
||||||
|
val score2:Int=0,
|
||||||
|
val date:String?=null
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package fr.teamflash.fencerjudgeback.entities
|
||||||
|
|
||||||
|
import jakarta.persistence.Entity
|
||||||
|
import jakarta.persistence.Id
|
||||||
|
import jakarta.persistence.Table
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name="player")
|
||||||
|
data class PlayerBean(
|
||||||
|
@Id
|
||||||
|
val id:Long?=null,
|
||||||
|
val name:String?="",
|
||||||
|
val firstName:String?=""
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package fr.teamflash.fencerjudgeback.entities
|
||||||
|
|
||||||
|
import jakarta.persistence.Entity
|
||||||
|
import jakarta.persistence.Id
|
||||||
|
import jakarta.persistence.Table
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@Table(name="referee")
|
||||||
|
data class RefereeBean(
|
||||||
|
@Id
|
||||||
|
val id:Long?=null,
|
||||||
|
val name:Long?=null,
|
||||||
|
)
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
package fr.teamflash.fencerjudgeback.repositories
|
||||||
|
|
||||||
|
import fr.teamflash.fencerjudgeback.entities.MatchBean
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository
|
||||||
|
import org.springframework.stereotype.Repository
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
interface MatchRepository: JpaRepository<MatchBean, Long> {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
package fr.teamflash.fencerjudgeback.repositories
|
||||||
|
|
||||||
|
import fr.teamflash.fencerjudgeback.entities.PlayerBean
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository
|
||||||
|
|
||||||
|
interface PlayerRepository: JpaRepository<PlayerBean, Long> {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
package fr.teamflash.fencerjudgeback.restControllers
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RestController
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
class MatchRestController {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
package fr.teamflash.fencerjudgeback.services
|
||||||
|
|
||||||
|
import fr.teamflash.fencerjudgeback.entities.MatchBean
|
||||||
|
import fr.teamflash.fencerjudgeback.entities.PlayerBean
|
||||||
|
import fr.teamflash.fencerjudgeback.repositories.MatchRepository
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
@Service
|
||||||
|
class MatchService(matchRepository: MatchRepository) {
|
||||||
|
|
||||||
|
fun getMatchById(id:Long){}
|
||||||
|
fun getMatchByPlayer(playerBean: PlayerBean) {}
|
||||||
|
fun getMatchs(){}
|
||||||
|
fun createMatch(match: MatchBean){}
|
||||||
|
fun updateMatchScore(score1:Int, score2:Int){}
|
||||||
|
fun delMatch(match:MatchBean){}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
package fr.teamflash.fencerjudgeback.services
|
||||||
|
|
||||||
|
import fr.teamflash.fencerjudgeback.entities.PlayerBean
|
||||||
|
import org.springframework.stereotype.Service
|
||||||
|
|
||||||
|
@Service
|
||||||
|
class PlayerService {
|
||||||
|
fun getPlayerById(id:Long){}
|
||||||
|
fun getPlayers(){}
|
||||||
|
fun getPlayerByName(name:String){}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue