auth service up running

This commit is contained in:
2025-01-10 14:17:22 +03:00
parent 03accfed1b
commit 79aa3a1bc5
41 changed files with 480 additions and 340 deletions

View File

@@ -70,7 +70,7 @@ RelationshipDutyPeopleLanguageModel = dict(
"member_id": "Member ID",
"relationship_type": "Relationship Type",
"show_only": "Show Only",
}
},
)
PeopleLanguageModel = dict(
@@ -105,7 +105,7 @@ PeopleLanguageModel = dict(
"birth_place": "Birth Place",
"birth_date": "Birth Date",
"tax_no": "Tax No",
}
},
)
RelationshipEmployee2PostCodeLanguageModel = dict(
@@ -124,7 +124,7 @@ RelationshipEmployee2PostCodeLanguageModel = dict(
"member_id": "Member ID",
"relationship_type": "Relationship Type",
"show_only": "Show Only",
}
},
)
AddressPostcodeLanguageModel = dict(
@@ -168,7 +168,7 @@ AddressesLanguageModel = dict(
"longitude": "Longitude",
"street_id": "Street ID",
"street_uu_id": "Street UUID",
}
},
)
AddressGeographicLocationsLanguageModel = dict(
@@ -195,7 +195,7 @@ AddressGeographicLocationsLanguageModel = dict(
"geo_description": "Description",
"geo_area_size": "Area",
"geo_population": "Population",
}
},
)
AddressCountryLanguageModel = dict(

View File

@@ -16,5 +16,5 @@ EndpointRestrictionLanguageModel = dict(
"endpoint_method": "API Method",
"endpoint_desc": "API Description",
"endpoint_code": "API Code",
}
},
)

View File

@@ -13,8 +13,8 @@ def validate_timestamp(doc):
"""Validate and fix timestamp fields in MongoDB documents"""
if not doc:
return doc
timestamp_fields = ['modified_at', 'created_at', 'accessed_at', 'timestamp']
timestamp_fields = ["modified_at", "created_at", "accessed_at", "timestamp"]
for field in timestamp_fields:
if field in doc and not isinstance(doc[field], (int, float)):
# Convert to proper timestamp if it's not already

View File

@@ -41,6 +41,7 @@ from databases.language_models.building.build import (
BuildPersonProvidingLanguageModel,
)
class BuildTypes(CrudCollection):
"""
BuildTypes class based on declarative_base and BaseMixin via session
@@ -177,12 +178,8 @@ class Build(CrudCollection, SelectActionWithEmployee):
heating_system: Mapped[bool] = mapped_column(Boolean, server_default="True")
cooling_system: Mapped[bool] = mapped_column(Boolean, server_default="False")
hot_water_system: Mapped[bool] = mapped_column(Boolean, server_default="False")
block_service_man_count: Mapped[int] = mapped_column(
Integer, server_default="0"
)
security_service_man_count: Mapped[int] = mapped_column(
Integer, server_default="0"
)
block_service_man_count: Mapped[int] = mapped_column(Integer, server_default="0")
security_service_man_count: Mapped[int] = mapped_column(Integer, server_default="0")
garage_count: Mapped[int] = mapped_column(
Integer, server_default="0", comment="Garage Count"
)

View File

@@ -2,7 +2,16 @@ from fastapi.exceptions import HTTPException
from databases.sql_models.core_mixin import CrudCollection
from sqlalchemy import String, Integer, Boolean, ForeignKey, Index, Identity, TIMESTAMP, func
from sqlalchemy import (
String,
Integer,
Boolean,
ForeignKey,
Index,
Identity,
TIMESTAMP,
func,
)
from sqlalchemy.orm import mapped_column, relationship, Mapped
from api_configs import RelationAccess

View File

@@ -9,12 +9,14 @@ engine_config = {
"pool_size": 20,
"max_overflow": 10,
"echo": True,
"echo_pool":True,
"echo_pool": True,
"isolation_level": "READ COMMITTED",
"pool_pre_ping": True,
}
engine = create_engine(**engine_config, )
engine = create_engine(
**engine_config,
)
SessionLocal = sessionmaker(bind=engine, autoflush=False, autocommit=False)
session = scoped_session(sessionmaker(bind=engine))

View File

@@ -52,9 +52,9 @@ class FilterAttributes:
meta_data = getattr(cls, "meta_data", {})
meta_data_created = meta_data.get("created", False)
if meta_data_created:
print('meta_data_created commit', meta_data_created)
print("meta_data_created commit", meta_data_created)
cls.__session__.commit()
print('meta_data_created rollback', meta_data_created)
print("meta_data_created rollback", meta_data_created)
cls.__session__.rollback()
# cls.raise_http_exception(
# status_code="HTTP_304_NOT_MODIFIED",
@@ -82,6 +82,7 @@ class FilterAttributes:
data={},
message=str(e.__context__).split("\n")[0],
)
@classmethod
def rollback(cls):
"""Rollback the current session."""