adding login handler
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
0808f8f90c
commit
79500353f4
@ -0,0 +1,10 @@
|
|||||||
|
package org.tbasket.data
|
||||||
|
|
||||||
|
class User(val id : Int,
|
||||||
|
val name : String,
|
||||||
|
val forename: String,
|
||||||
|
val passwordHash: Int,
|
||||||
|
val mailAddress : String) {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
package org.tbasket.handler
|
||||||
|
|
||||||
|
import org.tbasket.api.compute.APIRequestHandler
|
||||||
|
import zio.http.{Request, Response}
|
||||||
|
import io.getquill._
|
||||||
|
import org.tbasket.data.User
|
||||||
|
import zio.{ZEnvironment, ZIO}
|
||||||
|
object LoginHandler extends APIRequestHandler {
|
||||||
|
|
||||||
|
private val ctx = new SqlMirrorContext(MirrorSqlDialect, Literal)
|
||||||
|
import ctx._
|
||||||
|
private def getAccount(mail: String, passwordHash: Int) = quote {
|
||||||
|
query[User].filter(_.mailAddress == mail).filter(_.passwordHash == passwordHash)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override def post(request: Request): Response = {
|
||||||
|
???
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Reference in new issue