kopia lustrzana https://github.com/bugout-dev/moonstream
Add fixes for work with json data insted form data.
rodzic
a5d3226496
commit
15ee42a837
|
@ -249,3 +249,9 @@ class DashboardResource(BaseModel):
|
||||||
class DashboardCreate(BaseModel):
|
class DashboardCreate(BaseModel):
|
||||||
name: str
|
name: str
|
||||||
subscriptions: List[DashboardMeta]
|
subscriptions: List[DashboardMeta]
|
||||||
|
|
||||||
|
|
||||||
|
class DashboardUpdate(BaseModel):
|
||||||
|
dashboard_id: Union[str,UUID]
|
||||||
|
name: str
|
||||||
|
subscriptions: List[DashboardMeta]
|
|
@ -232,9 +232,7 @@ async def get_dashboard_handler(
|
||||||
@router.put("/{dashboard_id}", tags=["dashboards"], response_model=BugoutResource)
|
@router.put("/{dashboard_id}", tags=["dashboards"], response_model=BugoutResource)
|
||||||
async def update_dashboard_handler(
|
async def update_dashboard_handler(
|
||||||
request: Request,
|
request: Request,
|
||||||
dashboard_id: str,
|
dashboard: data.DashboardUpdate
|
||||||
name: Optional[str],
|
|
||||||
subscriptions: List[data.DashboardMeta],
|
|
||||||
) -> BugoutResource:
|
) -> BugoutResource:
|
||||||
"""
|
"""
|
||||||
Update dashboards mainly fully overwrite name and subscription metadata
|
Update dashboards mainly fully overwrite name and subscription metadata
|
||||||
|
@ -244,7 +242,7 @@ async def update_dashboard_handler(
|
||||||
|
|
||||||
user = request.state.user
|
user = request.state.user
|
||||||
|
|
||||||
dashboard_subscriptions = subscriptions
|
dashboard_subscriptions = dashboard.subscriptions
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
"type": BUGOUT_RESOURCE_TYPE_SUBSCRIPTION,
|
"type": BUGOUT_RESOURCE_TYPE_SUBSCRIPTION,
|
||||||
|
@ -321,17 +319,17 @@ async def update_dashboard_handler(
|
||||||
|
|
||||||
dashboard_resource: Dict[str, Any] = {}
|
dashboard_resource: Dict[str, Any] = {}
|
||||||
|
|
||||||
if subscriptions:
|
if dashboard_subscriptions:
|
||||||
|
|
||||||
dashboard_resource["subscriptions"] = subscriptions
|
dashboard_resource["subscriptions"] = dashboard_subscriptions
|
||||||
|
|
||||||
if name is not None:
|
if dashboard.name is not None:
|
||||||
dashboard_resource["name"] = name
|
dashboard_resource["name"] = dashboard.name
|
||||||
|
|
||||||
try:
|
try:
|
||||||
resource: BugoutResource = bc.update_resource(
|
resource: BugoutResource = bc.update_resource(
|
||||||
token=token,
|
token=token,
|
||||||
resource_id=dashboard_id,
|
resource_id=dashboard.dashboard_id,
|
||||||
resource_data=dashboard_resource,
|
resource_data=dashboard_resource,
|
||||||
)
|
)
|
||||||
except BugoutResponseException as e:
|
except BugoutResponseException as e:
|
||||||
|
|
Ładowanie…
Reference in New Issue