0

私は自分のモデルに持っています:

Email
    email Text
    user UserId Maybe
    verkey Text Maybe
    UniqueEmail email

そして、ユーザーが(既存のユーザーの)電子メールと金額(int)を入力できるフォームがあります。このメールに基づいて、そのユーザーの UserId を見つけたいと思います。私はソファーを持っています:

paymentForm :: Form Payment
paymentForm = renderDivs $ Payment
    <$> lift (liftIO getCurrentTime)
    <*> pure userId
    <*> areq userIdField "To" Nothing
    <*> areq intField "Amount" Nothing
   where
    message :: Text
    message = "This user doesnt exist"
    userIdField = check hisUserId emailField
    hisUserId x | rawSql (SELECT user FROM "Email" WHERE "Email".email = x) == "" = Left message
                | otherwise = Right x

しかし、それはうまくいかないようです。何か案は?

4

1 に答える 1