bbs-backend/apis/main/create_tips.py
2023-04-23 14:27:25 +08:00

20 lines
465 B
Python

from pydantic import BaseModel
from defs import app
from models.services.tip import TipAction
class CreateTips(BaseModel):
content: str
async def create_tips_func(tips: CreateTips):
await TipAction.create_tips(tips.content)
@app.post("/create_tips")
async def create_tips(tips: CreateTips):
if not tips.content:
return {"code": 400, "msg": "content is required"}
await create_tips_func(tips)
return {"code": 200, "msg": "success"}