Web service initiated

This commit is contained in:
2025-04-05 14:59:10 +03:00
parent b1c8203a33
commit fa4df11323
76 changed files with 5385 additions and 171 deletions

View File

@@ -9,7 +9,6 @@ from sqlalchemy import (
)
from sqlalchemy.orm import mapped_column, Mapped
from Controllers.Postgres.mixin import CrudCollection
from Schemas import OccupantTypes
class Events(CrudCollection):
@@ -21,26 +20,24 @@ class Events(CrudCollection):
__tablename__ = "events"
__exclude__fields__ = []
event_type: Mapped[str] = mapped_column(
String, nullable=False, comment="Event Type"
)
function_code: Mapped[str] = mapped_column(
String, nullable=False, comment="function code"
String, nullable=False, comment="function code", unique=True
)
function_class: Mapped[str] = mapped_column(
String, nullable=False, comment="class name"
)
# name: Mapped[str] = mapped_column(String, nullable=True) # form or page title
description: Mapped[str] = mapped_column(
String, server_default=""
) # form or page description
description: Mapped[str] = mapped_column(String, server_default="")
property_description: Mapped[str] = mapped_column(String, server_default="")
marketing_layer = mapped_column(SmallInteger, server_default="3")
cost: Mapped[float] = mapped_column(Numeric(20, 2), server_default="0.00")
unit_price: Mapped[float] = mapped_column(Numeric(20, 2), server_default="0.00")
endpoint_code: Mapped[str] = mapped_column(
String, nullable=False, comment="Event Type"
)
endpoint_id: Mapped[int] = mapped_column(
ForeignKey("endpoint_restriction.id"), nullable=True
)
@@ -108,6 +105,8 @@ class Services(CrudCollection):
@classmethod
def retrieve_service_via_occupant_code(cls, occupant_code):
from Schemas import OccupantTypes
with cls.new_session() as db_session:
occupant_type = OccupantTypes.filter_by_one(
system=True, occupant_code=occupant_code, db=db_session