schemas updated
This commit is contained in:
@@ -6,7 +6,7 @@ from sqlalchemy import String
|
||||
from sqlalchemy.orm import mapped_column, Mapped
|
||||
|
||||
from cryptography.fernet import Fernet, MultiFernet
|
||||
from databases.sql_models.core_mixin import CrudCollection
|
||||
from Services.PostgresDb import CrudCollection
|
||||
|
||||
|
||||
class CrypterEngine(CrudCollection):
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from datetime import datetime, timedelta
|
||||
from typing import List, Optional, Union
|
||||
from datetime import timedelta
|
||||
from typing import List, Union
|
||||
|
||||
from fastapi import HTTPException, status
|
||||
from sqlalchemy.orm import mapped_column, relationship, Mapped
|
||||
@@ -16,17 +16,17 @@ from sqlalchemy import (
|
||||
or_,
|
||||
)
|
||||
|
||||
from api_library.date_time_actions.date_functions import system_arrow
|
||||
from ApiLibrary.date_time_actions.date_functions import system_arrow
|
||||
from Services.PostgresDb import CrudCollection
|
||||
from databases.extensions.selector_classes import SelectActionWithEmployee
|
||||
from api_validations.validations_request import (
|
||||
from ApiValidations.Request import (
|
||||
InsertBuild,
|
||||
InsertBuildParts,
|
||||
InsertBuildLivingSpace,
|
||||
UpdateBuild,
|
||||
)
|
||||
from api_objects.auth.token_objects import EmployeeTokenObject, OccupantTokenObject
|
||||
from databases.language_models.building.build import (
|
||||
# from databases.extensions.selector_classes import SelectActionWithEmployee
|
||||
# from api_objects.auth.token_objects import EmployeeTokenObject, OccupantTokenObject
|
||||
from LanguageModels.Database.building.build import (
|
||||
BuildTypesLanguageModel,
|
||||
Part2EmployeeLanguageModel,
|
||||
BuildPartsLanguageModel,
|
||||
@@ -246,7 +246,7 @@ class Build(CrudCollection, SelectActionWithEmployee):
|
||||
|
||||
@classmethod
|
||||
def create_action(cls, data: InsertBuild, token):
|
||||
from databases import Addresses
|
||||
from Schemas import Addresses
|
||||
|
||||
data_dict = data.excluded_dump()
|
||||
data_dict["address_id"] = None
|
||||
@@ -280,7 +280,7 @@ class Build(CrudCollection, SelectActionWithEmployee):
|
||||
|
||||
@classmethod
|
||||
def update_action(cls, data: UpdateBuild, build_uu_id: str, token):
|
||||
from databases import Addresses
|
||||
from Schemas import Addresses
|
||||
|
||||
print("data_dict", data.dump())
|
||||
data_dict = data.excluded_dump()
|
||||
@@ -427,7 +427,7 @@ class BuildParts(CrudCollection):
|
||||
|
||||
@classmethod
|
||||
def create_action(cls, data: InsertBuildParts, token):
|
||||
from databases import ApiEnumDropdown
|
||||
from Schemas import ApiEnumDropdown
|
||||
|
||||
data_dict = data.dump()
|
||||
build_from_duty = Build.select_action(
|
||||
@@ -565,7 +565,7 @@ class BuildLivingSpace(CrudCollection):
|
||||
data: dict,
|
||||
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
|
||||
):
|
||||
from databases import Services, OccupantTypes
|
||||
from Schemas import Services, OccupantTypes
|
||||
from api_events.events.events.events_bind_modules import (
|
||||
ModulesBindOccupantEventMethods,
|
||||
)
|
||||
@@ -596,7 +596,7 @@ class BuildLivingSpace(CrudCollection):
|
||||
def find_living_from_customer_id(
|
||||
cls, customer_id, process_date, add_days: int = 32
|
||||
):
|
||||
from api_library.date_time_actions.date_functions import system_arrow
|
||||
from ApiLibrary.date_time_actions.date_functions import system_arrow
|
||||
|
||||
formatted_date = system_arrow.get(str(process_date))
|
||||
living_spaces = cls.filter_all(
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from fastapi.exceptions import HTTPException
|
||||
|
||||
from databases.sql_models.core_mixin import CrudCollection
|
||||
|
||||
from sqlalchemy import (
|
||||
String,
|
||||
@@ -14,19 +13,19 @@ from sqlalchemy import (
|
||||
)
|
||||
from sqlalchemy.orm import mapped_column, relationship, Mapped
|
||||
|
||||
from api_configs import RelationAccess
|
||||
from databases.extensions import SelectAction
|
||||
from api_validations.validations_request import (
|
||||
# from databases.extensions import SelectAction
|
||||
from ApiValidations.Request import (
|
||||
InsertCompany,
|
||||
UpdateCompany,
|
||||
MatchCompany2Company,
|
||||
)
|
||||
from api_objects.auth.token_objects import EmployeeTokenObject
|
||||
from databases.language_models.company.company import (
|
||||
from LanguageModels.Database.company.company import (
|
||||
RelationshipDutyCompanyLanguageModel,
|
||||
CompaniesLanguageModel,
|
||||
# CompanyDutiesLanguageModel,
|
||||
)
|
||||
from Services.PostgresDb import CrudCollection
|
||||
|
||||
|
||||
class RelationshipDutyCompany(CrudCollection):
|
||||
@@ -44,7 +43,6 @@ class RelationshipDutyCompany(CrudCollection):
|
||||
|
||||
__tablename__ = "relationship_duty_company"
|
||||
__exclude__fields__ = []
|
||||
__access_by__ = RelationAccess.SuperAccessList
|
||||
__language_model__ = RelationshipDutyCompanyLanguageModel
|
||||
|
||||
owner_id: Mapped[int] = mapped_column(
|
||||
@@ -75,7 +73,7 @@ class RelationshipDutyCompany(CrudCollection):
|
||||
|
||||
@classmethod
|
||||
def match_company_to_company_commercial(cls, data: MatchCompany2Company, token):
|
||||
from databases import (
|
||||
from Schemas import (
|
||||
Duties,
|
||||
)
|
||||
|
||||
@@ -123,7 +121,7 @@ class RelationshipDutyCompany(CrudCollection):
|
||||
|
||||
@classmethod
|
||||
def match_company_to_company_organization(cls, data: MatchCompany2Company, token):
|
||||
from databases import (
|
||||
from Schemas import (
|
||||
Duties,
|
||||
)
|
||||
|
||||
@@ -251,7 +249,7 @@ class Companies(CrudCollection, SelectAction):
|
||||
|
||||
@classmethod
|
||||
def create_action(cls, data: InsertCompany, token: EmployeeTokenObject):
|
||||
from databases import Addresses, Duties
|
||||
from Schemas import Addresses, Duties
|
||||
|
||||
data_dict = data.model_dump()
|
||||
if cls.filter_one(cls.tax_no == str(data.tax_no).strip(), system=True).data:
|
||||
@@ -298,7 +296,7 @@ class Companies(CrudCollection, SelectAction):
|
||||
|
||||
@classmethod
|
||||
def update_action(cls, data: UpdateCompany, token):
|
||||
from databases import (
|
||||
from Schemas import (
|
||||
Addresses,
|
||||
)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from sqlalchemy import String, Integer, ForeignKey, Index, Boolean, Identity
|
||||
from sqlalchemy.orm import mapped_column, Mapped
|
||||
|
||||
from databases.sql_models.core_mixin import CrudCollection
|
||||
from Services.PostgresDb import CrudCollection
|
||||
|
||||
|
||||
class Departments(CrudCollection):
|
||||
|
||||
@@ -6,15 +6,15 @@ from sqlalchemy import (
|
||||
)
|
||||
from sqlalchemy.orm import mapped_column, Mapped
|
||||
|
||||
from databases.language_models.company.employee import (
|
||||
from LanguageModels.Database.company.employee import (
|
||||
StaffLanguageModel,
|
||||
EmployeesLanguageModel,
|
||||
EmployeeHistoryLanguageModel,
|
||||
EmployeesSalariesLanguageModel,
|
||||
)
|
||||
from databases.sql_models.core_mixin import CrudCollection
|
||||
from Services.PostgresDb import CrudCollection
|
||||
|
||||
from api_validations.validations_request import InsertCompanyEmployees
|
||||
from ApiValidations.Request import InsertCompanyEmployees
|
||||
|
||||
|
||||
class Staff(CrudCollection):
|
||||
@@ -47,7 +47,7 @@ class Staff(CrudCollection):
|
||||
|
||||
@classmethod
|
||||
def create_action(cls, data: InsertCompanyEmployees):
|
||||
from databases import Duties
|
||||
from Schemas import Duties
|
||||
|
||||
data_dict = data.model_dump()
|
||||
if duty := Duties.find_one(uu_id=data.duty_uu_id):
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from databases.sql_models.core_mixin import CrudCollection
|
||||
from databases.language_models.event.event import (
|
||||
from Services.PostgresDb import CrudCollection
|
||||
from LanguageModels.Database.event.event import (
|
||||
EventsLanguageModel,
|
||||
ModulesLanguageModel,
|
||||
ServicesLanguageModel,
|
||||
@@ -122,7 +122,7 @@ class Services(CrudCollection):
|
||||
|
||||
@classmethod
|
||||
def retrieve_service_via_occupant_code(cls, occupant_code):
|
||||
from databases import OccupantTypes
|
||||
from Schemas import OccupantTypes
|
||||
|
||||
occupant_type = OccupantTypes.filter_by_one(
|
||||
system=True,
|
||||
|
||||
@@ -16,13 +16,14 @@ from sqlalchemy import (
|
||||
)
|
||||
from sqlalchemy.orm import mapped_column, relationship, Mapped
|
||||
|
||||
from api_library.date_time_actions.date_functions import system_arrow
|
||||
from api_configs import Auth, ApiStatic, RelationAccess
|
||||
from databases.sql_models.core_mixin import CrudCollection
|
||||
from databases.extensions import SelectAction, SelectActionWithEmployee
|
||||
from databases.extensions.auth import UserLoginModule
|
||||
from api_validations.validations_request import InsertUsers, InsertPerson
|
||||
from databases.language_models.identity.identity import (
|
||||
from ApiLibrary.date_time_actions.date_functions import system_arrow
|
||||
from AllConfigs.Token.config import Auth, ApiStatic
|
||||
|
||||
from Services.PostgresDb import CrudCollection
|
||||
# from databases.extensions import SelectAction, SelectActionWithEmployee
|
||||
# from databases.extensions.auth import UserLoginModule
|
||||
from ApiValidations.Request import InsertUsers, InsertPerson
|
||||
from LanguageModels.Database.identity.identity import (
|
||||
UsersTokensLanguageModel,
|
||||
UsersLanguageModel,
|
||||
PeopleLanguageModel,
|
||||
@@ -197,7 +198,7 @@ class Users(CrudCollection, UserLoginModule, SelectAction):
|
||||
}
|
||||
|
||||
def get_employee_and_duty_details(self):
|
||||
from databases import Employees, Duties
|
||||
from Schemas import Employees, Duties
|
||||
|
||||
found_person = People.filter_one(
|
||||
People.id == self.person_id,
|
||||
@@ -234,7 +235,7 @@ class Users(CrudCollection, UserLoginModule, SelectAction):
|
||||
}
|
||||
|
||||
def get_main_domain_and_other_domains(self, get_main_domain: bool = True):
|
||||
from databases import MongoQueryIdentity
|
||||
from Schemas import MongoQueryIdentity
|
||||
|
||||
query_engine = MongoQueryIdentity(company_uuid=self.related_company)
|
||||
domain_via_user = query_engine.get_domain_via_user(user_uu_id=str(self.uu_id))
|
||||
@@ -253,7 +254,6 @@ class RelationshipDutyPeople(CrudCollection):
|
||||
|
||||
__tablename__ = "relationship_duty_people"
|
||||
__exclude__fields__ = []
|
||||
__access_by__ = RelationAccess.SuperAccessList
|
||||
__language_model__ = RelationshipDutyPeopleLanguageModel
|
||||
|
||||
company_id: Mapped[int] = mapped_column(
|
||||
@@ -374,7 +374,7 @@ class People(CrudCollection, SelectAction):
|
||||
|
||||
@classmethod
|
||||
def create_action(cls, data: InsertPerson, token):
|
||||
from databases import Duties
|
||||
from Schemas import Duties
|
||||
|
||||
token_duties_id, token_company_id = (
|
||||
token.selected_company.duty_id,
|
||||
|
||||
@@ -9,7 +9,7 @@ from sqlalchemy.orm import (
|
||||
Mapped,
|
||||
mapped_column,
|
||||
)
|
||||
from databases.sql_models.core_mixin import CrudCollection
|
||||
from Services.PostgresDb import CrudCollection
|
||||
|
||||
|
||||
class ApiEnumDropdown(CrudCollection):
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
from sqlalchemy import String
|
||||
from sqlalchemy.orm import mapped_column, Mapped
|
||||
|
||||
from databases.language_models.rules.rules import EndpointRestrictionLanguageModel
|
||||
from databases.sql_models.core_mixin import CrudCollection
|
||||
from LanguageModels.Database.rules.rules import EndpointRestrictionLanguageModel
|
||||
from Services.PostgresDb import CrudCollection
|
||||
|
||||
|
||||
class EndpointRestriction(CrudCollection):
|
||||
|
||||
Reference in New Issue
Block a user