Web service initiated
This commit is contained in:
@@ -13,7 +13,6 @@ from sqlalchemy import (
|
||||
from sqlalchemy.orm import mapped_column, relationship, Mapped
|
||||
|
||||
from Controllers.Postgres.mixin import CrudCollection
|
||||
from Schemas import Duties, Addresses
|
||||
|
||||
|
||||
class RelationshipDutyCompany(CrudCollection):
|
||||
@@ -60,6 +59,8 @@ class RelationshipDutyCompany(CrudCollection):
|
||||
|
||||
@classmethod
|
||||
def match_company_to_company_commercial(cls, data: Any, token):
|
||||
from Schemas import Duties
|
||||
|
||||
with cls.new_session() as db_session:
|
||||
token_duties_id, token_company_id = token.get("duty_id"), token.get(
|
||||
"company_id"
|
||||
@@ -108,6 +109,8 @@ class RelationshipDutyCompany(CrudCollection):
|
||||
|
||||
@classmethod
|
||||
def match_company_to_company_organization(cls, data: Any, token):
|
||||
from Schemas import Duties
|
||||
|
||||
with cls.new_session() as db_session:
|
||||
token_duties_id, token_company_id = token.get("duty_id"), token.get(
|
||||
"company_id"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -29,7 +29,7 @@ class UsersTokens(CrudCollection):
|
||||
domain: Mapped[str] = mapped_column(String, server_default="")
|
||||
expires_at: Mapped[TIMESTAMP] = mapped_column(
|
||||
TIMESTAMP(timezone=True),
|
||||
default=str(arrow.now().shift(date=arrow.now(), days=3)),
|
||||
default=str(arrow.now().shift(days=3)),
|
||||
)
|
||||
|
||||
# users = relationship("Users", back_populates="tokens", foreign_keys=[user_id])
|
||||
|
||||
@@ -19,7 +19,7 @@ class EndpointRestriction(CrudCollection):
|
||||
__exclude__fields__ = []
|
||||
|
||||
operation_uu_id: Mapped[UUID] = mapped_column(
|
||||
String, comment="UUID of the operation",
|
||||
String, comment="UUID of the operation", nullable=False, unique=True
|
||||
)
|
||||
endpoint_function: Mapped[str] = mapped_column(
|
||||
String, server_default="", comment="Function name of the API endpoint"
|
||||
@@ -33,6 +33,3 @@ class EndpointRestriction(CrudCollection):
|
||||
endpoint_desc: Mapped[str] = mapped_column(
|
||||
String, server_default="", comment="Description of the endpoint"
|
||||
)
|
||||
endpoint_code: Mapped[str] = mapped_column(
|
||||
String, server_default="", unique=True, comment="Unique code for the endpoint"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user