Repository: moonstream-to/api
Issue: Cant PUT to /dashboard/id

```
curl 'https://api.moonstream.to/dashboards/<id>' \\
  -X 'PUT' \\
  -H 'authority: api.moonstream.to' \\
  -H 'accept: application/json, text/plain, */*' \\
  -H 'content-type: application/json' \\
  -H 'authorization: Bearer <token>' \\
  --data-raw '{"dashboard_id":"<dashboard_id>","name":"some name","subscriptions":[{"events":[],"generic":[{"name":"transactions_in"},{"name":"transactions_out"},{"name":"value_in"},{"name":"value_out"},{"name":"balance"}],"methods":[],"all_events":true,"all_methods":true,"subscription_id":"<subscription_id>"}]}' \\
```

causes 422 error with response:
```
{"detail":[{"loc":["query","name"],"msg":"field required","type":"value_error.missing"},{"loc":["body"],"msg":"value is not a valid list","type":"type_error.list"}]}
```

Changed files:
backend/moonstreamapi/data.py, backend/moonstreamapi/routes/dashboards.py

diff --git a/backend/moonstreamapi/data.py b/backend/moonstreamapi/data.py
index 1ee1fb39..08ca56a8 100644
--- a/backend/moonstreamapi/data.py
+++ b/backend/moonstreamapi/data.py
@@ -249,3 +249,8 @@ class DashboardResource(BaseModel):
 class DashboardCreate(BaseModel):
     name: str
     subscriptions: List[DashboardMeta]
+
+
+class DashboardUpdate(BaseModel):
+    name: Optional[str]
+    subscriptions: List[DashboardMeta] = Field(default_factory=list)
diff --git a/backend/moonstreamapi/routes/dashboards.py b/backend/moonstreamapi/routes/dashboards.py
index 4711a2f5..242f58c0 100644
--- a/backend/moonstreamapi/routes/dashboards.py
+++ b/backend/moonstreamapi/routes/dashboards.py
@@ -7,7 +7,7 @@ from uuid import UUID
 import boto3  # type: ignore
 from bugout.data import BugoutResource, BugoutResources
 from bugout.exceptions import BugoutResponseException
-from fastapi import APIRouter, Request, Query
+from fastapi import APIRouter, Request, Query, Body
 
 from .. import actions
 from .. import data
@@ -41,7 +41,7 @@ blockchain_by_subscription_id = {
 
 @router.post("/", tags=["dashboards"], response_model=BugoutResource)
 async def add_dashboard_handler(
-    request: Request, dashboard: data.DashboardCreate
+    request: Request, dashboard: data.DashboardCreate = Body(...)
 ) -> BugoutResource:
     """
     Add subscription to blockchain stream data for user.
@@ -231,10 +231,7 @@ async def get_dashboard_handler(
 
 @router.put("/{dashboard_id}", tags=["dashboards"], response_model=BugoutResource)
 async def update_dashboard_handler(
-    request: Request,
-    dashboard_id: str,
-    name: Optional[str],
-    subscriptions: List[data.DashboardMeta],
+    request: Request, dashboard_id: str, dashboard: data.DashboardUpdate = Body(...)
 ) -> BugoutResource:
     """
     Update dashboards mainly fully overwrite name and subscription metadata
@@ -244,7 +241,7 @@ async def update_dashboard_handler(
 
     user = request.state.user
 
-    dashboard_subscriptions = subscriptions
+    dashboard_subscriptions = dashboard.subscriptions
 
     params = {
         "type": BUGOUT_RESOURCE_TYPE_SUBSCRIPTION,
@@ -277,7 +274,7 @@ async def update_dashboard_handler(
                 "bucket"
             ]
             abi_path = available_subscriptions[dashboard_subscription.subscription_id][
-                "abi_path"
+                "s3_path"
             ]
 
             if bucket is None or abi_path is None:
@@ -306,8 +303,7 @@ async def update_dashboard_handler(
                     internal_error=e,
                     detail=f"We can't access the abi for subscription with id:{dashboard_subscription.subscription_id}.",
                 )
-
-            abi = data.DashboardMeta(**response["Body"].read().decode("utf-8"))
+            abi = json.loads(response["Body"].read())
 
             actions.dashboards_abi_validation(
                 dashboard_subscription, abi, s3_path=s3_path
@@ -321,23 +317,25 @@ async def update_dashboard_handler(
 
     dashboard_resource: Dict[str, Any] = {}
 
-    if subscriptions:
+    if dashboard_subscriptions:
 
-        dashboard_resource["subscriptions"] = subscriptions
+        dashboard_resource["dashboard_subscriptions"] = json.loads(dashboard.json())[
+            "subscriptions"
+        ]
 
-    if name is not None:
-        dashboard_resource["name"] = name
+    if dashboard.name is not None:
+        dashboard_resource["name"] = dashboard.name
 
     try:
         resource: BugoutResource = bc.update_resource(
             token=token,
             resource_id=dashboard_id,
-            resource_data=dashboard_resource,
+            resource_data=data.SubscriptionUpdate(update=dashboard_resource).dict(),
         )
     except BugoutResponseException as e:
         raise MoonstreamHTTPException(status_code=e.status_code, detail=e.detail)
     except Exception as e:
-        logger.error(f"Error creating subscription resource: {str(e)}")
+        logger.error(f"Error updating subscription resource: {str(e)}")
         raise MoonstreamHTTPException(status_code=500, internal_error=e)
 
     return resource