Start bet confirmation
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
7ba9d2715d
commit
9e1fcee33b
@ -1,12 +1,7 @@
|
|||||||
package allin.data
|
package allin.data
|
||||||
|
|
||||||
abstract class AllInDataSource {
|
abstract class AllInDataSource {
|
||||||
|
|
||||||
abstract val userDataSource: UserDataSource
|
abstract val userDataSource: UserDataSource
|
||||||
|
|
||||||
|
|
||||||
abstract val betDataSource: BetDataSource
|
abstract val betDataSource: BetDataSource
|
||||||
|
|
||||||
|
|
||||||
abstract val participationDataSource: ParticipationDataSource
|
abstract val participationDataSource: ParticipationDataSource
|
||||||
}
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
package allin.data.postgres.entities
|
||||||
|
|
||||||
|
import org.ktorm.entity.Entity
|
||||||
|
import org.ktorm.schema.Table
|
||||||
|
import org.ktorm.schema.uuid
|
||||||
|
import org.ktorm.schema.varchar
|
||||||
|
|
||||||
|
|
||||||
|
interface BetResultEntity : Entity<BetResultEntity> {
|
||||||
|
val bet: BetEntity
|
||||||
|
val result: String
|
||||||
|
}
|
||||||
|
|
||||||
|
object BetResultsEntity : Table<BetResultEntity>("betresult") {
|
||||||
|
val betId = uuid("betid").primaryKey().references(BetsEntity) { it.bet }
|
||||||
|
val result = varchar("result").bindTo { it.result }
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package allin.entities
|
package allin.data.postgres.entities
|
||||||
|
|
||||||
import org.ktorm.entity.Entity
|
import org.ktorm.entity.Entity
|
||||||
import org.ktorm.schema.Table
|
import org.ktorm.schema.Table
|
@ -1,4 +1,12 @@
|
|||||||
package allin.dto
|
package allin.dto
|
||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class UserDTO(val id: String, val username: String, val email: String, val nbCoins: Int, var token:String?)
|
data class UserDTO(
|
||||||
|
val id: String,
|
||||||
|
val username: String,
|
||||||
|
val email: String,
|
||||||
|
val nbCoins: Int,
|
||||||
|
var token: String?
|
||||||
|
)
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
package allin.model
|
||||||
|
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class AllInResponse<T : Any>(
|
||||||
|
val value: T,
|
||||||
|
val toConfirm: List<Bet>,
|
||||||
|
val won: List<BetResult>
|
||||||
|
)
|
@ -1,14 +1,15 @@
|
|||||||
package allin.model
|
package allin.model
|
||||||
|
|
||||||
object ApiMessage {
|
object ApiMessage {
|
||||||
const val Welcome = "Welcome on AllIn's API !"
|
const val WELCOME = "Welcome on AllIn's API !"
|
||||||
const val TokenUserNotFound = "User not found with the valid token !"
|
const val TOKEN_USER_NOT_FOUND = "User not found with the valid token !"
|
||||||
const val UserNotFound = "User not found."
|
const val USER_NOT_FOUND = "User not found."
|
||||||
const val BetNotFound = "Bet not found."
|
const val BET_NOT_FOUND = "Bet not found."
|
||||||
const val BetAlreadyExist = "Bet already exists."
|
const val BET_ALREADY_EXIST = "Bet already exists."
|
||||||
const val IncorrectLoginPassword = "Login and/or password incorrect."
|
const val INCORRECT_LOGIN_PASSWORD = "Login and/or password incorrect."
|
||||||
const val UserAlreadyExist = "Mail and/or username already exists."
|
const val USER_ALREADY_EXISTS = "Mail and/or username already exists."
|
||||||
const val InvalidMail = "Invalid mail."
|
const val INVALID_MAIL = "Invalid mail."
|
||||||
const val ParticipationNotFound = "Participation not found."
|
const val PARTICIPATION_NOT_FOUND = "Participation not found."
|
||||||
const val NotEnoughCoins = "Not enough coins."
|
const val NOT_ENOUGH_COINS = "Not enough coins."
|
||||||
|
const val NO_GIFT = "Can't get daily gift."
|
||||||
}
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package allin.model
|
||||||
|
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class BetResult(
|
||||||
|
val betId: String,
|
||||||
|
val result: String
|
||||||
|
)
|
@ -0,0 +1,12 @@
|
|||||||
|
package allin.model
|
||||||
|
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class ParticipationDetail(
|
||||||
|
val id: String,
|
||||||
|
val bet: Bet,
|
||||||
|
val username: String,
|
||||||
|
val answer: String,
|
||||||
|
val stake: Int
|
||||||
|
)
|
@ -1,13 +1,10 @@
|
|||||||
package allin.utils
|
package allin.utils
|
||||||
|
|
||||||
class RegexChecker {
|
class RegexChecker {
|
||||||
|
private val emailRegex = "^[A-Za-z0-9+_.-]+@(.+)$"
|
||||||
private val emailRegex="^[A-Za-z0-9+_.-]+@(.+)$"
|
|
||||||
|
|
||||||
|
|
||||||
fun isEmailInvalid(email: String): Boolean {
|
fun isEmailInvalid(email: String): Boolean {
|
||||||
val emailRegex = Regex(emailRegex)
|
val emailRegex = Regex(emailRegex)
|
||||||
return !emailRegex.matches(email)
|
return !emailRegex.matches(email)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in new issue