fix activedomain

This commit is contained in:
2024-11-27 15:56:26 +09:00
parent c5048a2ac3
commit aa7daf4447
3 changed files with 21 additions and 13 deletions

View File

@@ -368,21 +368,21 @@ async def userdomain_delete(
@r.get(
"/activedomain",
response_model=ApiReturnModel[Domain],
response_model=ApiReturnModel[ActiveDomain|None],
response_model_exclude_none=True,
)
async def get_useractivedomain(
async def get_activeuserdomain(
request: Request,
userId: Optional[int] = Query(None, alias="userId"),
user=Depends(get_current_active_user),
db=Depends(get_db),
):
try:
# domain = get_activedomain(db, user.id)
domain = get_activedomain(db, userId if userId is not None else user.id)
domain = get_activedomain(db, user.id)
# if domain is None:
# return JSONResponse(content=None,status_code=HTTPStatus.OK)
return ApiReturnModel(data =domain)
return ApiReturnModel(data = domain)
except Exception as e:
raise APIException('platform:activedomain',request.url._url,f"Error occurred while get user({user.id}) activedomain:",e)