增加了重传和重转录入口
parent
521ec4cc96
commit
955774b89a
|
|
@ -1,18 +1,22 @@
|
|||
from fastapi import APIRouter, Depends
|
||||
from app.core.database import get_db_connection
|
||||
from app.core.response import create_api_response
|
||||
from app.core.auth import get_current_user
|
||||
from app.core.auth import get_current_user, get_optional_current_user
|
||||
from app.models.models import Tag
|
||||
from typing import List
|
||||
from typing import List, Optional
|
||||
import mysql.connector
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@router.get("/tags")
|
||||
def get_user_tags(current_user: dict = Depends(get_current_user)):
|
||||
def get_user_tags(current_user: Optional[dict] = Depends(get_optional_current_user)):
|
||||
"""_summary_
|
||||
获取当前用户创建的所有标签
|
||||
获取当前用户创建的所有标签(如果未认证则返回空列表)
|
||||
"""
|
||||
# 如果未认证,返回空标签列表
|
||||
if not current_user:
|
||||
return create_api_response(code="200", message="获取标签列表成功", data=[])
|
||||
|
||||
query = "SELECT id, name, color FROM tags WHERE creator_id = %s ORDER BY name"
|
||||
try:
|
||||
with get_db_connection() as connection:
|
||||
|
|
|
|||
Loading…
Reference in New Issue