49379fd045
- /api/v1/user: PATCH 改昵称、POST 上传头像、DELETE 注销账号(软删除+匿名化) - /api/v1/feedback: 提交反馈(内容/联系方式/截图入库) - 新增 media 模块(图片落盘+魔数校验)+ /media 静态服务 - feedback 表 + Alembic 迁移(部署需 alembic upgrade head) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
28 lines
504 B
Python
28 lines
504 B
Python
"""feedback 表写入。"""
|
|
from __future__ import annotations
|
|
|
|
from sqlalchemy.orm import Session
|
|
|
|
from app.models.feedback import Feedback
|
|
|
|
|
|
def create_feedback(
|
|
db: Session,
|
|
*,
|
|
user_id: int,
|
|
content: str,
|
|
contact: str,
|
|
images: list[str] | None,
|
|
) -> Feedback:
|
|
fb = Feedback(
|
|
user_id=user_id,
|
|
content=content,
|
|
contact=contact,
|
|
images=images or None,
|
|
status="new",
|
|
)
|
|
db.add(fb)
|
|
db.commit()
|
|
db.refresh(fb)
|
|
return fb
|