module TsWeb.Tables.Session.Test where
import TsWeb.Session
import TsWeb.Tables.Session
import Data.Pool (Pool)
import Database.Beam
import TsWeb.Types.Db (ReadOnlyConn, ReadWriteConn)
import Web.Spock.Config
import Web.Spock.Internal.SessionManager as SM (Session(..))
data UsersMixin f = Address
{ loginid :: C f Int
, masqid :: C f Int
, remember :: C f Bool
} deriving (Generic)
type Users = UsersMixin Identity
instance Beamable UsersMixin
instance UserData Users where
rememberMe = remember
type Sess conn st = SM.Session conn Users st
data Db f = Db
{ session :: f (TableEntity (SessionT UsersMixin))
} deriving (Generic)
instance Database be Db
db :: DatabaseSettings be Db
db = defaultDbSettings
patch ::
Pool ReadOnlyConn
-> Pool ReadWriteConn
-> SpockCfg conn Users st
-> SpockCfg conn Users st
patch = patchConfig (session db)