feat: add profile rename, all postcard fields required

This commit is contained in:
2026-07-05 19:00:25 +08:00
parent 5aa8b7e7f2
commit d7850d200f
4 changed files with 32 additions and 15 deletions

View File

@@ -139,6 +139,15 @@ def profile_delete(profile_id: int, user: User = Depends(get_current_user_web),
return _redirect("/profiles")
@router.post("/profiles/{profile_id}/rename")
def profile_rename(profile_id: int, nickname: str = Form(...), user: User = Depends(get_current_user_web), db: Session = Depends(get_db)):
p = db.query(Profile).filter(Profile.id == profile_id, Profile.user_id == user.id).first()
if p:
p.nickname = nickname
db.commit()
return _redirect("/profiles")
# ---------- Postcards ----------
@router.get("/profiles/{profile_id}/postcards", response_class=HTMLResponse)