kopia lustrzana https://github.com/bugout-dev/moonstream
Merge pull request #232 from bugout-dev/fix-missing-created-at-in-subscription-responses
Add created_at and updated_at.pull/261/head
commit
0799c62f0d
|
@ -4,6 +4,7 @@ Pydantic schemas for the Moonstream HTTP API
|
|||
from typing import List, Optional, Dict, Any
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from datetime import datetime
|
||||
|
||||
USER_ONBOARDING_STATE = "onboarding_state"
|
||||
|
||||
|
@ -30,6 +31,8 @@ class SubscriptionResourceData(BaseModel):
|
|||
label: Optional[str]
|
||||
user_id: str
|
||||
subscription_type_id: str
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
|
||||
class CreateSubscriptionRequest(BaseModel):
|
||||
|
|
|
@ -113,6 +113,8 @@ async def add_subscription_handler(
|
|||
color=resource.resource_data["color"],
|
||||
label=resource.resource_data["label"],
|
||||
subscription_type_id=resource.resource_data["subscription_type_id"],
|
||||
updated_at=resource.updated_at,
|
||||
created_at=resource.created_at,
|
||||
)
|
||||
|
||||
|
||||
|
@ -141,6 +143,8 @@ async def delete_subscription_handler(request: Request, subscription_id: str):
|
|||
color=deleted_resource.resource_data["color"],
|
||||
label=deleted_resource.resource_data["label"],
|
||||
subscription_type_id=deleted_resource.resource_data["subscription_type_id"],
|
||||
updated_at=deleted_resource.updated_at,
|
||||
created_at=deleted_resource.created_at,
|
||||
)
|
||||
|
||||
|
||||
|
@ -174,6 +178,8 @@ async def get_subscriptions_handler(request: Request) -> data.SubscriptionsListR
|
|||
color=resource.resource_data["color"],
|
||||
label=resource.resource_data["label"],
|
||||
subscription_type_id=resource.resource_data["subscription_type_id"],
|
||||
updated_at=resource.updated_at,
|
||||
created_at=resource.created_at,
|
||||
)
|
||||
for resource in resources.resources
|
||||
]
|
||||
|
@ -225,6 +231,8 @@ async def update_subscriptions_handler(
|
|||
color=resource.resource_data["color"],
|
||||
label=resource.resource_data["label"],
|
||||
subscription_type_id=resource.resource_data["subscription_type_id"],
|
||||
updated_at=resource.updated_at,
|
||||
created_at=resource.created_at,
|
||||
)
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue