feat: refine task and countdown interactions
ci / gitleaks (push) Successful in 9s
ci / docker (push) Successful in 3m31s

This commit is contained in:
2026-09-17 09:32:22 +08:00
parent bdf2a53fa9
commit 1571c3946f
14 changed files with 388 additions and 31 deletions
+13
View File
@@ -827,6 +827,19 @@ async def pin_countdown(countdown_id: UUID, user: User = Depends(current_user),
return countdown_dict(row)
@router.delete("/countdowns/{countdown_id}/pin")
async def unpin_countdown(countdown_id: UUID, user: User = Depends(current_user), db: AsyncSession = Depends(get_db)):
row = await owned_countdown(db, user.id, countdown_id)
if row.archived_at is not None:
raise HTTPException(409, "已归档倒数日不能取消置顶")
row.pinned = False
row.updated_at = utcnow()
audit(db, user.id, "update", "countdown", row.id)
await db.commit()
await db.refresh(row)
return countdown_dict(row)
@router.delete("/countdowns/{countdown_id}", status_code=204)
async def archive_countdown(countdown_id: UUID, user: User = Depends(current_user), db: AsyncSession = Depends(get_db)):
row = await owned_countdown(db, user.id, countdown_id)