mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
revert accidental changes to magicplan repo
This commit is contained in:
parent
dcf0b2ccb9
commit
31c2e07a02
1 changed files with 26 additions and 10 deletions
|
|
@ -32,11 +32,15 @@ class MagicPlanPostgresRepository(MagicPlanRepository):
|
||||||
self._session = session
|
self._session = session
|
||||||
|
|
||||||
def get_plan_by_uploaded_file_id(self, uploaded_file_id: int) -> Optional[Plan]:
|
def get_plan_by_uploaded_file_id(self, uploaded_file_id: int) -> Optional[Plan]:
|
||||||
plan_row = self._session.execute( # pyright: ignore[reportDeprecated]
|
plan_row = (
|
||||||
select(MagicPlanPlanModel).where(
|
self._session.execute( # pyright: ignore[reportDeprecated]
|
||||||
col(MagicPlanPlanModel.uploaded_file_id) == uploaded_file_id
|
select(MagicPlanPlanModel).where(
|
||||||
|
col(MagicPlanPlanModel.uploaded_file_id) == uploaded_file_id
|
||||||
|
)
|
||||||
)
|
)
|
||||||
).scalars().one_or_none()
|
.scalars()
|
||||||
|
.one_or_none()
|
||||||
|
)
|
||||||
if plan_row is None:
|
if plan_row is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
@ -47,7 +51,9 @@ class MagicPlanPostgresRepository(MagicPlanRepository):
|
||||||
select(MagicPlanFloorModel).where(
|
select(MagicPlanFloorModel).where(
|
||||||
col(MagicPlanFloorModel.magic_plan_plan_id) == plan_id
|
col(MagicPlanFloorModel.magic_plan_plan_id) == plan_id
|
||||||
)
|
)
|
||||||
).scalars().all()
|
)
|
||||||
|
.scalars()
|
||||||
|
.all()
|
||||||
)
|
)
|
||||||
floor_ids = [cast(int, f.id) for f in floor_rows]
|
floor_ids = [cast(int, f.id) for f in floor_rows]
|
||||||
|
|
||||||
|
|
@ -56,7 +62,9 @@ class MagicPlanPostgresRepository(MagicPlanRepository):
|
||||||
select(MagicPlanRoomModel).where(
|
select(MagicPlanRoomModel).where(
|
||||||
col(MagicPlanRoomModel.magic_plan_floor_id).in_(floor_ids)
|
col(MagicPlanRoomModel.magic_plan_floor_id).in_(floor_ids)
|
||||||
)
|
)
|
||||||
).scalars().all()
|
)
|
||||||
|
.scalars()
|
||||||
|
.all()
|
||||||
)
|
)
|
||||||
room_ids = [cast(int, r.id) for r in room_rows]
|
room_ids = [cast(int, r.id) for r in room_rows]
|
||||||
|
|
||||||
|
|
@ -65,7 +73,9 @@ class MagicPlanPostgresRepository(MagicPlanRepository):
|
||||||
select(MagicPlanWindowModel).where(
|
select(MagicPlanWindowModel).where(
|
||||||
col(MagicPlanWindowModel.magic_plan_room_id).in_(room_ids)
|
col(MagicPlanWindowModel.magic_plan_room_id).in_(room_ids)
|
||||||
)
|
)
|
||||||
).scalars().all()
|
)
|
||||||
|
.scalars()
|
||||||
|
.all()
|
||||||
)
|
)
|
||||||
window_ids = [cast(int, w.id) for w in window_rows]
|
window_ids = [cast(int, w.id) for w in window_rows]
|
||||||
|
|
||||||
|
|
@ -74,7 +84,9 @@ class MagicPlanPostgresRepository(MagicPlanRepository):
|
||||||
select(MagicPlanDoorModel).where(
|
select(MagicPlanDoorModel).where(
|
||||||
col(MagicPlanDoorModel.magic_plan_room_id).in_(room_ids)
|
col(MagicPlanDoorModel.magic_plan_room_id).in_(room_ids)
|
||||||
)
|
)
|
||||||
).scalars().all()
|
)
|
||||||
|
.scalars()
|
||||||
|
.all()
|
||||||
)
|
)
|
||||||
door_ids = [cast(int, d.id) for d in door_rows]
|
door_ids = [cast(int, d.id) for d in door_rows]
|
||||||
|
|
||||||
|
|
@ -86,7 +98,9 @@ class MagicPlanPostgresRepository(MagicPlanRepository):
|
||||||
window_ids
|
window_ids
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
).scalars().all()
|
)
|
||||||
|
.scalars()
|
||||||
|
.all()
|
||||||
}
|
}
|
||||||
door_vent_by_door_id = {
|
door_vent_by_door_id = {
|
||||||
cast(int, dv.magic_plan_door_id): dv
|
cast(int, dv.magic_plan_door_id): dv
|
||||||
|
|
@ -94,7 +108,9 @@ class MagicPlanPostgresRepository(MagicPlanRepository):
|
||||||
select(MagicPlanDoorVentilationModel).where(
|
select(MagicPlanDoorVentilationModel).where(
|
||||||
col(MagicPlanDoorVentilationModel.magic_plan_door_id).in_(door_ids)
|
col(MagicPlanDoorVentilationModel.magic_plan_door_id).in_(door_ids)
|
||||||
)
|
)
|
||||||
).scalars().all()
|
)
|
||||||
|
.scalars()
|
||||||
|
.all()
|
||||||
}
|
}
|
||||||
|
|
||||||
windows_by_room_id: dict[int, list[Window]] = {}
|
windows_by_room_id: dict[int, list[Window]] = {}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue