@@ -13,24 +13,27 @@ class BlogBase(BaseModel):
1313 ...,
1414 min_length = 10 ,
1515 max_length = 255 ,
16- description = "Title of the blog post" ,
16+ description = "Title of the blog post. Must be between 10 and 255 characters. " ,
1717 )
1818 excerpt : str = Field (
1919 ...,
2020 min_length = 20 ,
2121 max_length = 300 ,
22- description = "Short excerpt of the blog post" ,
22+ description = "Short excerpt of the blog post. Must be between 20 and 300 characters. " ,
2323 )
2424 content : str = Field (
2525 ...,
26- description = "Content of the blog post" ,
26+ description = "Full content of the blog post. " ,
2727 )
2828 image_url : str = Field (
2929 ...,
3030 max_length = 255 ,
31- description = "URL of the blog post image" ,
31+ description = "URL of the blog post image." ,
32+ )
33+ is_deleted : Optional [bool ] = Field (
34+ False ,
35+ description = "Flag to indicate if the blog post is deleted. Defaults to False." ,
3236 )
33- is_deleted : Optional [bool ] = False
3437
3538
3639class BlogCreate (BlogBase ):
@@ -46,41 +49,87 @@ class BlogUpdate(BaseModel):
4649 None ,
4750 min_length = 10 ,
4851 max_length = 255 ,
49- description = "Title of the blog post" ,
52+ description = "Title of the blog post. Must be between 10 and 255 characters. " ,
5053 )
5154 excerpt : Optional [str ] = Field (
5255 None ,
5356 min_length = 20 ,
5457 max_length = 300 ,
55- description = "Short excerpt of the blog post" ,
58+ description = "Short excerpt of the blog post. Must be between 20 and 300 characters." ,
59+ )
60+ content : Optional [str ] = Field (
61+ None ,
62+ description = "Full content of the blog post." ,
63+ )
64+ image_url : Optional [str ] = Field (
65+ None ,
66+ max_length = 255 ,
67+ description = "URL of the blog post image." ,
68+ )
69+ is_deleted : Optional [bool ] = Field (
70+ False ,
71+ description = "Flag to indicate if the blog post is deleted. Defaults to False." ,
5672 )
57- content : Optional [str ]
58- image_url : Optional [str ]
59- is_deleted : Optional [bool ] = False
6073
6174
6275class BlogResponse (BlogBase ):
6376 """Schema for returning blog post data."""
6477
65- id : int
66- created_at : datetime
67- updated_at : datetime
78+ id : int = Field (
79+ ...,
80+ description = "Unique identifier for the blog post." ,
81+ )
82+ created_at : datetime = Field (
83+ ...,
84+ description = "Timestamp when the blog post was created." ,
85+ )
86+ updated_at : datetime = Field (
87+ ...,
88+ description = "Timestamp when the blog post was last updated." ,
89+ )
6890
6991
7092class BlogListItemResponse (BaseModel ):
7193 """Schema for representing a blog post item in the list response."""
7294
73- id : int
74- title : str
75- excerpt : str
76- image_url : str
77- created_at : datetime
95+ id : int = Field (
96+ ...,
97+ description = "Unique identifier for the blog post." ,
98+ )
99+ title : str = Field (
100+ ...,
101+ description = "Title of the blog post." ,
102+ )
103+ excerpt : str = Field (
104+ ...,
105+ description = "Short excerpt of the blog post." ,
106+ )
107+ image_url : str = Field (
108+ ...,
109+ description = "URL of the blog post image." ,
110+ )
111+ created_at : datetime = Field (
112+ ...,
113+ description = "Timestamp when the blog post was created." ,
114+ )
78115
79116
80117class BlogListResponse (BaseModel ):
81118 """Schema for representing a blog post listing in the API response."""
82119
83- count : int
84- next : Optional [str ]
85- previous : Optional [str ]
86- results : List [BlogListItemResponse ]
120+ count : int = Field (
121+ ...,
122+ description = "Total number of blog posts." ,
123+ )
124+ next : Optional [str ] = Field (
125+ None ,
126+ description = "URL to the next page of results, if available." ,
127+ )
128+ previous : Optional [str ] = Field (
129+ None ,
130+ description = "URL to the previous page of results, if available." ,
131+ )
132+ results : List [BlogListItemResponse ] = Field (
133+ ...,
134+ description = "List of blog post items." ,
135+ )
0 commit comments