|
|
@ -6,7 +6,6 @@ import allin.entities.ParticipationsEntity.getParticipationEntityFromUserId
|
|
|
|
import allin.ext.hasToken
|
|
|
|
import allin.ext.hasToken
|
|
|
|
import allin.ext.verifyUserFromToken
|
|
|
|
import allin.ext.verifyUserFromToken
|
|
|
|
import allin.model.BetDetail
|
|
|
|
import allin.model.BetDetail
|
|
|
|
import allin.model.Participation
|
|
|
|
|
|
|
|
import allin.model.getBetAnswerDetail
|
|
|
|
import allin.model.getBetAnswerDetail
|
|
|
|
import io.ktor.http.*
|
|
|
|
import io.ktor.http.*
|
|
|
|
import io.ktor.server.application.*
|
|
|
|
import io.ktor.server.application.*
|
|
|
@ -24,22 +23,22 @@ fun Application.BetDetailRouter() {
|
|
|
|
val participations = getParticipationEntityFromBetId(id)
|
|
|
|
val participations = getParticipationEntityFromBetId(id)
|
|
|
|
val selectedBet = getBets().find { it.id == id }
|
|
|
|
val selectedBet = getBets().find { it.id == id }
|
|
|
|
if (selectedBet != null) {
|
|
|
|
if (selectedBet != null) {
|
|
|
|
call.respond(
|
|
|
|
call.respond(
|
|
|
|
HttpStatusCode.Accepted,
|
|
|
|
HttpStatusCode.Accepted,
|
|
|
|
BetDetail(
|
|
|
|
BetDetail(
|
|
|
|
selectedBet,
|
|
|
|
selectedBet,
|
|
|
|
getBetAnswerDetail(participations),
|
|
|
|
getBetAnswerDetail(selectedBet, participations),
|
|
|
|
participations.toList(),
|
|
|
|
participations.toList(),
|
|
|
|
getParticipationEntityFromUserId(user.username,id).lastOrNull()
|
|
|
|
getParticipationEntityFromUserId(user.username, id).lastOrNull()
|
|
|
|
)
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
} else {
|
|
|
|
)
|
|
|
|
call.respond(HttpStatusCode.NotFound, "Bet not found")
|
|
|
|
} else {
|
|
|
|
}
|
|
|
|
call.respond(HttpStatusCode.NotFound, "Bet not found")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|