Adds login ability, error handling, and logging (#1)
Reviewed-on: #1 Co-authored-by: aarbit <aarbit@gmail.com> Co-committed-by: aarbit <aarbit@gmail.com>
This commit was merged in pull request #1.
This commit is contained in:
@@ -3,10 +3,18 @@ package net.halfbinary.scavengerhuntapi.repository
|
||||
import net.halfbinary.scavengerhuntapi.model.HunterId
|
||||
import net.halfbinary.scavengerhuntapi.model.record.HunterRecord
|
||||
import org.springframework.data.jpa.repository.JpaRepository
|
||||
import org.springframework.data.jpa.repository.Query
|
||||
import org.springframework.stereotype.Repository
|
||||
|
||||
@Repository
|
||||
interface HunterRepository : JpaRepository<HunterRecord, HunterId>
|
||||
interface HunterRepository : JpaRepository<HunterRecord, HunterId> {
|
||||
fun findByEmail(email: String): HunterRecord?
|
||||
|
||||
@Query("""
|
||||
SELECT h.*
|
||||
FROM hunter h
|
||||
WHERE h.email = :email
|
||||
AND h.password = :password
|
||||
""", nativeQuery = true)
|
||||
fun login(email: String, password: String): HunterRecord?
|
||||
}
|
||||
Reference in New Issue
Block a user