    Nothing -> left $ ServantErr 400 "User not found" "" []

checkAuth :: Maybe Text -> EitherT ServantErr IO (JWT VerifiedJWT)
checkAuth = maybe unauthorized (runCheck . decodeAndVerifySignature jwtSecret)
  where
  runCheck Nothing = unauthorized
  runCheck (Just verifiedJWT) = return verifiedJWT
  unauthorized =
    left $ ServantErr 401 "You are not authenticated. Please sign-in" "" []

api :: Proxy AppAPI
api = Proxy
