Add morpheus instances for Scope
This commit is contained in:
parent
bb96e415e7
commit
53f9d0d323
|
@ -83,7 +83,18 @@ data Scope = OwnProfile
|
||||||
| Tokens UserID
|
| Tokens UserID
|
||||||
| Members
|
| Members
|
||||||
| Applications
|
| Applications
|
||||||
deriving (Show, Eq, Ord, Read)
|
deriving (Show, Eq, Ord, Read, Generic)
|
||||||
|
|
||||||
|
instance DecodeScalar Scope where
|
||||||
|
decodeScalar (String s) = maybe (Left $ "invalid Scope: \"" <> s <> "\"") Right $ readMaybe (toString s)
|
||||||
|
decodeScalar _ = Left "Invalid type for Scope, should be string"
|
||||||
|
|
||||||
|
instance EncodeScalar Scope where
|
||||||
|
encodeScalar = String . show
|
||||||
|
|
||||||
|
instance GQLType Scope where type KIND Scope = SCALAR
|
||||||
|
instance ToJSON Scope where toJSON = scalarToJSON
|
||||||
|
instance FromJSON Scope where parseJSON = scalarFromJSON <=< parseJSON
|
||||||
|
|
||||||
data Permission = None
|
data Permission = None
|
||||||
| ReadOnly
|
| ReadOnly
|
||||||
|
|
Loading…
Reference in New Issue