feat: add models final part 5
This commit is contained in:
@@ -13,7 +13,7 @@ class Pagination(BaseModel):
|
||||
|
||||
class PostsPagintaion(BaseModel):
|
||||
limit: int = 20
|
||||
next_cursor: int = Field(1, alias='nextCursor')
|
||||
next_cursor: int | None = Field(1, alias='nextCursor')
|
||||
has_more: bool = Field(True, alias='hasMore')
|
||||
|
||||
|
||||
|
||||
6
itd/models/pin.py
Normal file
6
itd/models/pin.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from pydantic import BaseModel
|
||||
|
||||
class Pin(BaseModel):
|
||||
slug: str
|
||||
name: str
|
||||
description: str
|
||||
@@ -44,8 +44,3 @@ class Post(_Post, PostShort):
|
||||
|
||||
class NewPost(_Post):
|
||||
author: UserNewPost
|
||||
|
||||
|
||||
class LikePostResponse(BaseModel):
|
||||
liked: bool
|
||||
likes_count: int = Field(alias="likesCount")
|
||||
|
||||
@@ -5,12 +5,15 @@ from pydantic import BaseModel, Field
|
||||
|
||||
from itd.enums import ReportTargetType, ReportTargetReason
|
||||
|
||||
class Report(BaseModel):
|
||||
|
||||
class NewReport(BaseModel):
|
||||
id: UUID
|
||||
created_at: datetime = Field(alias='createdAt')
|
||||
|
||||
|
||||
class Report(NewReport):
|
||||
reason: ReportTargetReason
|
||||
description: str | None = None
|
||||
|
||||
target_type: ReportTargetType = Field(alias='targetType')
|
||||
target_id: UUID
|
||||
|
||||
created_at: datetime = Field(alias='createdAt')
|
||||
@@ -3,6 +3,8 @@ from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from itd.models.pin import Pin
|
||||
|
||||
|
||||
class UserPrivacy(BaseModel):
|
||||
private: bool | None = Field(None, alias='isPrivate') # none for not me
|
||||
@@ -24,6 +26,7 @@ class UserNewPost(BaseModel):
|
||||
username: str | None = None
|
||||
display_name: str = Field(alias='displayName')
|
||||
avatar: str
|
||||
pin: Pin | None = None
|
||||
|
||||
verified: bool = False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user