refactor(model): move JSONB instance to proper module
This commit is contained in:
parent
3bae365b37
commit
0105aa8c3f
@ -341,7 +341,7 @@ runFormScraper fid innerS = fmap join . flip Scalpel.scrapeStringLike $
|
|||||||
|
|
||||||
getFormData :: FormIdentifier -> Lazy.ByteString -> Maybe [FormParam]
|
getFormData :: FormIdentifier -> Lazy.ByteString -> Maybe [FormParam]
|
||||||
getFormData = flip runFormScraper $
|
getFormData = flip runFormScraper $
|
||||||
Scalpel.chroots ("input") $ do
|
Scalpel.chroots "input" $ do
|
||||||
name <- Scalpel.attr "name" Scalpel.anySelector
|
name <- Scalpel.attr "name" Scalpel.anySelector
|
||||||
value <- Scalpel.attr "value" Scalpel.anySelector <|> pure ""
|
value <- Scalpel.attr "value" Scalpel.anySelector <|> pure ""
|
||||||
return $ toStrict name := value
|
return $ toStrict name := value
|
||||||
|
|||||||
@ -192,7 +192,6 @@ import Network.Mail.Mime.Instances as Import
|
|||||||
import Yesod.Core.Instances as Import ()
|
import Yesod.Core.Instances as Import ()
|
||||||
import Data.Aeson.Types.Instances as Import ()
|
import Data.Aeson.Types.Instances as Import ()
|
||||||
import Database.Esqueleto.Instances as Import ()
|
import Database.Esqueleto.Instances as Import ()
|
||||||
import Database.Esqueleto.PostgreSQL.JSON as Import (JSONB(..), unJSONB)
|
|
||||||
import Numeric.Natural.Instances as Import ()
|
import Numeric.Natural.Instances as Import ()
|
||||||
import Text.Blaze.Instances as Import ()
|
import Text.Blaze.Instances as Import ()
|
||||||
import Jose.Jwt.Instances as Import ()
|
import Jose.Jwt.Instances as Import ()
|
||||||
@ -272,8 +271,3 @@ import Control.Monad.Trans.RWS (RWST)
|
|||||||
type MForm m = RWST (Maybe (Env, FileEnv), HandlerSite m, [Lang]) Enctype Ints m
|
type MForm m = RWST (Maybe (Env, FileEnv), HandlerSite m, [Lang]) Enctype Ints m
|
||||||
|
|
||||||
type WeekDay = DayOfWeek
|
type WeekDay = DayOfWeek
|
||||||
|
|
||||||
-- TODO: maybe move elsewhere
|
|
||||||
deriving newtype instance NFData a => NFData (JSONB a)
|
|
||||||
deriving newtype instance Semigroup a => Semigroup (JSONB a)
|
|
||||||
deriving newtype instance Monoid a => Monoid (JSONB a)
|
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
-- SPDX-FileCopyrightText: 2022 Gregor Kleen <gregor.kleen@ifi.lmu.de>,Sarah Vaupel <sarah.vaupel@ifi.lmu.de>,Sarah Vaupel <vaupel.sarah@campus.lmu.de>,Steffen Jost <jost@tcs.ifi.lmu.de>
|
-- SPDX-FileCopyrightText: 2022-24 Gregor Kleen <gregor.kleen@ifi.lmu.de>,Sarah Vaupel <sarah.vaupel@ifi.lmu.de>,Sarah Vaupel <vaupel.sarah@campus.lmu.de>,Steffen Jost <jost@tcs.ifi.lmu.de>,Steffen Jost <s.jost@fraport.de>
|
||||||
--
|
--
|
||||||
-- SPDX-License-Identifier: AGPL-3.0-or-later
|
-- SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
|
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
Module: Model.Types.Common
|
Module: Model.Types.Common
|
||||||
Description: Common types used by most @Model.Types.*@-Modules
|
Description: Common types used by most @Model.Types.*@-Modules
|
||||||
@ -10,12 +12,13 @@ Types used by multiple other @Model.Types.*@-Modules
|
|||||||
-}
|
-}
|
||||||
module Model.Types.Common
|
module Model.Types.Common
|
||||||
( module Model.Types.Common
|
( module Model.Types.Common
|
||||||
|
, module JSON
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Import.NoModel
|
import Import.NoModel
|
||||||
|
|
||||||
import qualified Yesod.Auth.Util.PasswordStore as PWStore
|
import qualified Yesod.Auth.Util.PasswordStore as PWStore
|
||||||
|
import Database.Esqueleto.PostgreSQL.JSON as JSON (JSONB(..), JSONAccessor(..), unJSONB)
|
||||||
|
|
||||||
type Count = Sum Integer
|
type Count = Sum Integer
|
||||||
type Points = Centi
|
type Points = Centi
|
||||||
@ -68,3 +71,7 @@ type SessionFileReference = Digest SHA3_256
|
|||||||
|
|
||||||
type QualificationName = CI Text
|
type QualificationName = CI Text
|
||||||
type QualificationShorthand = CI Text
|
type QualificationShorthand = CI Text
|
||||||
|
|
||||||
|
deriving newtype instance NFData a => NFData (JSONB a)
|
||||||
|
deriving newtype instance Semigroup a => Semigroup (JSONB a)
|
||||||
|
deriving newtype instance Monoid a => Monoid (JSONB a)
|
||||||
|
|||||||
@ -29,6 +29,7 @@ import Data.Time.Calendar.WeekDate
|
|||||||
-- import qualified Text.ParserCombinators.Parsec.Number as ParseNum (nat)
|
-- import qualified Text.ParserCombinators.Parsec.Number as ParseNum (nat)
|
||||||
|
|
||||||
import Database.Persist.Sql
|
import Database.Persist.Sql
|
||||||
|
import Database.Esqueleto.PostgreSQL.JSON (JSONB(..))
|
||||||
|
|
||||||
import Web.HttpApiData
|
import Web.HttpApiData
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user