generated from coulomb/repo-seed
feat: add v2 manifest bootstrap endpoints
Some checks failed
Build and Deploy / build-push-deploy (push) Has been cancelled
Some checks failed
Build and Deploy / build-push-deploy (push) Has been cancelled
This commit is contained in:
@@ -4,6 +4,7 @@ module Web.Controller.Api.V2.Registries where
|
||||
-- GET /api/v2/widget-types
|
||||
-- GET /api/v2/event-types
|
||||
-- GET /api/v2/annotation-categories
|
||||
-- GET /api/v2/policy-scopes
|
||||
|
||||
import Web.Types
|
||||
import Generated.Types
|
||||
@@ -34,6 +35,13 @@ instance Controller ApiV2RegistriesController where
|
||||
|> fetch
|
||||
renderJson $ map acToJson cats
|
||||
|
||||
action ApiV2ListPolicyScopesAction = do
|
||||
scopes <- query @PolicyScopeRegistry
|
||||
|> filterWhere (#status, "active")
|
||||
|> orderByAsc #name
|
||||
|> fetch
|
||||
renderJson $ map psToJson scopes
|
||||
|
||||
wtToJson :: WidgetTypeRegistry -> Value
|
||||
wtToJson r = object
|
||||
[ "name" .= r.name
|
||||
@@ -60,3 +68,12 @@ acToJson r = object
|
||||
, "ownerHubId" .= r.ownerHubId
|
||||
, "status" .= r.status
|
||||
]
|
||||
|
||||
psToJson :: PolicyScopeRegistry -> Value
|
||||
psToJson r = object
|
||||
[ "name" .= r.name
|
||||
, "label" .= r.label_
|
||||
, "description" .= r.description
|
||||
, "ownerHubId" .= r.ownerHubId
|
||||
, "status" .= r.status
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user