mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-16 18:42:30 +03:00
41054de113
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9499 Co-authored-by: gneeri <10553562+gneeri@users.noreply.github.com> GitOrigin-RevId: 1e351556c43e643aa973f87adc0306f076cd227e
32 lines
952 B
Haskell
32 lines
952 B
Haskell
{-# LANGUAGE UndecidableInstances #-}
|
|
|
|
module Hasura.LogicalModel.Cache
|
|
( LogicalModelInfo (..),
|
|
LogicalModelCache,
|
|
)
|
|
where
|
|
|
|
import Data.Aeson (ToJSON (..), genericToJSON)
|
|
import Hasura.LogicalModel.Types (LogicalModelFields, LogicalModelName)
|
|
import Hasura.Prelude hiding (first)
|
|
import Hasura.RQL.Types.Backend (Backend (..))
|
|
import Hasura.RQL.Types.BackendType (BackendType)
|
|
import Hasura.Table.Cache (RolePermInfoMap)
|
|
|
|
type LogicalModelCache b = HashMap LogicalModelName (LogicalModelInfo b)
|
|
|
|
-- | Description of a logical model for use in metadata (after schema cache)
|
|
data LogicalModelInfo (b :: BackendType) = LogicalModelInfo
|
|
{ _lmiName :: LogicalModelName,
|
|
_lmiFields :: LogicalModelFields b,
|
|
_lmiDescription :: Maybe Text,
|
|
_lmiPermissions :: RolePermInfoMap b
|
|
}
|
|
deriving (Show, Generic)
|
|
|
|
instance
|
|
(Backend b, ToJSON (RolePermInfoMap b)) =>
|
|
ToJSON (LogicalModelInfo b)
|
|
where
|
|
toJSON = genericToJSON hasuraJSON
|