Merge branch 'main' of https://gitee.com/wg123/video-gen
This commit is contained in:
@@ -222,6 +222,40 @@ async def get_pending_requests(db: AsyncSession, team_id: str) -> list[dict[str,
|
||||
"status": req.status,
|
||||
"note": req.note,
|
||||
"created_at": req.created_at,
|
||||
"handled_at": req.updated_at if req.status != "pending" else None,
|
||||
}
|
||||
for req, username, phone in rows
|
||||
]
|
||||
|
||||
|
||||
async def get_all_requests(
|
||||
db: AsyncSession,
|
||||
team_id: str,
|
||||
status: str | None = None,
|
||||
) -> list[dict[str, Any]]:
|
||||
"""获取团队所有加入申请列表,支持按状态筛选。"""
|
||||
where = [TeamJoinRequest.team_id == team_id]
|
||||
if status:
|
||||
where.append(TeamJoinRequest.status == status)
|
||||
|
||||
result = await db.execute(
|
||||
select(TeamJoinRequest, User.username, User.phone)
|
||||
.join(User, User.id == TeamJoinRequest.user_id)
|
||||
.where(*where)
|
||||
.order_by(TeamJoinRequest.created_at.desc())
|
||||
)
|
||||
rows = result.all()
|
||||
return [
|
||||
{
|
||||
"id": req.id,
|
||||
"team_id": req.team_id,
|
||||
"user_id": req.user_id,
|
||||
"username": username,
|
||||
"phone": phone,
|
||||
"status": req.status,
|
||||
"note": req.note,
|
||||
"created_at": req.created_at,
|
||||
"handled_at": req.updated_at if req.status != "pending" else None,
|
||||
}
|
||||
for req, username, phone in rows
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user