updated services web user selection

This commit is contained in:
2025-06-16 15:52:50 +03:00
parent 8573c8021b
commit b73417a625
14 changed files with 117 additions and 62 deletions

View File

@@ -211,19 +211,11 @@ class Service2Application(CrudCollection):
__tablename__ = "services2applications"
__exclude__fields__ = []
application_id: Mapped[int] = mapped_column(
ForeignKey("applications.id"), nullable=False
)
application_uu_id: Mapped[str] = mapped_column(
String, nullable=False, comment="Application UUID"
)
application_id: Mapped[int] = mapped_column(ForeignKey("applications.id"), nullable=False)
application_uu_id: Mapped[str] = mapped_column(String, nullable=False, comment="Application UUID")
service_id: Mapped[int] = mapped_column(ForeignKey("services.id"), nullable=False)
service_uu_id: Mapped[str] = mapped_column(
String, nullable=False, comment="Service UUID"
)
application_code: Mapped[str] = mapped_column(
String, nullable=False, comment="Application Code"
)
service_uu_id: Mapped[str] = mapped_column(String, nullable=False, comment="Service UUID")
application_code: Mapped[str] = mapped_column(String, nullable=False, comment="Application Code")
site_url: Mapped[str] = mapped_column(String, nullable=False, comment="Site URL")
__table_args__ = {"comment": "Service2Applications Information"}
@@ -237,13 +229,9 @@ class Event2OccupantExtra(CrudCollection):
build_living_space_id: Mapped[int] = mapped_column(
ForeignKey("build_living_space.id"), nullable=False
)
build_living_space_uu_id: Mapped[str] = mapped_column(
String, nullable=False, comment="Build Living Space UUID"
)
build_living_space_uu_id: Mapped[str] = mapped_column(String, nullable=False, comment="Build Living Space UUID")
event_id: Mapped[int] = mapped_column(ForeignKey("events.id"), nullable=False)
event_uu_id: Mapped[str] = mapped_column(
String, nullable=False, comment="Event UUID"
)
event_uu_id: Mapped[str] = mapped_column(String, nullable=False, comment="Event UUID")
__table_args__ = (
Index(
@@ -265,14 +253,10 @@ class Event2EmployeeExtra(CrudCollection):
__exclude__fields__ = []
employee_id: Mapped[int] = mapped_column(ForeignKey("employees.id"), nullable=False)
employee_uu_id: Mapped[str] = mapped_column(
String, nullable=False, comment="Employee UUID"
)
employee_uu_id: Mapped[str] = mapped_column(String, nullable=False, comment="Employee UUID")
event_id: Mapped[int] = mapped_column(ForeignKey("events.id"), nullable=False)
event_uu_id: Mapped[str] = mapped_column(
String, nullable=False, comment="Event UUID"
)
event_uu_id: Mapped[str] = mapped_column(String, nullable=False, comment="Event UUID")
__table_args__ = (
Index(
@@ -447,12 +431,8 @@ class Application2Occupant(CrudCollection):
__tablename__ = "application2occupant"
__exclude__fields__ = []
build_living_space_id: Mapped[int] = mapped_column(
ForeignKey("build_living_space.id"), nullable=False
)
build_living_space_uu_id = mapped_column(
String, nullable=False, comment="Build Living Space UUID"
)
build_living_space_id: Mapped[int] = mapped_column(ForeignKey("build_living_space.id"), nullable=False)
build_living_space_uu_id = mapped_column(String, nullable=False, comment="Build Living Space UUID")
service_id: Mapped[int] = mapped_column(ForeignKey("services.id"), nullable=False)
service_uu_id = mapped_column(String, nullable=False, comment="Service UUID")
@@ -462,6 +442,7 @@ class Application2Occupant(CrudCollection):
Service2Application.set_session(db)
Applications.set_session(db)
Application2OccupantExtra.set_session(db)
occupant_services = cls.query.filter(cls.build_living_space_id == build_living_space_id).all()
service_ids = [service.service_id for service in occupant_services]
active_applications = Service2Application.query.filter(Service2Application.service_id.in_(service_ids)).all()