diff --git a/backend/app/app/api/api_v1/endpoints/farms/areas.py b/backend/app/app/api/api_v1/endpoints/farms/areas.py index 31f22b9..91f33e9 100644 --- a/backend/app/app/api/api_v1/endpoints/farms/areas.py +++ b/backend/app/app/api/api_v1/endpoints/farms/areas.py @@ -7,7 +7,7 @@ from app.api.utils.db import get_db from app.api.utils.farms import get_active_farms_url_or_list, get_farm_client, ClientError -from app.models.farm import Farm +from app.schemas.farm import Farm router = APIRouter() diff --git a/backend/app/app/api/api_v1/endpoints/farms/assets.py b/backend/app/app/api/api_v1/endpoints/farms/assets.py index f9465b8..e065e86 100644 --- a/backend/app/app/api/api_v1/endpoints/farms/assets.py +++ b/backend/app/app/api/api_v1/endpoints/farms/assets.py @@ -7,7 +7,7 @@ from app.api.utils.db import get_db from app.api.utils.farms import get_active_farms_url_or_list, get_farm_client, ClientError -from app.models.farm import Farm +from app.schemas.farm import Farm router = APIRouter() diff --git a/backend/app/app/api/api_v1/endpoints/farms/farms.py b/backend/app/app/api/api_v1/endpoints/farms/farms.py index 23772fd..b5f07b4 100644 --- a/backend/app/app/api/api_v1/endpoints/farms/farms.py +++ b/backend/app/app/api/api_v1/endpoints/farms/farms.py @@ -8,7 +8,7 @@ from app.api.utils.db import get_db from app.api.utils.farms import get_farm_client, ClientError, get_farms_url_or_list, get_farm_by_id from app.api.utils.security import get_farm_access -from app.models.farm import Farm, FarmCreate, FarmUpdate +from app.schemas.farm import Farm, FarmCreate, FarmUpdate from app.core.celery_app import celery_app router = APIRouter() diff --git a/backend/app/app/api/api_v1/endpoints/farms/farms_public.py b/backend/app/app/api/api_v1/endpoints/farms/farms_public.py index 202404c..f07bece 100644 --- a/backend/app/app/api/api_v1/endpoints/farms/farms_public.py +++ b/backend/app/app/api/api_v1/endpoints/farms/farms_public.py @@ -14,8 +14,8 @@ from app import crud from app.api.utils.db import get_db from app.api.utils.farms import get_oauth_token -from app.models.farm import Farm, FarmCreate -from app.models.farm_token import FarmAuthorizationParams +from app.schemas.farm import Farm, FarmCreate +from app.schemas.farm_token import FarmAuthorizationParams logger = logging.getLogger(__name__) diff --git a/backend/app/app/api/api_v1/endpoints/farms/info.py b/backend/app/app/api/api_v1/endpoints/farms/info.py index 98db83b..13be11c 100644 --- a/backend/app/app/api/api_v1/endpoints/farms/info.py +++ b/backend/app/app/api/api_v1/endpoints/farms/info.py @@ -8,8 +8,8 @@ from app.api.utils.db import get_db from app.api.utils.farms import get_farm_client, ClientError, get_farms_url_or_list from app.api.utils.security import get_farm_access -from app.models.farm import Farm -from app.models.farm_info import FarmInfo +from app.schemas.farm import Farm +from app.schemas.farm_info import FarmInfo router = APIRouter() diff --git a/backend/app/app/api/api_v1/endpoints/farms/logs.py b/backend/app/app/api/api_v1/endpoints/farms/logs.py index e2da74c..850b4a8 100644 --- a/backend/app/app/api/api_v1/endpoints/farms/logs.py +++ b/backend/app/app/api/api_v1/endpoints/farms/logs.py @@ -7,7 +7,7 @@ from app.api.utils.db import get_db from app.api.utils.farms import get_active_farms_url_or_list, get_farm_client, ClientError -from app.models.farm import Farm +from app.schemas.farm import Farm router = APIRouter() diff --git a/backend/app/app/api/api_v1/endpoints/farms/terms.py b/backend/app/app/api/api_v1/endpoints/farms/terms.py index 6767d39..c9b5578 100644 --- a/backend/app/app/api/api_v1/endpoints/farms/terms.py +++ b/backend/app/app/api/api_v1/endpoints/farms/terms.py @@ -7,7 +7,7 @@ from app.api.utils.db import get_db from app.api.utils.farms import get_active_farms_url_or_list, get_farm_client, ClientError -from app.models.farm import Farm +from app.schemas.farm import Farm router = APIRouter() diff --git a/backend/app/app/api/api_v1/endpoints/login.py b/backend/app/app/api/api_v1/endpoints/login.py index d0d422f..148ce12 100644 --- a/backend/app/app/api/api_v1/endpoints/login.py +++ b/backend/app/app/api/api_v1/endpoints/login.py @@ -11,10 +11,10 @@ from app.core import config from app.core.jwt import create_access_token from app.core.security import get_password_hash -from app.db_models.user import User as DBUser -from app.models.msg import Msg -from app.models.token import Token -from app.models.user import User +from app.models.user import User as DBUser +from app.schemas.msg import Msg +from app.schemas.token import Token +from app.schemas.user import User from app.utils import ( generate_password_reset_token, send_reset_password_email, diff --git a/backend/app/app/api/api_v1/endpoints/users.py b/backend/app/app/api/api_v1/endpoints/users.py index 2b29f18..33f91d4 100644 --- a/backend/app/app/api/api_v1/endpoints/users.py +++ b/backend/app/app/api/api_v1/endpoints/users.py @@ -9,8 +9,8 @@ from app.api.utils.db import get_db from app.api.utils.security import get_current_active_superuser, get_current_active_user from app.core import config -from app.db_models.user import User as DBUser -from app.models.user import User, UserCreate, UserInDB, UserUpdate +from app.models.user import User as DBUser +from app.schemas.user import User, UserCreate, UserInDB, UserUpdate from app.utils import send_new_account_email router = APIRouter() diff --git a/backend/app/app/api/api_v1/endpoints/utils.py b/backend/app/app/api/api_v1/endpoints/utils.py index e6a8b67..3d68ea2 100644 --- a/backend/app/app/api/api_v1/endpoints/utils.py +++ b/backend/app/app/api/api_v1/endpoints/utils.py @@ -6,10 +6,10 @@ from app.api.utils.db import get_db from app.api.utils.security import get_current_active_superuser from app.core.celery_app import celery_app -from app.models.msg import Msg -from app.models.user import UserInDB -from app.models.farm import Farm -from app.models.farm_token import FarmTokenCreate, FarmAuthorizationParams +from app.schemas.msg import Msg +from app.schemas.user import UserInDB +from app.schemas.farm import Farm +from app.schemas.farm_token import FarmTokenCreate, FarmAuthorizationParams from app.api.utils.farms import get_farm_by_id, get_oauth_token from app.api.utils.security import get_farm_access from app.utils import send_test_email, generate_farm_authorization_link, generate_farm_registration_link diff --git a/backend/app/app/api/utils/farms.py b/backend/app/app/api/utils/farms.py index 826c0df..8c71c49 100644 --- a/backend/app/app/api/utils/farms.py +++ b/backend/app/app/api/utils/farms.py @@ -12,10 +12,10 @@ from app import crud from app.api.utils.db import get_db -from app.models.farm_token import FarmTokenBase, FarmTokenCreate +from app.schemas.farm_token import FarmTokenBase, FarmTokenCreate from app.crud.farm_token import create_farm_token, update_farm_token -from app.models.farm import Farm, FarmUpdate -from app.models.token import FarmAccess +from app.schemas.farm import Farm, FarmUpdate +from app.schemas.token import FarmAccess from app.api.utils.security import get_farm_access diff --git a/backend/app/app/api/utils/security.py b/backend/app/app/api/utils/security.py index e9a98cc..f2141fa 100644 --- a/backend/app/app/api/utils/security.py +++ b/backend/app/app/api/utils/security.py @@ -11,8 +11,8 @@ from app.api.utils.db import get_db from app.core import config from app.core.jwt import ALGORITHM -from app.db_models.user import User -from app.models.token import TokenData, FarmAccess +from app.models.user import User +from app.schemas.token import TokenData, FarmAccess logger = logging.getLogger(__name__) diff --git a/backend/app/app/crud/farm.py b/backend/app/app/crud/farm.py index ddbd8d7..5d27cbc 100644 --- a/backend/app/app/crud/farm.py +++ b/backend/app/app/crud/farm.py @@ -6,10 +6,10 @@ from sqlalchemy.orm import Session from app.core import config -from app.db_models.farm import Farm -from app.models.farm import FarmCreate, FarmUpdate -from app.db_models.farm_token import FarmToken -from app.models.farm_info import FarmInfo +from app.models.farm import Farm +from app.schemas.farm import FarmCreate, FarmUpdate +from app.models.farm_token import FarmToken +from app.schemas.farm_info import FarmInfo logger = logging.getLogger(__name__) diff --git a/backend/app/app/crud/farm_token.py b/backend/app/app/crud/farm_token.py index d099626..f518942 100644 --- a/backend/app/app/crud/farm_token.py +++ b/backend/app/app/crud/farm_token.py @@ -3,8 +3,8 @@ from fastapi.encoders import jsonable_encoder from sqlalchemy.orm import Session -from app.db_models.farm_token import FarmToken -from app.models.farm_token import FarmTokenCreate, FarmTokenUpdate +from app.models.farm_token import FarmToken +from app.schemas.farm_token import FarmTokenCreate, FarmTokenUpdate def get_farm_token(db: Session, farm_id: int): return db.query(FarmToken).filter(FarmToken.farm_id == farm_id).first() diff --git a/backend/app/app/crud/user.py b/backend/app/app/crud/user.py index 66f8075..472c3bd 100644 --- a/backend/app/app/crud/user.py +++ b/backend/app/app/crud/user.py @@ -4,8 +4,8 @@ from sqlalchemy.orm import Session from app.core.security import get_password_hash, verify_password -from app.db_models.user import User -from app.models.user import UserCreate, UserUpdate +from app.models.user import User +from app.schemas.user import UserCreate, UserUpdate def get(db_session: Session, *, user_id: int) -> Optional[User]: diff --git a/backend/app/app/db/base.py b/backend/app/app/db/base.py index b1aadf7..e9857cd 100644 --- a/backend/app/app/db/base.py +++ b/backend/app/app/db/base.py @@ -1,6 +1,6 @@ -# Import all the models, so that Base has them before being +# Import all the schemas, 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.farm import Farm -from app.db_models.farm_token import FarmToken +from app.models.user import User # noqa +from app.models.farm import Farm +from app.models.farm_token import FarmToken diff --git a/backend/app/app/db/init_db.py b/backend/app/app/db/init_db.py index 189059f..1521297 100644 --- a/backend/app/app/db/init_db.py +++ b/backend/app/app/db/init_db.py @@ -1,8 +1,8 @@ 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 +# make sure all SQL Alchemy schemas are imported before initializing DB # otherwise, SQL Alchemy might fail to initialize properly relationships # for more details: https://github.com/tiangolo/full-stack-fastapi-postgresql/issues/28 from app.db import base diff --git a/backend/app/app/db_models/farm.py b/backend/app/app/db_models/farm.py deleted file mode 100644 index 211cb20..0000000 --- a/backend/app/app/db_models/farm.py +++ /dev/null @@ -1,33 +0,0 @@ -from sqlalchemy import Boolean, Column, Integer, String, DateTime -from sqlalchemy.sql import func -from sqlalchemy.orm import relationship -from sqlalchemy.dialects.postgresql import JSONB - -from app.db.base_class import Base -from app.db_models.farm_token import FarmToken - - -class Farm(Base): - __tablename__ = 'farm' - - id = Column(Integer, primary_key=True, index=True) - time_created = Column(DateTime(timezone=True), server_default=func.now()) - time_updated = Column(DateTime(timezone=True), onupdate=func.now()) - last_accessed = Column(DateTime(timezone=True)) - farm_name = Column(String, index=True) - url = Column(String, index=True, unique=True) - username = Column(String, index=True) - password = Column(String, index=True) - notes = Column(String, nullable=True) - tags = Column(String, nullable=True) - - # active attribute allows admins to disable farmOS profiles - active = Column(Boolean, default=False) - - # Store farm info in a JSONB column - info = Column(JSONB, nullable=True) - - is_authorized = Column(Boolean, default=False) - token = relationship("FarmToken", uselist=False, back_populates="farm") - auth_error = Column(String, nullable=True) - diff --git a/backend/app/app/db_models/farm_token.py b/backend/app/app/db_models/farm_token.py deleted file mode 100644 index 71eff38..0000000 --- a/backend/app/app/db_models/farm_token.py +++ /dev/null @@ -1,17 +0,0 @@ -from sqlalchemy import Boolean, Column, ForeignKey, Integer, String -from sqlalchemy.orm import relationship - -from app.db.base_class import Base - - -class FarmToken(Base): - __tablename__ = 'farmtoken' - - id = Column(Integer, primary_key=True) - access_token = Column(String) - expires_in = Column(String) - refresh_token = Column(String) - expires_at = Column(String) - - farm_id = Column(Integer, ForeignKey("farm.id"), unique=True) - farm = relationship("Farm", uselist=False, back_populates="token") diff --git a/backend/app/app/db_models/user.py b/backend/app/app/db_models/user.py deleted file mode 100755 index a196dc1..0000000 --- a/backend/app/app/db_models/user.py +++ /dev/null @@ -1,13 +0,0 @@ -from sqlalchemy import Boolean, Column, Integer, String -from sqlalchemy.orm import relationship - -from app.db.base_class import Base - - -class User(Base): - id = Column(Integer, primary_key=True, index=True) - full_name = Column(String, index=True) - email = Column(String, unique=True, index=True) - hashed_password = Column(String) - is_active = Column(Boolean(), default=True) - is_superuser = Column(Boolean(), default=False) diff --git a/backend/app/app/models/__init__.py b/backend/app/app/models/__init__.py old mode 100644 new mode 100755 diff --git a/backend/app/app/models/farm.py b/backend/app/app/models/farm.py index bcdd5ff..f2d9a9f 100644 --- a/backend/app/app/models/farm.py +++ b/backend/app/app/models/farm.py @@ -1,44 +1,33 @@ -from typing import Optional -from datetime import datetime - -from app.models.api_model import APIModel -from app.models.farm_token import FarmTokenBase, FarmToken -from app.models.farm_info import FarmInfo - -# Shared properties -class FarmBase(APIModel): - farm_name: Optional[str] = None - url: Optional[str] = None - username: Optional[str] = None - notes: Optional[str] = None - tags: Optional[str] = None - info: Optional[FarmInfo] = None - active: Optional[bool] = None - -class FarmBaseInDB(FarmBase): - id: int = None - -# Properties to receive via API on creation -class FarmCreate(FarmBase): - farm_name: str - url: str - username: Optional[str] - password: Optional[str] - token: Optional[FarmTokenBase] - -# Properties to receive via API on update -class FarmUpdate(FarmBase): - password: Optional[str] = None - -# Additional properties to return via API -class Farm(FarmBaseInDB): - time_created: Optional[datetime] = None - time_updated: Optional[datetime] = None - last_accessed: Optional[datetime] = None - token: Optional[FarmToken] = None - is_authorized: Optional[bool] = None - auth_error: Optional[str] = None - -# Additional properites stored in DB -class FarmInDB(FarmBaseInDB): - pass +from sqlalchemy import Boolean, Column, Integer, String, DateTime +from sqlalchemy.sql import func +from sqlalchemy.orm import relationship +from sqlalchemy.dialects.postgresql import JSONB + +from app.db.base_class import Base +from app.models.farm_token import FarmToken + + +class Farm(Base): + __tablename__ = 'farm' + + id = Column(Integer, primary_key=True, index=True) + time_created = Column(DateTime(timezone=True), server_default=func.now()) + time_updated = Column(DateTime(timezone=True), onupdate=func.now()) + last_accessed = Column(DateTime(timezone=True)) + farm_name = Column(String, index=True) + url = Column(String, index=True, unique=True) + username = Column(String, index=True) + password = Column(String, index=True) + notes = Column(String, nullable=True) + tags = Column(String, nullable=True) + + # active attribute allows admins to disable farmOS profiles + active = Column(Boolean, default=False) + + # Store farm info in a JSONB column + info = Column(JSONB, nullable=True) + + is_authorized = Column(Boolean, default=False) + token = relationship("FarmToken", uselist=False, back_populates="farm") + auth_error = Column(String, nullable=True) + diff --git a/backend/app/app/models/farm_token.py b/backend/app/app/models/farm_token.py index 4e26016..71eff38 100644 --- a/backend/app/app/models/farm_token.py +++ b/backend/app/app/models/farm_token.py @@ -1,31 +1,17 @@ -from typing import Optional +from sqlalchemy import Boolean, Column, ForeignKey, Integer, String +from sqlalchemy.orm import relationship -from app.models.api_model import APIModel +from app.db.base_class import Base -# Farm Token Models -class FarmTokenBase(APIModel): - access_token: Optional[str] = None - expires_in: Optional[str] = None - refresh_token: Optional[str] = None - expires_at: Optional[str] = None +class FarmToken(Base): + __tablename__ = 'farmtoken' -class FarmTokenCreate(FarmTokenBase): - farm_id: int - pass + id = Column(Integer, primary_key=True) + access_token = Column(String) + expires_in = Column(String) + refresh_token = Column(String) + expires_at = Column(String) - -class FarmToken(FarmTokenBase): - id: int - - -class FarmTokenUpdate(FarmToken): - pass - -class FarmAuthorizationParams(APIModel): - grant_type: str - code: str - state: str - client_id: str - client_secret: Optional[str] - redirect_uri: Optional[str] \ No newline at end of file + farm_id = Column(Integer, ForeignKey("farm.id"), unique=True) + farm = relationship("Farm", uselist=False, back_populates="token") diff --git a/backend/app/app/models/msg.py b/backend/app/app/models/msg.py deleted file mode 100644 index ad6f649..0000000 --- a/backend/app/app/models/msg.py +++ /dev/null @@ -1,5 +0,0 @@ -from app.models.api_model import APIModel - - -class Msg(APIModel): - msg: str diff --git a/backend/app/app/models/user.py b/backend/app/app/models/user.py old mode 100644 new mode 100755 index 8ec61d8..a196dc1 --- a/backend/app/app/models/user.py +++ b/backend/app/app/models/user.py @@ -1,35 +1,13 @@ -from typing import Optional +from sqlalchemy import Boolean, Column, Integer, String +from sqlalchemy.orm import relationship -from app.models.api_model import APIModel +from app.db.base_class import Base -# Shared properties -class UserBase(APIModel): - email: Optional[str] = None - is_active: Optional[bool] = True - is_superuser: Optional[bool] = False - full_name: Optional[str] = None - -class UserBaseInDB(UserBase): - id: int = None - - -# Properties to receive via API on creation -class UserCreate(UserBaseInDB): - email: str - password: str - - -# Properties to receive via API on update -class UserUpdate(UserBaseInDB): - password: Optional[str] = None - - -# Additional properties to return via API -class User(UserBaseInDB): - pass - - -# Additional properties stored in DB -class UserInDB(UserBaseInDB): - hashed_password: str +class User(Base): + id = Column(Integer, primary_key=True, index=True) + full_name = Column(String, index=True) + email = Column(String, unique=True, index=True) + hashed_password = Column(String) + is_active = Column(Boolean(), default=True) + is_superuser = Column(Boolean(), default=False) diff --git a/backend/app/app/db_models/__init__.py b/backend/app/app/schemas/__init__.py old mode 100755 new mode 100644 similarity index 100% rename from backend/app/app/db_models/__init__.py rename to backend/app/app/schemas/__init__.py diff --git a/backend/app/app/models/api_model.py b/backend/app/app/schemas/api_model.py similarity index 100% rename from backend/app/app/models/api_model.py rename to backend/app/app/schemas/api_model.py diff --git a/backend/app/app/schemas/farm.py b/backend/app/app/schemas/farm.py new file mode 100644 index 0000000..8a50f91 --- /dev/null +++ b/backend/app/app/schemas/farm.py @@ -0,0 +1,44 @@ +from typing import Optional +from datetime import datetime + +from app.schemas.api_model import APIModel +from app.schemas.farm_token import FarmTokenBase, FarmToken +from app.schemas.farm_info import FarmInfo + +# Shared properties +class FarmBase(APIModel): + farm_name: Optional[str] = None + url: Optional[str] = None + username: Optional[str] = None + notes: Optional[str] = None + tags: Optional[str] = None + info: Optional[FarmInfo] = None + active: Optional[bool] = None + +class FarmBaseInDB(FarmBase): + id: int = None + +# Properties to receive via API on creation +class FarmCreate(FarmBase): + farm_name: str + url: str + username: Optional[str] + password: Optional[str] + token: Optional[FarmTokenBase] + +# Properties to receive via API on update +class FarmUpdate(FarmBase): + password: Optional[str] = None + +# Additional properties to return via API +class Farm(FarmBaseInDB): + time_created: Optional[datetime] = None + time_updated: Optional[datetime] = None + last_accessed: Optional[datetime] = None + token: Optional[FarmToken] = None + is_authorized: Optional[bool] = None + auth_error: Optional[str] = None + +# Additional properites stored in DB +class FarmInDB(FarmBaseInDB): + pass diff --git a/backend/app/app/models/farm_info.py b/backend/app/app/schemas/farm_info.py similarity index 100% rename from backend/app/app/models/farm_info.py rename to backend/app/app/schemas/farm_info.py diff --git a/backend/app/app/schemas/farm_token.py b/backend/app/app/schemas/farm_token.py new file mode 100644 index 0000000..f3e5a6c --- /dev/null +++ b/backend/app/app/schemas/farm_token.py @@ -0,0 +1,31 @@ +from typing import Optional + +from app.schemas.api_model import APIModel + +# Farm Token Models +class FarmTokenBase(APIModel): + access_token: Optional[str] = None + expires_in: Optional[str] = None + refresh_token: Optional[str] = None + expires_at: Optional[str] = None + + +class FarmTokenCreate(FarmTokenBase): + farm_id: int + pass + + +class FarmToken(FarmTokenBase): + id: int + + +class FarmTokenUpdate(FarmToken): + pass + +class FarmAuthorizationParams(APIModel): + grant_type: str + code: str + state: str + client_id: str + client_secret: Optional[str] + redirect_uri: Optional[str] \ No newline at end of file diff --git a/backend/app/app/schemas/msg.py b/backend/app/app/schemas/msg.py new file mode 100644 index 0000000..0cf064e --- /dev/null +++ b/backend/app/app/schemas/msg.py @@ -0,0 +1,5 @@ +from app.schemas.api_model import APIModel + + +class Msg(APIModel): + msg: str diff --git a/backend/app/app/models/token.py b/backend/app/app/schemas/token.py similarity index 92% rename from backend/app/app/models/token.py rename to backend/app/app/schemas/token.py index 61dd25d..93a4ef0 100644 --- a/backend/app/app/models/token.py +++ b/backend/app/app/schemas/token.py @@ -1,6 +1,6 @@ from typing import List -from app.models.api_model import APIModel +from app.schemas.api_model import APIModel class Token(APIModel): diff --git a/backend/app/app/schemas/user.py b/backend/app/app/schemas/user.py new file mode 100644 index 0000000..c48bcaf --- /dev/null +++ b/backend/app/app/schemas/user.py @@ -0,0 +1,35 @@ +from typing import Optional + +from app.schemas.api_model import APIModel + + +# Shared properties +class UserBase(APIModel): + email: Optional[str] = None + is_active: Optional[bool] = True + is_superuser: Optional[bool] = False + full_name: Optional[str] = None + +class UserBaseInDB(UserBase): + id: int = None + + +# Properties to receive via API on creation +class UserCreate(UserBaseInDB): + email: str + password: str + + +# Properties to receive via API on update +class UserUpdate(UserBaseInDB): + password: Optional[str] = None + + +# Additional properties to return via API +class User(UserBaseInDB): + pass + + +# Additional properties stored in DB +class UserInDB(UserBaseInDB): + hashed_password: str diff --git a/backend/app/app/tests/api/api_v1/test_farm.py b/backend/app/app/tests/api/api_v1/test_farm.py index ced8ad3..b60964e 100644 --- a/backend/app/app/tests/api/api_v1/test_farm.py +++ b/backend/app/app/tests/api/api_v1/test_farm.py @@ -4,7 +4,7 @@ from app import crud from app.core import config from app.db.session import db_session -from app.models.farm import FarmCreate +from app.schemas.farm import FarmCreate from app.tests.utils.utils import get_server_api, random_lower_string, get_scope_token_headers diff --git a/backend/app/app/tests/api/api_v1/test_farm_authorize.py b/backend/app/app/tests/api/api_v1/test_farm_authorize.py index 6a2bfd2..a1177db 100644 --- a/backend/app/app/tests/api/api_v1/test_farm_authorize.py +++ b/backend/app/app/tests/api/api_v1/test_farm_authorize.py @@ -4,7 +4,7 @@ import pytest from app.core import config -from app.models.farm_token import FarmAuthorizationParams +from app.schemas.farm_token import FarmAuthorizationParams from app.tests.utils.utils import farmOS_testing_server, get_server_api, random_lower_string, get_scope_token_headers from app.api.utils.security import _validate_token diff --git a/backend/app/app/tests/api/api_v1/test_users.py b/backend/app/app/tests/api/api_v1/test_users.py index 119ed21..04f3c34 100644 --- a/backend/app/app/tests/api/api_v1/test_users.py +++ b/backend/app/app/tests/api/api_v1/test_users.py @@ -3,7 +3,7 @@ from app import crud from app.core import config from app.db.session import db_session -from app.models.user import UserCreate +from app.schemas.user import UserCreate from app.tests.utils.user import user_authentication_headers from app.tests.utils.utils import get_server_api, random_lower_string diff --git a/backend/app/app/tests/crud/test_farm.py b/backend/app/app/tests/crud/test_farm.py index 149fc0a..bf54ce9 100644 --- a/backend/app/app/tests/crud/test_farm.py +++ b/backend/app/app/tests/crud/test_farm.py @@ -1,7 +1,7 @@ from app.core import config from app import crud from app.db.session import db_session -from app.models.farm import FarmCreate +from app.schemas.farm import FarmCreate from app.tests.utils.utils import random_lower_string diff --git a/backend/app/app/tests/crud/test_farm_token.py b/backend/app/app/tests/crud/test_farm_token.py index c1de18f..60e25c0 100644 --- a/backend/app/app/tests/crud/test_farm_token.py +++ b/backend/app/app/tests/crud/test_farm_token.py @@ -1,6 +1,6 @@ from app.crud import farm_token from app.db.session import db_session -from app.models.farm_token import FarmTokenCreate, FarmTokenUpdate +from app.schemas.farm_token import FarmTokenCreate, FarmTokenUpdate from app.tests.utils.utils import random_lower_string def test_create_farm_token(test_farm): diff --git a/backend/app/app/tests/crud/test_user.py b/backend/app/app/tests/crud/test_user.py index e239cba..da93784 100644 --- a/backend/app/app/tests/crud/test_user.py +++ b/backend/app/app/tests/crud/test_user.py @@ -2,7 +2,7 @@ from app import crud from app.db.session import db_session -from app.models.user import UserCreate +from app.schemas.user import UserCreate from app.tests.utils.utils import random_lower_string diff --git a/backend/app/app/tests/utils/farm.py b/backend/app/app/tests/utils/farm.py index c6632e8..7d217c5 100644 --- a/backend/app/app/tests/utils/farm.py +++ b/backend/app/app/tests/utils/farm.py @@ -3,7 +3,7 @@ from app.core import config from app import crud from app.db.session import db_session -from app.models.farm import FarmCreate +from app.schemas.farm import FarmCreate def get_test_farm_instance(): diff --git a/backend/app/app/tests/utils/user.py b/backend/app/app/tests/utils/user.py index 6a5b947..f6c8f0e 100644 --- a/backend/app/app/tests/utils/user.py +++ b/backend/app/app/tests/utils/user.py @@ -3,7 +3,7 @@ from app import crud from app.core import config from app.db.session import db_session -from app.models.user import UserCreate +from app.schemas.user import UserCreate from app.tests.utils.utils import random_lower_string