bugfix get/apps

This commit is contained in:
2024-12-04 21:44:49 +09:00
parent adb0df3b17
commit b98c20d7ff

View File

@@ -32,7 +32,7 @@ async def test(
@r.get(
"/apps",tags=["App"],
response_model=ApiReturnPage[AppList],
response_model=ApiReturnModel[List[AppList]|None],
response_model_exclude_none=True,
)
async def apps_list(
@@ -41,11 +41,11 @@ async def apps_list(
db=Depends(get_db),
):
try:
filtered_apps = []
domain = dbdomain.get_default_domain(db,user.id) #get_activedomain(db, user.id)
if not domain:
return ApiReturnPage(data = filtered_apps)
return ApiReturnModel(data = None)
filtered_apps = []
platformapps = get_apps(db,domain.url)
kintoneevn = config.KINTONE_ENV(domain)
headers={config.API_V1_AUTH_KEY:kintoneevn.API_V1_AUTH_VALUE}
@@ -68,7 +68,7 @@ async def apps_list(
if papp.appid in kintone_apps_dict:
papp.appname = kintone_apps_dict[papp.appid]["name"]
filtered_apps.append(papp)
return ApiReturnPage(data = filtered_apps)
return ApiReturnModel(data = filtered_apps)
except Exception as e:
raise APIException('platform:apps',request.url._url,f"Error occurred while get apps:",e)