前端APIのURL参数化対応およびバックエンドのBugFix
This commit is contained in:
@@ -8,7 +8,7 @@ import deepdiff
|
||||
import app.core.config as config
|
||||
import os
|
||||
from app.db.session import SessionLocal
|
||||
from app.db.crud import get_flows,get_activedomain
|
||||
from app.db.crud import get_flows_by_app,get_activedomain
|
||||
from app.core.auth import get_current_active_user,get_current_user
|
||||
|
||||
kinton_router = r = APIRouter()
|
||||
@@ -258,19 +258,17 @@ def updateappjscss(app,uploads,c:config.KINTONE_ENV):
|
||||
|
||||
def createappjs(app):
|
||||
db = SessionLocal()
|
||||
flows = get_flows(db,app)
|
||||
flows = get_flows_by_app(db,app)
|
||||
db.close()
|
||||
content={}
|
||||
for flow in flows:
|
||||
content[flow.eventid] = {'flowid':flow.flowid,'name':flow.name,'content':flow.content}
|
||||
js = 'const flow=' + json.dumps(content)
|
||||
fpath = '{}\\alc_setting_{}.js'.format('Temp',app)
|
||||
file = open(fpath,'w',encoding="utf-8")
|
||||
file.write(js)
|
||||
file.close()
|
||||
js = 'const alcflow=' + json.dumps(content)
|
||||
fpath = os.path.join("Temp",f"alc_setting_{app}.js")
|
||||
with open(fpath,'w') as file:
|
||||
file.write(js)
|
||||
return fpath
|
||||
|
||||
|
||||
@r.post("/test",)
|
||||
async def test(file:UploadFile= File(...),app:str=None):
|
||||
if file.filename.endswith('.xlsx'):
|
||||
@@ -340,7 +338,14 @@ async def jscss(app:str,files:t.List[UploadFile] = File(...),env = Depends(getki
|
||||
return appjscs
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=400, detail=f"Error occurred while update file {file.filename}: {str(e)}")
|
||||
|
||||
|
||||
@r.get("/app")
|
||||
async def app(app:str,c:config.KINTONE_ENV=Depends(getkintoneenv)):
|
||||
headers={config.API_V1_AUTH_KEY:c.API_V1_AUTH_VALUE}
|
||||
url = f"{c.BASE_URL}{config.API_V1_STR}/app.json"
|
||||
params ={"id":app}
|
||||
r = httpx.get(url,headers=headers,params=params)
|
||||
return r.json()
|
||||
|
||||
@r.get("/allapps")
|
||||
async def allapps(c:config.KINTONE_ENV=Depends(getkintoneenv)):
|
||||
@@ -401,7 +406,7 @@ async def createappfromexcel(files:t.List[UploadFile] = File(...),env = Depends(
|
||||
app = updateappsettingstokintone(result["app"],{"description":desc},env)
|
||||
if app.get("revision") != None:
|
||||
result["revision"] = app["revision"]
|
||||
app = addfieldstokintone(result["app"],env,fields)
|
||||
app = addfieldstokintone(result["app"],fields,env)
|
||||
if len(processes)> 0:
|
||||
app = updateprocesstokintone(result["app"],processes,env)
|
||||
if app.get("revision") != None:
|
||||
@@ -410,8 +415,7 @@ async def createappfromexcel(files:t.List[UploadFile] = File(...),env = Depends(
|
||||
except Exception as e:
|
||||
raise HTTPException(status_code=400, detail=f"Error occurred while parsing file {file.filename}: {str(e)}")
|
||||
else:
|
||||
raise HTTPException(status_code=400, detail=f"File {file.filename} is not an Excel file")
|
||||
|
||||
raise HTTPException(status_code=400, detail=f"File {file.filename} is not an Excel file")
|
||||
return result
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user