appli réparée, tests fonctionnels, websocket à faire et security à implémenter

This commit is contained in:
pedro 2025-06-02 23:49:19 +02:00
parent 818ac97e5a
commit 6f4e8d87eb
5 changed files with 13 additions and 20 deletions

View file

@ -15,7 +15,7 @@ open class MatchWebSocketConfig : WebSocketMessageBrokerConfigurer {
override fun configureMessageBroker(registry: MessageBrokerRegistry) {
// Enable a simple memory-based message broker to send messages to clients
// Prefix for messages FROM server TO client
registry.enableSimpleBroker(CHANNEL_NAME)
registry.enableSimpleBroker(CHANNEL_MATCH_NAME)
// Prefix for messages FROM client TO server
registry.setApplicationDestinationPrefixes("/ws")

View file

@ -6,10 +6,4 @@ import org.springframework.stereotype.Repository
@Repository
interface MatchRepository: JpaRepository<MatchBean, Long> {
fun getAll(): List<MatchBean> {
return listOf(
MatchBean(1, "Fleuret", "France", "Paris", 1, 2, 3, 10, 12, "16-08-2004", "terminé")
)
// return this.findAll()
}
}

View file

@ -14,13 +14,13 @@ class MatchService(
) {
// Obtenir tous les matchs (public)
fun getAll() : List<MatchBean> {
println("MatchService.getMatchs")
return matchRepository.getAll()
println("MatchService.getAll")
return matchRepository.findAll()
}
// Obtenir un match par id (public)
fun getById(id: Long?): MatchBean? {
println("MatchService.getMatchById : $id")
println("MatchService.getById : $id")
if (id == null) {
println("MatchService.getMatchById : Match not found")
@ -32,8 +32,8 @@ class MatchService(
// Obtenir un ou plusieurs match(s) par joueurs (id) (public)
fun getByPlayers(player1ID: Long?, player2ID: Long?): List<MatchBean> {
println("MatchService.getMatchByPlayers : $player1ID - $player2ID")
return matchRepository.getAll().filter { it.player1ID == player1ID && it.player2ID == player2ID }
println("MatchService.getByPlayers : $player1ID - $player2ID")
return matchRepository.findAll().filter { it.player1ID == player1ID && it.player2ID == player2ID }
}
// Ajouter un match (admin)
@ -81,14 +81,14 @@ class MatchService(
fun getMatchesByCity(city: String): List<MatchBean>? {
println("MatchService.getMatchesByCity : $city")
return matchRepository.getAll()
return matchRepository.findAll()
.filter { it.city == city }
}
fun getMatchesByCountry(country: String): List<MatchBean>? {
println("MatchService.getMatchesByCountry : $country")
return matchRepository.getAll()
return matchRepository.findAll()
.filter { it.country == country }
}

View file

@ -15,13 +15,13 @@ class RefereeService(
) {
// Obtenir tous les arbitres (public)
fun getAll(): List<RefereeBean> {
println("RefereeService.getReferees")
println("RefereeService.getAll")
return refereeRepository.findAll()
}
// Obtenir un arbitre par id (public)
fun getById(id:Long?) : RefereeBean? {
println("RefereeService.getRefereeById : $id")
println("RefereeService.getById : $id")
if (id == null) {
return null
@ -32,19 +32,19 @@ class RefereeService(
// Obtenir un ou plusieurs arbitre(s) par nom (public)
fun getByName(name:String): List<RefereeBean?>? {
println("RefereeService.getRefereeByName : $name")
println("RefereeService.getByName : $name")
return refereeRepository.findAll().filter{ it.name == name }
}
// Obtenir un ou plusieurs arbitre(s) par prénom
fun getByFirstName(firstName:String): List<RefereeBean?>? {
println("RefereeService.getRefereeByFirstName : $firstName")
println("RefereeService.getByFirstName : $firstName")
return refereeRepository.findAll().filter{ it.firstName == firstName }
}
// Obtenir un ou plusieurs arbitre(s) par qualification
fun getByQualification(qualification:String): List<RefereeBean?>? {
println("RefereeService.getRefereeByQualification : $qualification")
println("RefereeService.getByQualification : $qualification")
return refereeRepository.findAll().filter{ it.qualification == qualification }
}

View file

@ -1,6 +1,5 @@
package fr.teamflash.fencerjudgeback.websocket.controllers
import fr.teamflash.fencerjudgeback.config.CHANNEL_NAME
import fr.teamflash.fencerjudgeback.entities.RefereeBean
import fr.teamflash.fencerjudgeback.services.RefereeService
import fr.teamflash.fencerjudgeback.websocket.models.RefereeUpdateMessage