update. 更新新闻接口
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
from ninja import Schema
|
||||
from typing import Optional
|
||||
from pydantic import constr
|
||||
|
||||
# 新闻模块
|
||||
class NewsSectionSchema(Schema):
|
||||
id: int
|
||||
title: str
|
||||
code: str
|
||||
order: int
|
||||
visible: bool
|
||||
|
||||
class NewsSectionCreateSchema(Schema):
|
||||
title: constr(max_length=100)
|
||||
code: constr(max_length=50)
|
||||
order: Optional[int] = 0
|
||||
visible: Optional[bool] = True
|
||||
|
||||
class NewsSectionUpdateSchema(Schema):
|
||||
title: Optional[constr(max_length=100)]
|
||||
code: Optional[constr(max_length=50)]
|
||||
order: Optional[int]
|
||||
visible: Optional[bool]
|
||||
|
||||
# 新闻内容
|
||||
class NewsSchema(Schema):
|
||||
id: int
|
||||
title: str
|
||||
section_id: int
|
||||
author_id: Optional[int]
|
||||
content: str
|
||||
cover: Optional[str]
|
||||
is_published: bool
|
||||
|
||||
class NewsCreateSchema(Schema):
|
||||
title: constr(max_length=200)
|
||||
section_id: int
|
||||
author_id: Optional[int]
|
||||
content: str
|
||||
cover: Optional[str]
|
||||
is_published: Optional[bool] = True
|
||||
|
||||
class NewsUpdateSchema(Schema):
|
||||
title: Optional[constr(max_length=200)]
|
||||
section_id: Optional[int]
|
||||
author_id: Optional[int]
|
||||
content: Optional[str]
|
||||
cover: Optional[str]
|
||||
is_published: Optional[bool]
|
||||
Reference in New Issue
Block a user