log bugfix

This commit is contained in:
2023-11-19 13:37:55 +09:00
parent a464297511
commit f83dd693d5
4 changed files with 6 additions and 6 deletions

View File

@@ -310,7 +310,7 @@ async def download(key,c:config.KINTONE_ENV=Depends(getkintoneenv)):
return r.json() return r.json()
@r.post("/upload") @r.post("/upload")
async def upload(files:t.List[UploadFile] = File(...)): async def upload(request:Request,files:t.List[UploadFile] = File(...)):
dataframes = [] dataframes = []
for file in files: for file in files:
if file.filename.endswith('.xlsx'): if file.filename.endswith('.xlsx'):
@@ -320,9 +320,9 @@ async def upload(files:t.List[UploadFile] = File(...)):
print(df) print(df)
dataframes.append(df) dataframes.append(df)
except Exception as e: except Exception as e:
raise APIException(Request.,'' ,f"Error occurred while uploading file {file.filename}: {str(e)}") raise APIException('kintone:upload',request.url._url,f"Error occurred while uploading file {file.filename}: {str(e)}")
else: else:
raise HTTPException(status_code=400, detail=f"File {file.filename} is not an Excel file") raise APIException('kintone:upload',request.url._url, detail=f"File {file.filename} is not an Excel file")
return {"files": [file.filename for file in files]} return {"files": [file.filename for file in files]}

View File

@@ -286,7 +286,7 @@ def get_eventactions(db: Session,eventid: str):
def create_log(db: Session, error:schemas.ErrorCreate): def create_log(db: Session, error:schemas.ErrorCreate):
db_log = models.ErrorLog(location=error.location,title=error.title,content=error.content) db_log = models.ErrorLog(title=error.title,location=error.location,content=error.content)
db.add(db_log) db.add(db_log)
db.commit() db.commit()
db.refresh(db_log) db.refresh(db_log)

View File

@@ -96,6 +96,6 @@ class EventAction(Base):
class ErrorLog(Base): class ErrorLog(Base):
__tablename__ = "errorlog" __tablename__ = "errorlog"
id = Column(Integer, primary_key=True, index=True) id = Column(Integer, primary_key=True, index=True)
location = Column(String(200))
title = Column(String(50)) title = Column(String(50))
location = Column(String(500))
content = Column(String(5000)) content = Column(String(5000))

View File

@@ -142,6 +142,6 @@ class Event(Base):
orm_mode = True orm_mode = True
class ErrorCreate(BaseModel): class ErrorCreate(BaseModel):
location:str
title:str title:str
location:str
content:str content:str