|
|
@ -33,37 +33,21 @@ class User(BaseModel): |
|
|
|
class UserInDB(User): |
|
|
|
hashed_password: str = None |
|
|
|
|
|
|
|
class BlogList(BaseModel): |
|
|
|
blogname:Annotated[str,Field( |
|
|
|
title="博客名", |
|
|
|
examples=['blogname'], |
|
|
|
pattern=r'^.{2,50}$', |
|
|
|
description="允许2-50个字符" |
|
|
|
)] |
|
|
|
blogtype:Annotated[str,Field( |
|
|
|
title="博客类型", |
|
|
|
default=None, |
|
|
|
description="博客类型允许为空" |
|
|
|
)] |
|
|
|
viewsnum:Annotated[int,Field( |
|
|
|
title="访问量", |
|
|
|
class TypeList(BaseModel): |
|
|
|
blogid:Annotated[int,Field( |
|
|
|
title="博客id", |
|
|
|
default=None, |
|
|
|
description="访问量可以为空" |
|
|
|
description="博客id可以为空" |
|
|
|
)] |
|
|
|
addtime:Annotated[datetime,Field( |
|
|
|
title="发布时间", |
|
|
|
description="数据库中提供了默认值" |
|
|
|
typename:Annotated[str,Field( |
|
|
|
title="类型名称", |
|
|
|
examples=['typename'], |
|
|
|
pattern=r'^.{2,50}$', |
|
|
|
description="允许2-50个字符" |
|
|
|
)] |
|
|
|
descr:Annotated[str,Field( |
|
|
|
title="备注", |
|
|
|
default=None, |
|
|
|
description="备注允许为空" |
|
|
|
description="博客类型允许为空" |
|
|
|
)] |
|
|
|
|
|
|
|
class BlogAdd(BlogList): |
|
|
|
blogcontent:Annotated[str,Field( |
|
|
|
title="博客内容", |
|
|
|
examples=['blogcontent'], |
|
|
|
pattern=r'^.{2,}$', |
|
|
|
description="不能为空,允许2个或更多字符" |
|
|
|
)] |
|
|
|
|