Spaces:
Sleeping
Sleeping
File size: 1,736 Bytes
3973360 d09d6c2 3973360 ef3c550 3973360 ef3c550 3973360 8c4ead2 5426b49 3973360 8c4ead2 3973360 5426b49 3973360 8c4ead2 d09d6c2 3973360 8c4ead2 8653fe1 3973360 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | from pydantic import Field
from typing import Optional
from .BaseModel import BaseDocument
class Comment(BaseDocument):
content: str = Field("", description="Post's content")
user_id: str = Field("", description="User's id")
post_id: str = Field("", description="Post's id")
model_config = {
"json_schema_extra": {
"example": {
"content": "John Doe",
"user_id": "1234567890",
"post_id": "1234567890",
}
}
}
class Reaction(BaseDocument):
user_id: str = Field("", description="User's id")
post_id: str = Field("", description="Post's id")
type: int = Field(0, description="Type of like", ge=0, lt=5)
model_config = {
"json_schema_extra": {
"example": {
"user_id": "1234567890",
"post_id": "1234567890",
"type": 1,
}
}
}
class Post(BaseDocument):
content: str = Field("", description="Post's content")
user_id: str = Field("", description="User's id")
destination_id: str = Field("", description="Destination's id")
comment_count: int = Field(0, description="Comment's id")
reaction_count: int = Field(0, description="User's id who like this post")
picture: Optional[list[str]] = Field([], description="Picture's url")
model_config = {
"json_schema_extra": {
"example": {
"content": "John Doe",
"user_id": "1234567890",
"destination_id": "1234567890",
"comment_count": 1,
"reaction_count": 1,
"picture": ["https://example.com/picture.jpg"],
}
}
}
|