From f83dd693d50a83fd25cf2340318cf25f06363c29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=20=E6=9F=8F?= Date: Sun, 19 Nov 2023 13:37:55 +0900 Subject: [PATCH] log bugfix --- backend/app/api/api_v1/routers/kintone.py | 6 +++--- backend/app/db/crud.py | 2 +- backend/app/db/models.py | 2 +- backend/app/db/schemas.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/app/api/api_v1/routers/kintone.py b/backend/app/api/api_v1/routers/kintone.py index b5f3050..3de77be 100644 --- a/backend/app/api/api_v1/routers/kintone.py +++ b/backend/app/api/api_v1/routers/kintone.py @@ -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]} diff --git a/backend/app/db/crud.py b/backend/app/db/crud.py index 1ec15e3..b3bf113 100644 --- a/backend/app/db/crud.py +++ b/backend/app/db/crud.py @@ -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) diff --git a/backend/app/db/models.py b/backend/app/db/models.py index c2c5a0c..153d5f2 100644 --- a/backend/app/db/models.py +++ b/backend/app/db/models.py @@ -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)) \ No newline at end of file diff --git a/backend/app/db/schemas.py b/backend/app/db/schemas.py index 1effb2a..0ad1064 100644 --- a/backend/app/db/schemas.py +++ b/backend/app/db/schemas.py @@ -142,6 +142,6 @@ class Event(Base): orm_mode = True class ErrorCreate(BaseModel): - location:str title:str + location:str content:str \ No newline at end of file