Skip to content

Commit cc5dd43

Browse files
committed
CMS
1 parent 7278b03 commit cc5dd43

File tree

5 files changed

+31
-6
lines changed

5 files changed

+31
-6
lines changed

alembic/versions/281723ba07be_add_cms_content_table.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
# revision identifiers, used by Alembic.
1515
revision = "281723ba07be"
16-
down_revision = "156d8781d7b8"
16+
down_revision = "056b595a6a00"
1717
branch_labels = None
1818
depends_on = None
1919

app/api/cms.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,15 @@ async def get_cms_content(
5252
skip=pagination.skip,
5353
limit=pagination.limit,
5454
)
55+
logger.info(
56+
"Retrieved digital content",
57+
content_type=content_type,
58+
query=query,
59+
data=data,
60+
jsonpath_match=jsonpath_match,
61+
skip=pagination.skip,
62+
limit=pagination.limit,
63+
)
5564
except ValueError as e:
5665
raise HTTPException(
5766
status_code=status.HTTP_400_BAD_REQUEST, detail=str(e)

app/crud/content.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ async def aget_all_with_optional_filters(
6666
try:
6767
return (await db.scalars(query)).all()
6868
except (ProgrammingError, DataError) as e:
69-
logger.error("Error querying events", error=e, **optional_filters)
69+
logger.error("Error querying digital content", error=e, **optional_filters)
7070
raise ValueError("Problem filtering content")
7171

7272

app/models/cms_content.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ class CMSContent(Base):
2626
UUID(as_uuid=True),
2727
default=uuid.uuid4,
2828
server_default=text("gen_random_uuid()"),
29-
unique=True,
3029
primary_key=True,
31-
index=True,
32-
nullable=False,
3330
)
3431

3532
type: Mapped[ContentType] = mapped_column(

app/schemas/cms_content.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,28 @@
1+
from datetime import datetime
2+
from typing import Any, Optional
3+
4+
from pydantic import UUID4, BaseModel, ConfigDict
5+
6+
from app.models.cms_content import ContentType
17
from app.schemas.pagination import PaginatedResponse
28

39

10+
class CMSBrief(BaseModel):
11+
id: UUID4
12+
type: ContentType
13+
14+
model_config = ConfigDict(from_attributes=True)
15+
16+
17+
class CMSDetail(CMSBrief):
18+
created_at: datetime
19+
updated_at: datetime
20+
content: Optional[dict[str, Any]] = None
21+
22+
423
class CMSTypesResponse(PaginatedResponse):
524
data: list[str]
625

726

827
class CMSContentResponse(PaginatedResponse):
9-
data: list[str]
28+
data: list[CMSDetail]

0 commit comments

Comments
 (0)