git.mcksp
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
module Repos.Prompts
    ( create
    ) where

import Database.SQLite.Simple.QQ
import Data.Text
import Repos.Utils
import Types

create :: (CanDB m, HasAuth m) => Text -> Text -> m DbR
create pId prompt = do
    userId <- getAuthUserId
    execute [sql|
        insert into prompts(id, user_id, prompt, created_at)
        values (?, ?, ?, datetime())
        |] (pId, userId, prompt)