Formatted with ormolu.

This commit is contained in:
Martin Sosic 2021-07-21 16:05:55 +02:00
parent d8bd9ce674
commit 29fd18dbcc
2 changed files with 5 additions and 5 deletions

View File

@ -80,7 +80,7 @@ relPosixPathFromOperationsRoutesDirToSrcDir = [reldirP|../..|]
genOperationsRouter :: Wasp -> FileDraft
genOperationsRouter wasp
-- TODO: Right now we are throwing error here, but we should instead perform this check in parsing/analyzer phase, as a semantic check, since we have all the info we need then already.
-- TODO: Right now we are throwing error here, but we should instead perform this check in parsing/analyzer phase, as a semantic check, since we have all the info we need then already.
| usingAuthOnAnyOperation && (not isAuthEnabled) = error "`auth` cannot be specified for specific operations if it is not enabled for the whole app!"
| otherwise = C.makeTemplateFD tmplFile dstFile (Just tmplData)
where
@ -103,10 +103,10 @@ genOperationsRouter wasp
"routePath" .= ("/" ++ operationRouteInOperationsRouter operation),
"isUsingAuth" .= (isUsingAuth operation)
]
isAuthEnabled = (isJust $ getAuth wasp)
isUsingAuth :: Wasp.Operation.Operation -> Bool
isUsingAuth op = (Wasp.Operation.getAuth op /= Just False)
isUsingAuth op = (Wasp.Operation.getAuth op /= Just False)
operationRouteInOperationsRouter :: Wasp.Operation.Operation -> String
operationRouteInOperationsRouter = U.camelToKebabCase . Wasp.Operation.getName

View File

@ -3,7 +3,7 @@ module Wasp.Operation
getName,
getJsFn,
getEntities,
getAuth
getAuth,
)
where
@ -34,4 +34,4 @@ getEntities (ActionOp action) = Action._entities action
getAuth :: Operation -> Maybe Bool
getAuth (QueryOp query) = Query._auth query
getAuth (ActionOp action) = Action._auth action
getAuth (ActionOp action) = Action._auth action