10
10
import sentry_sdk
11
11
import uvicorn # type: ignore
12
12
from fastapi import Body , Depends , FastAPI , Request
13
- from fastapi .encoders import jsonable_encoder
14
13
from fastapi .responses import HTMLResponse
15
14
from fastapi .staticfiles import StaticFiles
16
15
from fastapi .templating import Jinja2Templates
@@ -104,14 +103,16 @@ def bugzilla_webhook(
104
103
105
104
106
105
@app .get ("/whiteboard_tags/" )
107
- def get_whiteboard_tag (
106
+ def get_whiteboard_tags (
108
107
whiteboard_tag : Optional [str ] = None ,
109
108
actions : Actions = Depends (configuration .get_actions ),
110
109
):
111
110
"""API for viewing whiteboard_tags and associated data"""
112
111
if existing := actions .get (whiteboard_tag ):
113
- return {whiteboard_tag : existing }
114
- return actions .by_tag
112
+ filtered = {whiteboard_tag : existing }
113
+ else :
114
+ filtered = actions .by_tag # type: ignore
115
+ return {k : v .dict () for k , v in filtered .items ()}
115
116
116
117
117
118
@app .get ("/jira_projects/" )
@@ -131,7 +132,7 @@ def powered_by_jbi(
131
132
context = {
132
133
"request" : request ,
133
134
"title" : "Powered by JBI" ,
134
- "actions" : jsonable_encoder ( actions ) ,
135
+ "actions" : [ action . dict () for action in actions ] ,
135
136
"enable_query" : enabled ,
136
137
}
137
138
return templates .TemplateResponse ("powered_by_template.html" , context )
0 commit comments