This commit is contained in:
xyj 2023-12-07 16:49:28 +08:00
parent 3a8a98a874
commit 4252956d51
26 changed files with 8 additions and 19 deletions

Binary file not shown.

Binary file not shown.

0
db/__init__.py → src/__init__.py Executable file → Normal file
View File

View File

@ -1,12 +1,6 @@
import os from src.db.models.base import BaseResponse
import subprocess from src.db.models.log_data_model import LOT_DATA
from src.db.repository import add_kb_to_db, get_kb_detail, delete_kb_detail_by_time
import uvicorn
from db.models.base import BaseResponse
from db.models.log_data_model import LOT_DATA, LOT_DATA_MODEL
from db.repository import add_kb_to_db, get_kb_detail, get_kb_detail_by_time, delete_kb_detail_by_time
from fastapi import FastAPI
def add(data: LOT_DATA): def add(data: LOT_DATA):

0
src/db/models/__init__.py Executable file
View File

View File

@ -1,12 +1,9 @@
from datetime import datetime from datetime import datetime
from typing import Any, List from typing import Any
import pydantic
from pydantic import BaseModel from pydantic import BaseModel
from sqlalchemy import Column, DateTime, String, Integer from sqlalchemy import Column, DateTime, String, Integer
from db.models.log_data_model import LOT_DATA_MODEL, LOT_DATA
class BaseResponse(BaseModel): class BaseResponse(BaseModel):
code: int = 200 code: int = 200

View File

@ -1,6 +1,6 @@
from pydantic import BaseModel, Field from pydantic import BaseModel, Field
from sqlalchemy import * from sqlalchemy import *
from db.base import Base from src.db.base import Base
class LOT_DATA(BaseModel): class LOT_DATA(BaseModel):

View File

@ -1,7 +1,5 @@
import time from src.db.models.log_data_model import LOT_DATA_MODEL, LOT_DATA
from src.db.session import with_session
from db.models.log_data_model import LOT_DATA_MODEL, LOT_DATA
from db.session import with_session
@with_session @with_session

View File

@ -1,6 +1,6 @@
from functools import wraps from functools import wraps
from contextlib import contextmanager from contextlib import contextmanager
from db.base import SessionLocal from src.db.base import SessionLocal
from sqlalchemy.orm import Session from sqlalchemy.orm import Session