diff --git a/api_schemas/base_schema.py b/api_schemas/base_schema.py index 846aa07..690a437 100644 --- a/api_schemas/base_schema.py +++ b/api_schemas/base_schema.py @@ -4,4 +4,4 @@ # Inherit from when creating Pydantic Models class BaseSchema(BaseModel): model_config = ConfigDict(from_attributes=True) - # This model_config lets pydantic validate a databse model + # This model_config lets pydantic validate a database model diff --git a/api_schemas/permission_schemas.py b/api_schemas/permission_schemas.py index a7e72b6..b1ff0f4 100644 --- a/api_schemas/permission_schemas.py +++ b/api_schemas/permission_schemas.py @@ -7,11 +7,8 @@ class PermissionRead(BaseSchema): id: int action: PERMISSION_TYPE target: PERMISSION_TARGET - # This could fail response validation if a permission is left in db but deleted in hardcoded. # alternative is to just say "str" for this schemas action and target - class Config: - from_attributes = True class PermissionCreate(BaseSchema): diff --git a/api_schemas/post_schemas.py b/api_schemas/post_schemas.py index 4021566..ad79c05 100644 --- a/api_schemas/post_schemas.py +++ b/api_schemas/post_schemas.py @@ -23,9 +23,6 @@ class PostRead(BaseSchema): elected_user_recommended_limit: int elected_user_max_limit: int - class Config: - from_attributes = True - class PostUpdate(BaseSchema): name_sv: str | None = None @@ -57,6 +54,3 @@ class PostCreate(BaseSchema): class PostDoorAccessRead(BaseSchema): id: int door: DOOR_ACCESSES - - class Config: - from_attributes = True diff --git a/db_models/user_model.py b/db_models/user_model.py index c21c836..f3d6ded 100644 --- a/db_models/user_model.py +++ b/db_models/user_model.py @@ -52,7 +52,7 @@ class User_DB(BaseModel_DB, SQLAlchemyBaseUserTable[int]): program: Mapped[PROGRAM_TYPE] = mapped_column(default="Oklart", init=False) # program at the guild - standard_food_preferences: Mapped[list[str]] = mapped_column(JSON, init=False, default=list) + standard_food_preferences: Mapped[list[str]] = mapped_column(JSON, init=False, default_factory=list) other_food_preferences: Mapped[Optional[str]] = mapped_column(init=False, default="") diff --git a/helpers/db_util.py b/helpers/db_util.py index cbefe4b..2d40e29 100644 --- a/helpers/db_util.py +++ b/helpers/db_util.py @@ -21,7 +21,7 @@ def created_at_column(): def latest_modified_column(): - return mapped_column(default=get_now_utc, onupdate=get_now_utc, init=False) + return mapped_column(insert_default=get_now_utc, onupdate=get_now_utc, init=False) def normalize_swedish(text: str) -> str: diff --git a/requirements.txt b/requirements.txt index 77413c9..6199d73 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,7 +13,7 @@ click==8.1.7 cryptography==42.0.1 dnspython==2.8.0 email-validator==2.1.0.post1 -fakeredis==2.31.0 +fakeredis==2.35.0 fastapi==0.115.0 fastapi-users-db-sqlalchemy-pelicanq==6.0.6 fastapi-users-pelicanq==13.0.4 @@ -38,7 +38,6 @@ numpy==2.2.4 oauthlib==3.3.1 packaging==23.2 pandas==2.2.3 -passlib==1.7.4 phonenumbers==9.0.25 pillow==10.2.0 pluggy==1.6.0