Commit cc1905f6 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge branch '323-dev-fix-node-update-serialization' of...

Merge branch '323-dev-fix-node-update-serialization' of ssh://gitlab.iscpif.fr:20022/gargantext/purescript-gargantext into dev-merge
parents c6497f31 29651a33
module Gargantext.Components.Forest.Tree.Node.Action.Contact.Types where module Gargantext.Components.Forest.Tree.Node.Action.Contact.Types where
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.Newtype (class Newtype)
import Data.Show.Generic (genericShow) import Data.Show.Generic (genericShow)
import Gargantext.Utils.SimpleJSON as GUSJ
import Simple.JSON as JSON import Simple.JSON as JSON
import Gargantext.Prelude (class Eq, class Show) import Gargantext.Prelude (class Eq, class Show)
newtype AddContactParams = data AddContactParams =
AddContactParams { firstname :: String, lastname :: String } AddContactParams { firstname :: String, lastname :: String }
| AddContactParamsAdvanced { firstname :: String, lastname :: String }
derive instance Eq AddContactParams derive instance Eq AddContactParams
derive instance Generic AddContactParams _ derive instance Generic AddContactParams _
derive instance Newtype AddContactParams _
instance Show AddContactParams where show = genericShow instance Show AddContactParams where show = genericShow
derive newtype instance JSON.ReadForeign AddContactParams instance JSON.ReadForeign AddContactParams where readImpl = GUSJ.taggedSumRep
derive newtype instance JSON.WriteForeign AddContactParams instance JSON.WriteForeign AddContactParams where
writeImpl (AddContactParams { firstname, lastname }) =
JSON.writeImpl { type: "AddContactParams"
, values: { firstname, lastname } }
writeImpl (AddContactParamsAdvanced { firstname, lastname }) =
JSON.writeImpl { type: "AddContactParamsAdvanced"
, values: { firstname, lastname } }
...@@ -18,10 +18,18 @@ derive instance Generic UpdateNodeParams _ ...@@ -18,10 +18,18 @@ derive instance Generic UpdateNodeParams _
instance Show UpdateNodeParams where show = genericShow instance Show UpdateNodeParams where show = genericShow
instance JSON.ReadForeign UpdateNodeParams where readImpl = JSONG.untaggedSumRep instance JSON.ReadForeign UpdateNodeParams where readImpl = JSONG.untaggedSumRep
instance JSON.WriteForeign UpdateNodeParams where instance JSON.WriteForeign UpdateNodeParams where
writeImpl (UpdateNodeParamsList { methodList }) = JSON.writeImpl { methodList } writeImpl (UpdateNodeParamsList { methodList }) =
writeImpl (UpdateNodeParamsGraph { methodGraph }) = JSON.writeImpl { methodGraph } JSON.writeImpl { type: "UpdateNodeParamsList"
writeImpl (UpdateNodeParamsTexts { methodTexts }) = JSON.writeImpl { methodTexts } , values: methodList }
writeImpl (UpdateNodeParamsBoard { methodBoard }) = JSON.writeImpl { methodBoard } writeImpl (UpdateNodeParamsGraph { methodGraph }) =
JSON.writeImpl { type: "UpdateNodeParamsGraph"
, methodGraph }
writeImpl (UpdateNodeParamsTexts { methodTexts }) =
JSON.writeImpl { type: "UpdateNodeParamsTexts"
, methodTexts }
writeImpl (UpdateNodeParamsBoard { methodBoard }) =
JSON.writeImpl { type: "UpdateNodeParamsBoard"
, methodBoard }
---------------------------------------------------------------------- ----------------------------------------------------------------------
data Method = Basic | Advanced | WithModel data Method = Basic | Advanced | WithModel
......
...@@ -9,7 +9,6 @@ import Effect.Aff (Aff) ...@@ -9,7 +9,6 @@ import Effect.Aff (Aff)
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
import Simple.JSON as JSON import Simple.JSON as JSON
import Simple.JSON.Generics as JSONG
import Gargantext.Config (publicBackend) import Gargantext.Config (publicBackend)
import Gargantext.Config.REST (get, RESTError) import Gargantext.Config.REST (get, RESTError)
...@@ -17,6 +16,7 @@ import Gargantext.Ends (backendUrl) ...@@ -17,6 +16,7 @@ import Gargantext.Ends (backendUrl)
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.SimpleJSON as GUSJ
here :: R2.Here here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Home.Public" here = R2.here "Gargantext.Components.Nodes.Home.Public"
...@@ -35,9 +35,8 @@ data PublicData = PublicData ...@@ -35,9 +35,8 @@ data PublicData = PublicData
derive instance Eq PublicData derive instance Eq PublicData
derive instance Generic PublicData _ derive instance Generic PublicData _
instance JSON.ReadForeign PublicData where readImpl = JSONG.untaggedSumRep instance JSON.ReadForeign PublicData where readImpl = GUSJ.taggedSumRep
instance Show PublicData where instance Show PublicData where show = genericShow
show = genericShow
------------------------------------------------------------------------ ------------------------------------------------------------------------
type LoadData :: forall k. Row k type LoadData :: forall k. Row k
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment