log bugfix
This commit is contained in:
@@ -310,7 +310,7 @@ async def download(key,c:config.KINTONE_ENV=Depends(getkintoneenv)):
|
||||
return r.json()
|
||||
|
||||
@r.post("/upload")
|
||||
async def upload(files:t.List[UploadFile] = File(...)):
|
||||
async def upload(request:Request,files:t.List[UploadFile] = File(...)):
|
||||
dataframes = []
|
||||
for file in files:
|
||||
if file.filename.endswith('.xlsx'):
|
||||
@@ -320,9 +320,9 @@ async def upload(files:t.List[UploadFile] = File(...)):
|
||||
print(df)
|
||||
dataframes.append(df)
|
||||
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:
|
||||
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]}
|
||||
|
||||
|
||||
@@ -286,7 +286,7 @@ def get_eventactions(db: Session,eventid: str):
|
||||
|
||||
|
||||
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.commit()
|
||||
db.refresh(db_log)
|
||||
|
||||
@@ -96,6 +96,6 @@ class EventAction(Base):
|
||||
class ErrorLog(Base):
|
||||
__tablename__ = "errorlog"
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
location = Column(String(200))
|
||||
title = Column(String(50))
|
||||
location = Column(String(500))
|
||||
content = Column(String(5000))
|
||||
@@ -142,6 +142,6 @@ class Event(Base):
|
||||
orm_mode = True
|
||||
|
||||
class ErrorCreate(BaseModel):
|
||||
location:str
|
||||
title:str
|
||||
location:str
|
||||
content:str
|
||||
Reference in New Issue
Block a user