Merge pull request #232 from bugout-dev/fix-missing-created-at-in-subscription-responses

Add created_at and updated_at.
pull/261/head
Andrei-Dolgolev 2021-09-13 15:48:26 +03:00 zatwierdzone przez GitHub
commit 0799c62f0d
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 11 dodań i 0 usunięć

Wyświetl plik

@ -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):

Wyświetl plik

@ -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,
)