Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api_schemas/base_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 0 additions & 3 deletions api_schemas/permission_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 0 additions & 6 deletions api_schemas/post_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -57,6 +54,3 @@ class PostCreate(BaseSchema):
class PostDoorAccessRead(BaseSchema):
id: int
door: DOOR_ACCESSES

class Config:
from_attributes = True
2 changes: 1 addition & 1 deletion db_models/user_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="")

Expand Down
2 changes: 1 addition & 1 deletion helpers/db_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading