mirror of
https://github.com/fastapi/full-stack-fastapi-template.git
synced 2026-11-03 20:36:27 +00:00
✨ Add base class to simplify CRUD (#23)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# Import all the models, so that Base has them before being
|
||||
# imported by Alembic
|
||||
from app.db.base_class import Base # noqa
|
||||
from app.db_models.user import User # noqa
|
||||
from app.db_models.item import Item # noqa
|
||||
from app.models.user import User # noqa
|
||||
from app.models.item import Item # noqa
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from app import crud
|
||||
from app.core import config
|
||||
from app.models.user import UserCreate
|
||||
from app.schemas.user import UserCreate
|
||||
|
||||
# make sure all SQL Alchemy models are imported before initializing DB
|
||||
# otherwise, SQL Alchemy might fail to initialize properly relationships
|
||||
@@ -21,4 +21,4 @@ def init_db(db_session):
|
||||
password=config.FIRST_SUPERUSER_PASSWORD,
|
||||
is_superuser=True,
|
||||
)
|
||||
user = crud.user.create(db_session, user_in=user_in)
|
||||
user = crud.user.create(db_session, obj_in=user_in)
|
||||
|
||||
Reference in New Issue
Block a user