feat: add v2 manifest bootstrap endpoints
This commit is contained in:
parent
4ebc04e1f4
commit
50735bb7cf
9 changed files with 408 additions and 4 deletions
|
|
@ -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
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue