mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 12:25:20 +00:00
feat/enh: group export endpoint
This commit is contained in:
parent
28659f6af5
commit
09b6ea38c5
1 changed files with 26 additions and 0 deletions
|
|
@ -106,6 +106,32 @@ async def get_group_by_id(id: str, user=Depends(get_admin_user)):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
############################
|
||||||
|
# ExportGroupById
|
||||||
|
############################
|
||||||
|
|
||||||
|
|
||||||
|
class GroupExportResponse(GroupResponse):
|
||||||
|
user_ids: list[str] = []
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@router.get("/id/{id}/export", response_model=Optional[GroupExportResponse])
|
||||||
|
async def export_group_by_id(id: str, user=Depends(get_admin_user)):
|
||||||
|
group = Groups.get_group_by_id(id)
|
||||||
|
if group:
|
||||||
|
return GroupExportResponse(
|
||||||
|
**group.model_dump(),
|
||||||
|
member_count=Groups.get_group_member_count_by_id(group.id),
|
||||||
|
user_ids=Groups.get_group_user_ids_by_id(group.id),
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||||
|
detail=ERROR_MESSAGES.NOT_FOUND,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
############################
|
############################
|
||||||
# UpdateGroupById
|
# UpdateGroupById
|
||||||
############################
|
############################
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue