Commit aff05d4f authored by Ghitha Dinan's avatar Ghitha Dinan

add role user

parent e3d90af5
Pipeline #402 failed with stages
......@@ -7,8 +7,10 @@ import com.fasterxml.jackson.databind.ObjectMapper
import id.go.kemenag.madrasah.pmrms.auth.constant.EXPIRATION_TIME
import id.go.kemenag.madrasah.pmrms.auth.constant.SECRET
import id.go.kemenag.madrasah.pmrms.auth.constant.TOKEN_PREFIX
import id.go.kemenag.madrasah.pmrms.auth.constant.VALIDATOR_MSG_NOT_FOUND
import id.go.kemenag.madrasah.pmrms.auth.exception.BadRequestException
import id.go.kemenag.madrasah.pmrms.auth.helpers.getUserLogin
import id.go.kemenag.madrasah.pmrms.auth.helpers.responseNotFound
import id.go.kemenag.madrasah.pmrms.auth.helpers.responseSuccess
import id.go.kemenag.madrasah.pmrms.auth.model.request.auth.LoginRequest
import id.go.kemenag.madrasah.pmrms.auth.model.response.ReturnData
......@@ -66,7 +68,11 @@ class AuthService {
fun detail(): ResponseEntity<ReturnData> {
return try {
responseSuccess(data = repoUser.findByIdAndActive(getUserLogin()?.id))
val data = repoUser.findByIdAndActive(getUserLogin()?.id)
if (data.isPresent) {
responseSuccess(data = data)
}
responseNotFound("User $VALIDATOR_MSG_NOT_FOUND\"")
} catch (e: Exception) {
throw e
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment