[API] small refactoring to get explicit constructors

This makes it easier for me to grep code
parent 32064288
Pipeline #7572 failed with stages
in 14 minutes and 51 seconds
......@@ -60,10 +60,13 @@ import Servant.Server.Generic (AsServerT)
getAPI :: Named.GETAPI (AsServerT (GargM Env BackendInternalError))
getAPI = Named.GETAPI $ \listId -> Named.ListEndpoints
{ listJSONEp = getJson listId
, listJSONZipEp = getJsonZip listId
, listTSVEp = getTsv listId
getAPI = Named.GETAPI
{
getListEp = \listId -> Named.ListEndpoints
{ listJSONEp = getJson listId
, listJSONZipEp = getJsonZip listId
, listTSVEp = getTsv listId
}
}
--
......
......@@ -234,11 +234,11 @@ genericNodeAPI' :: forall a proxy. ( HyperdataC a )
-> Named.NodeAPI a (AsServerT (GargM Env BackendInternalError))
genericNodeAPI' _ authenticatedUser targetNode = Named.NodeAPI
{ nodeNodeAPI = withNamedPolicyT authenticatedUser (nodeReadChecks targetNode) $
Named.NodeNodeAPI $ getNodeWith targetNode (Proxy :: Proxy a)
Named.NodeNodeAPI { getNodeEp = getNodeWith targetNode (Proxy :: Proxy a) }
, renameAPI = withNamedPolicyT authenticatedUser (nodeWriteChecks targetNode) $
Named.RenameAPI $ rename loggedInUserId targetNode
Named.RenameAPI { renameEp = rename loggedInUserId targetNode }
, postNodeAPI = withNamedPolicyT authenticatedUser (nodeWriteChecks targetNode) $
Named.PostNodeAPI $ postNode authenticatedUser targetNode
Named.PostNodeAPI { postWithParentEp = postNode authenticatedUser targetNode }
, postNodeAsyncAPI = withNamedPolicyT authenticatedUser (nodeWriteChecks targetNode) $
postNodeAsyncAPI authenticatedUser targetNode
, frameCalcUploadAPI = FrameCalcUpload.api authenticatedUser targetNode
......@@ -247,29 +247,29 @@ genericNodeAPI' _ authenticatedUser targetNode = Named.NodeAPI
Update.api targetNode
, deleteEp = withPolicy authenticatedUser (nodeWriteChecks targetNode) $
Action.deleteNode userRootId targetNode
, childrenAPI = Named.ChildrenAPI $ getChildren targetNode (Proxy :: Proxy a)
, childrenAPI = Named.ChildrenAPI { summaryChildrenEp = getChildren targetNode (Proxy :: Proxy a) }
, tableAPI = tableApi targetNode
, tableNgramsAPI = apiNgramsTableCorpus targetNode
, catAPI = Named.CatAPI $ catApi targetNode
, scoreAPI = Named.ScoreAPI $ scoreApi targetNode
, catAPI = Named.CatAPI { categoriseEp = catApi targetNode }
, scoreAPI = Named.ScoreAPI { scoreNodesEp = scoreApi targetNode }
, searchAPI = Search.api targetNode
, shareAPI = Named.ShareNode $ Share.api userRootId targetNode
, shareAPI = Named.ShareNode { shareNodeEp = Share.api userRootId targetNode }
, unshareEp = Share.unShare targetNode
, publishAPI = withNamedPolicyT authenticatedUser (publishChecks targetNode) $
Named.PublishAPI $ \Named.PublishRequest{pubrq_policy} -> U.publish loggedInUserId targetNode pubrq_policy
Named.PublishAPI { publishEp = \Named.PublishRequest{pubrq_policy} -> U.publish loggedInUserId targetNode pubrq_policy }
---- Pairing utilities
, pairWithEp = pairWith targetNode
, pairsEp = pairs targetNode
, pairingEp = Named.PairingAPI $ getPair targetNode
, pairingEp = Named.PairingAPI { getPairingEp = getPair targetNode }
---- VIZ
, scatterAPI = scatterApi targetNode
, chartAPI = chartApi targetNode
, pieAPI = pieApi targetNode
, treeAPI = treeApi targetNode
, phyloAPI = phyloAPI targetNode
, moveAPI = Named.MoveAPI $ \parentId ->
, moveAPI = Named.MoveAPI { moveNodeEp = \parentId ->
withPolicy authenticatedUser (moveChecks (SourceId targetNode) (TargetId parentId)) $
moveNode loggedInUserId targetNode parentId
moveNode loggedInUserId targetNode parentId }
, fileAPI = Named.FileAPI { fileDownloadEp = fileApi targetNode }
, fileAsyncAPI = fileAsyncApi authenticatedUser targetNode
, dfwnAPI = DFWN.api authenticatedUser targetNode
......
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