Skip to content

Commit

Permalink
进销存
Browse files Browse the repository at this point in the history
  • Loading branch information
WSL0809 committed Mar 28, 2024
1 parent b51c2f4 commit 1f1f0f0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions api/IMS/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .product import router as product_router
8 changes: 4 additions & 4 deletions api/IMS/add_product.py → api/IMS/product.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from datetime import datetime
from typing import Union
from typing import Union, List

from fastapi import APIRouter, Depends
from pydantic import BaseModel
Expand Down Expand Up @@ -51,7 +51,7 @@ def update_product_quantity(db, product_id, quantity):
return db_product


def get_all_products(db):
def do_get_all_products(db):
return db.query(model.Product).all()


Expand All @@ -64,6 +64,6 @@ async def create_product(product: ProductCreate, db: Session = Depends(get_db)):
return db_product


@router.get("/IMS/get_all_products")
@router.get("/IMS/get_all_products", response_model=List[ProductResponse])
async def get_all_products(db: Session = Depends(get_db)):
return get_all_products(db)
return do_get_all_products(db)
3 changes: 2 additions & 1 deletion api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
from .get_baby_nurse import router as get_baby_nurse_router
from .insert_baby_nurse import router as insert_baby_nurse_router
from .reminder import router as reminder_router
from .get_client_by_room_number import router as get_client_by_room_number_router
from .get_client_by_room_number import router as get_client_by_room_number_router
from .IMS.product import router as product_router
3 changes: 2 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from api import (change_room_router, reserve_router, get_all_rooms_router, check_in_router,
check_out_router, get_room_by_room_name_router, get_all_clients_router,
fault_registration_router, get_baby_nurse_router, insert_baby_nurse_router,
reminder_router, get_client_by_room_number_router)
reminder_router, get_client_by_room_number_router, product_router)
from fastapi.middleware.cors import CORSMiddleware

model.Base.metadata.create_all(bind=engine)
Expand All @@ -35,6 +35,7 @@
app.include_router(insert_baby_nurse_router)
app.include_router(reminder_router)
app.include_router(get_client_by_room_number_router)
app.include_router(product_router)

origins = [
"*"
Expand Down
2 changes: 0 additions & 2 deletions model/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@ class User(Base):
hashed_password = Column(String)
is_active = Column(Boolean, default=True)
double_check_password = Column(String(255), default="88888888")

log = relationship("Log", backref="users")

0 comments on commit 1f1f0f0

Please sign in to comment.