auth service up running

This commit is contained in:
2025-01-10 14:15:35 +03:00
parent 4eb95e4d9c
commit 03accfed1b
23 changed files with 457 additions and 317 deletions

View File

@@ -1,24 +1,30 @@
from datetime import datetime
from typing import Optional, List, Union
from sqlalchemy.orm import mapped_column, Mapped
from sqlalchemy import (
String,
Integer,
Boolean,
ForeignKey,
Index,
SmallInteger,
Boolean,
TIMESTAMP,
func,
Text,
BigInteger,
Numeric,
UUID,
SmallInteger,
)
from databases.sql_models.core_mixin import CrudCollection
from databases.language_models import (
from databases.language_models.account.account import (
AccountBooksLanguageModel,
AccountDetailLanguageModel,
AccountMasterLanguageModel,
AccountRecordExchangesLanguageModel,
AccountCodesLanguageModel,
AccountRecordsLanguageModel,
AccountRecordExchangesLanguageModel,
AccountDetailLanguageModel,
AccountCodeParserLanguageModel,
AccountMasterLanguageModel,
)
@@ -29,7 +35,7 @@ class AccountBooks(CrudCollection):
__language_model__ = AccountBooksLanguageModel
country: Mapped[str] = mapped_column(String, nullable=False)
branch_type: Mapped[str] = mapped_column(SmallInteger, server_default="0")
branch_type: Mapped[int] = mapped_column(SmallInteger, server_default="0")
company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"), nullable=False)
company_uu_id: Mapped[str] = mapped_column(String, nullable=False)
@@ -79,7 +85,7 @@ class AccountCodes(CrudCollection):
account_code_seperator: Mapped[str] = mapped_column(String(1), server_default=".")
system_id: Mapped[int] = mapped_column(SmallInteger, server_default="0")
locked: Mapped[bool] = mapped_column(SmallInteger, server_default="0")
locked: Mapped[int] = mapped_column(SmallInteger, server_default="0")
company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"))
company_uu_id: Mapped[str] = mapped_column(
@@ -120,7 +126,7 @@ class AccountCodeParser(CrudCollection):
__tablename__ = "account_code_parser"
__exclude__fields__ = []
__language_model__ = AccountCodeParserLanguageModel
__language_model__ = AccountCodesLanguageModel
account_code_1: Mapped[str] = mapped_column(String, nullable=False, comment="Order")
account_code_2: Mapped[str] = mapped_column(String, nullable=False, comment="Order")
@@ -297,7 +303,7 @@ class AccountDetail(CrudCollection):
canceled: Mapped[int] = mapped_column(SmallInteger, server_default="0")
cross_ref: Mapped[int] = mapped_column(Integer, server_default="0")
data_center_id: Mapped[str] = mapped_column(String, server_default="")
data_center_rec_num: Mapped[str] = mapped_column(Integer, server_default="0")
data_center_rec_num: Mapped[int] = mapped_column(Integer, server_default="0")
status_id: Mapped[int] = mapped_column(SmallInteger, server_default="0")
plug_type_id: Mapped[int] = mapped_column(
@@ -728,7 +734,6 @@ class AccountRecords(CrudCollection):
# ),
# {"comment": "Account Record Decision Payment Closed Information"},
# )
#
class AccountRecordExchanges(CrudCollection):

View File

@@ -1,35 +1,45 @@
import typing
from operator import or_
from datetime import datetime, timedelta
from platform import system
from typing import List
from typing import List, Optional, Union
from fastapi import HTTPException, status
from sqlalchemy.orm import mapped_column, relationship, Mapped
from sqlalchemy import (
String,
Integer,
Boolean,
ForeignKey,
Index,
SmallInteger,
Boolean,
TIMESTAMP,
func,
Text,
Numeric,
or_,
)
from api_library.date_time_actions.date_functions import system_arrow
from databases.sql_models.core_mixin import CrudCollection
from databases.extensions.selector_classes import SelectActionWithEmployee
from api_validations.validations_request import (
InsertBuildParts,
InsertBuild,
InsertBuildParts,
InsertBuildLivingSpace,
UpdateBuild,
)
from api_objects.auth.token_objects import EmployeeTokenObject, OccupantTokenObject
from databases.language_models.building.build import (
BuildTypesLanguageModel,
Part2EmployeeLanguageModel,
BuildPartsLanguageModel,
BuildSitesLanguageModel,
RelationshipEmployee2BuildLanguageModel,
BuildLanguageModel,
BuildPartsLanguageModel,
BuildLivingSpaceLanguageModel,
BuildManagementLanguageModel,
BuildAreaLanguageModel,
BuildCompaniesProvidingLanguageModel,
BuildPersonProvidingLanguageModel,
)
class BuildTypes(CrudCollection):
"""
@@ -39,6 +49,7 @@ class BuildTypes(CrudCollection):
__tablename__ = "build_types"
__exclude__fields__ = []
__language_model__ = BuildTypesLanguageModel
__include__fields__ = []
function_code: Mapped[str] = mapped_column(
@@ -68,6 +79,7 @@ class Part2Employee(CrudCollection):
__tablename__ = "part2employee"
__exclude__fields__ = []
__language_model__ = Part2EmployeeLanguageModel
__include__fields__ = []
build_id: Mapped[int] = mapped_column(Integer, comment="Building ID")
@@ -93,6 +105,7 @@ class RelationshipEmployee2Build(CrudCollection):
__tablename__ = "relationship_employee2build"
__exclude__fields__ = []
__language_model__ = RelationshipEmployee2BuildLanguageModel
company_id: Mapped[int] = mapped_column(
ForeignKey("companies.id"), nullable=False
@@ -129,6 +142,7 @@ class Build(CrudCollection, SelectActionWithEmployee):
__tablename__ = "build"
__exclude__fields__ = []
__language_model__ = BuildLanguageModel
__include__fields__ = []
__access_by__ = []
__many__table__ = RelationshipEmployee2Build
@@ -145,10 +159,10 @@ class Build(CrudCollection, SelectActionWithEmployee):
)
max_floor: Mapped[int] = mapped_column(
SmallInteger, server_default="1", nullable=False, comment="Max Floor"
Integer, server_default="1", nullable=False, comment="Max Floor"
)
underground_floor: Mapped[int] = mapped_column(
SmallInteger, server_default="0", nullable=False, comment="Underground Floor"
Integer, server_default="0", nullable=False, comment="Underground Floor"
)
build_date: Mapped[TIMESTAMP] = mapped_column(
TIMESTAMP(timezone=True), server_default="1900-01-01"
@@ -159,18 +173,18 @@ class Build(CrudCollection, SelectActionWithEmployee):
comment="Building annual ordinary meeting period",
)
tax_no: Mapped[str] = mapped_column(String(24), server_default="")
lift_count: Mapped[int] = mapped_column(SmallInteger, server_default="0")
lift_count: Mapped[int] = mapped_column(Integer, server_default="0")
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(
SmallInteger, server_default="0"
Integer, server_default="0"
)
security_service_man_count: Mapped[int] = mapped_column(
SmallInteger, server_default="0"
Integer, server_default="0"
)
garage_count: Mapped[int] = mapped_column(
SmallInteger, server_default="0", comment="Garage Count"
Integer, server_default="0", comment="Garage Count"
)
management_room_id: Mapped[int] = mapped_column(
Integer, nullable=True, comment="Management Room ID"
@@ -290,7 +304,7 @@ class Build(CrudCollection, SelectActionWithEmployee):
def top_flat(self):
max_flat_no = 0
for part in self.parts:
if part.part_no > self.max_flat_no:
if part.part_no > self.max_floor:
max_flat_no = part.part_no
return max_flat_no
@@ -298,7 +312,7 @@ class Build(CrudCollection, SelectActionWithEmployee):
def bottom_flat(self):
min_flat_no = 0
for part in self.parts:
if part.part_no < self.max_flat_no:
if part.part_no < self.max_floor:
min_flat_no = part.part_no
return min_flat_no
@@ -352,6 +366,7 @@ class BuildParts(CrudCollection):
__tablename__ = "build_parts"
__exclude__fields__ = []
__language_model__ = BuildPartsLanguageModel
__include__fields__ = []
__enum_list__ = [("part_direction", "Directions", "NN")]
@@ -361,10 +376,10 @@ class BuildParts(CrudCollection):
)
# part_name: Mapped[str] = mapped_column(String(24), server_default="", nullable=False, comment="Part Name")
part_no: Mapped[int] = mapped_column(
SmallInteger, server_default="0", nullable=False, comment="Part Number"
Integer, server_default="0", nullable=False, comment="Part Number"
)
part_level: Mapped[int] = mapped_column(
SmallInteger, server_default="0", comment="Building Part Level"
Integer, server_default="0", comment="Building Part Level"
)
part_code: Mapped[str] = mapped_column(
String, server_default="", nullable=False, comment="Part Code"
@@ -496,6 +511,7 @@ class BuildLivingSpace(CrudCollection):
__tablename__ = "build_living_space"
__exclude__fields__ = []
__language_model__ = BuildLivingSpaceLanguageModel
__include__fields__ = []
fix_value: Mapped[float] = mapped_column(
@@ -513,7 +529,7 @@ class BuildLivingSpace(CrudCollection):
String, server_default="", comment="Agreement No"
)
marketing_process: Mapped[bool] = mapped_column(Boolean, server_default="False")
marketing_layer: Mapped[int] = mapped_column(SmallInteger, server_default="0")
marketing_layer: Mapped[int] = mapped_column(Integer, server_default="0")
build_parts_id: Mapped[int] = mapped_column(
ForeignKey("build_parts.id"),
@@ -550,7 +566,7 @@ class BuildLivingSpace(CrudCollection):
def create_action(
cls,
data: dict,
token_dict: typing.Union[EmployeeTokenObject, OccupantTokenObject],
token_dict: Union[EmployeeTokenObject, OccupantTokenObject],
):
from databases import Services, OccupantTypes
from api_events.events.events.events_bind_modules import (
@@ -601,6 +617,7 @@ class BuildManagement(CrudCollection):
__tablename__ = "build_management"
__exclude__fields__ = []
__language_model__ = BuildManagementLanguageModel
discounted_percentage: Mapped[float] = mapped_column(
Numeric(6, 2), server_default="0.00"
@@ -655,6 +672,7 @@ class BuildArea(CrudCollection):
__tablename__ = "build_area"
__exclude__fields__ = []
__language_model__ = BuildAreaLanguageModel
area_name: Mapped[str] = mapped_column(String, server_default="")
area_code: Mapped[str] = mapped_column(String, server_default="")
@@ -690,6 +708,7 @@ class BuildSites(CrudCollection):
__tablename__ = "build_sites"
__exclude__fields__ = []
__language_model__ = BuildSitesLanguageModel
__include__fields__ = []
site_name: Mapped[str] = mapped_column(String(24), nullable=False)
@@ -716,6 +735,7 @@ class BuildCompaniesProviding(CrudCollection):
__tablename__ = "build_companies_providing"
__exclude__fields__ = []
__language_model__ = BuildCompaniesProvidingLanguageModel
__include__fields__ = []
build_id = mapped_column(
@@ -755,6 +775,7 @@ class BuildPersonProviding(CrudCollection):
__tablename__ = "build_person_providing"
__exclude__fields__ = []
__language_model__ = BuildPersonProvidingLanguageModel
__include__fields__ = []
build_id = mapped_column(
@@ -787,75 +808,3 @@ class BuildPersonProviding(CrudCollection):
),
{"comment": "People providing services for building"},
)
# owner_people: Mapped["People"] = relationship(
# "People",
# back_populates="owner_buildings",
# foreign_keys=[current_owner_person_id],
# )
# tenant_people: Mapped["People"] = relationship(
# "People",
# back_populates="tenant_buildings",
# foreign_keys=[current_tenant_person_id],
# )
# decision_book_management: Mapped[List["BuildDecisionBookManagement"]] = (
# relationship(
# "BuildDecisionBookManagement",
# back_populates="buildings",
# foreign_keys="BuildDecisionBookManagement.build_parts_id",
# )
# )
# budget_records: Mapped[List["CompanyBudgetRecords"]] = relationship(
# "CompanyBudgetRecords",
# back_populates="parts",
# foreign_keys="CompanyBudgetRecords.build_parts_id",
# )
# living_spaces: Mapped[List["BuildLivingSpace"]] = relationship(
# "BuildLivingSpace",
# back_populates="parts",
# foreign_keys="BuildLivingSpace.build_parts_id",
# )
# decision_book_payment_master: Mapped[List["BuildDecisionBookPaymentsMaster"]] = (
# relationship(
# "BuildDecisionBookPaymentsMaster",
# back_populates="parts",
# foreign_keys="BuildDecisionBookPaymentsMaster.build_parts_id",
# )
# )
# decision_book_project_payments_master: Mapped[
# "BuildDecisionBookProjectPaymentsMaster"
# ] = relationship(
# "BuildDecisionBookProjectPaymentsMaster",
# back_populates="parts",
# foreign_keys="BuildDecisionBookProjectPaymentsMaster.build_parts_id",
# )
# search_iban_description: Mapped["BuildIbanDescription"] = relationship(
# "BuildIbanDescription",
# back_populates="parts",
# foreign_keys="BuildIbanDescription.build_parts_id",
# )
# parts: Mapped[List["BuildParts"]] = relationship(
# "BuildParts", back_populates="living_spaces", foreign_keys=[build_parts_id]
# )
# owner_people: Mapped["People"] = relationship(
# "People", back_populates="owner_living_spaces", foreign_keys=[owner_person_id]
# )
# life_people: Mapped["People"] = relationship(
# "People", back_populates="life_living_spaces", foreign_keys=[life_person_id]
# )
# company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"))
# response_company_id: Mapped[int] = mapped_column(ForeignKey("companies.id"))
# person_id: Mapped[int] = mapped_column(ForeignKey("people.id"))
# companies: Mapped["Companies"] = relationship(
# "Companies", back_populates="buildings", foreign_keys=[company_id]
# )
# @classmethod
# def select_action(cls, duty_id, token=None):
# from database_sql_models import Companies
#
# related_companies = Companies.select_action(duty_id=duty_id)
# companies_ids = [company.id for company in related_companies.all()]
# return cls.filter_all(cls.company_id.in_(companies_ids)).query

View File

@@ -977,7 +977,7 @@ class BuildDecisionBookLegal(CrudCollection):
contact_agreement_date: Mapped[TIMESTAMP] = mapped_column(
TIMESTAMP(timezone=True), server_default="1900-01-01 00:00:00", nullable=True
)
meeting_date: Mapped[str] = mapped_column(
meeting_date: Mapped[TIMESTAMP] = mapped_column(
TIMESTAMP(timezone=True), server_default="1900-01-01 00:00:00"
)
lawsuits_type: Mapped[str] = mapped_column(String(1), server_default="C")

View File

@@ -2,8 +2,8 @@ from fastapi.exceptions import HTTPException
from databases.sql_models.core_mixin import CrudCollection
from sqlalchemy import String, Integer, Boolean, ForeignKey, Index, Identity
from sqlalchemy.orm import mapped_column, Mapped
from sqlalchemy import String, Integer, Boolean, ForeignKey, Index, Identity, TIMESTAMP, func
from sqlalchemy.orm import mapped_column, relationship, Mapped
from api_configs import RelationAccess
from databases.extensions import SelectAction
@@ -13,6 +13,11 @@ from api_validations.validations_request import (
MatchCompany2Company,
)
from api_objects.auth.token_objects import EmployeeTokenObject
from databases.language_models.company.company import (
RelationshipDutyCompanyLanguageModel,
CompaniesLanguageModel,
# CompanyDutiesLanguageModel,
)
class RelationshipDutyCompany(CrudCollection):
@@ -31,6 +36,7 @@ class RelationshipDutyCompany(CrudCollection):
__tablename__ = "relationship_duty_company"
__exclude__fields__ = []
__access_by__ = RelationAccess.SuperAccessList
__language_model__ = RelationshipDutyCompanyLanguageModel
owner_id: Mapped[int] = mapped_column(
ForeignKey("companies.id"), nullable=False
@@ -184,6 +190,7 @@ class Companies(CrudCollection, SelectAction):
__exclude__fields__ = ["is_blacklist", "is_commercial"]
__access_by__ = []
__many__table__ = RelationshipDutyCompany
__language_model__ = CompaniesLanguageModel
# __explain__ = AbstractCompany()
formal_name: Mapped[str] = mapped_column(

View File

@@ -1,4 +1,15 @@
from databases.sql_models.core_mixin import CrudCollection
from databases.language_models.event.event import (
EventsLanguageModel,
ModulesLanguageModel,
ServicesLanguageModel,
Service2EventsLanguageModel,
Event2OccupantExtraLanguageModel,
Event2EmployeeExtraLanguageModel,
Event2EmployeeLanguageModel,
Event2OccupantLanguageModel,
ModulePriceLanguageModel,
)
from sqlalchemy import (
String,
@@ -20,6 +31,7 @@ class Events(CrudCollection):
__tablename__ = "events"
__exclude__fields__ = []
__language_model__ = EventsLanguageModel
event_type: Mapped[str] = mapped_column(
String, nullable=False, comment="Event Type"
@@ -58,6 +70,7 @@ class Modules(CrudCollection):
__tablename__ = "modules"
__exclude__fields__ = []
__language_model__ = ModulesLanguageModel
module_name: Mapped[str] = mapped_column(
String, nullable=False, comment="Module Name"
@@ -92,6 +105,7 @@ class Services(CrudCollection):
__tablename__ = "services"
__exclude__fields__ = []
__language_model__ = ServicesLanguageModel
module_id: Mapped[int] = mapped_column(ForeignKey("modules.id"), nullable=False)
module_uu_id: Mapped[str] = mapped_column(
@@ -137,6 +151,7 @@ class Service2Events(CrudCollection):
__tablename__ = "services2events"
__exclude__fields__ = []
__language_model__ = Service2EventsLanguageModel
service_id: Mapped[int] = mapped_column(ForeignKey("services.id"), nullable=False)
service_uu_id = mapped_column(String, nullable=False, comment="Service UUID")
@@ -150,6 +165,7 @@ class Event2OccupantExtra(CrudCollection):
__tablename__ = "event2occupant_extra"
__exclude__fields__ = []
__language_model__ = Event2OccupantExtraLanguageModel
build_living_space_id: Mapped[int] = mapped_column(
ForeignKey("build_living_space.id"), nullable=False
@@ -180,6 +196,7 @@ class Event2EmployeeExtra(CrudCollection):
__tablename__ = "event2employee_extra"
__exclude__fields__ = []
__language_model__ = Event2EmployeeExtraLanguageModel
employee_id: Mapped[int] = mapped_column(ForeignKey("employees.id"), nullable=False)
employee_uu_id: Mapped[str] = mapped_column(
@@ -209,6 +226,7 @@ class Event2Employee(CrudCollection):
__tablename__ = "event2employee"
__exclude__fields__ = []
__language_model__ = Event2EmployeeLanguageModel
employee_id: Mapped[int] = mapped_column(ForeignKey("employees.id"), nullable=False)
employee_uu_id: Mapped[str] = mapped_column(
@@ -257,6 +275,7 @@ class Event2Occupant(CrudCollection):
__tablename__ = "event2occupant"
__exclude__fields__ = []
__language_model__ = Event2OccupantLanguageModel
build_living_space_id: Mapped[str] = mapped_column(
ForeignKey("build_living_space.id"), nullable=False
@@ -309,6 +328,7 @@ class ModulePrice(CrudCollection):
__tablename__ = "module_price"
__exclude__fields__ = []
__language_model__ = ModulePriceLanguageModel
campaign_code: Mapped[str] = mapped_column(
String, nullable=False, comment="Campaign Code"
@@ -336,73 +356,3 @@ class ModulePrice(CrudCollection):
) # sana düz 75.00 TL yapar
__table_args__ = ({"comment": "ModulePrice Information"},)
# class Modules2Occupant(CrudCollection):
# """
# ModulesOccupantPrices class based on declarative_base and BaseMixin via session
# discounted_price - calculated_price = Pazarlamaya gider yazılır 3 TL
# """
#
# __tablename__ = "modules2_occupant"
#
#
# discounted_percentage: Mapped[float] = mapped_column(Numeric(6, 2), server_default="0.00") # %22
# discounted_price = mapped_column(
# Numeric(20, 2), server_default="0.00"
# ) # Normal: 78.00 TL
# calculated_price = mapped_column(
# Numeric(20, 2), server_default="0.00"
# ) # sana düz 75.00 TL yapar
#
# service_id = mapped_column(ForeignKey("services.id"), nullable=False)
# build_living_space_id = mapped_column(
# ForeignKey("build_living_space.id"), nullable=False, index=True
# )
#
# __table_args__ = ({"comment": "ModulesOccupantPrices Information"},)
#
#
# class Modules2Employee(CrudCollection):
# """
# Modules2EmployeeServices class based on declarative_base and BaseMixin via session
# """
#
# __tablename__ = "modules2_employee"
#
# discounted_percentage: Mapped[float] = mapped_column(Numeric(6, 2), server_default="0.00") # %22
# discounted_price = mapped_column(
# Numeric(20, 2), server_default="0.00"
# ) # Normal: 78.00 TL
# calculated_price = mapped_column(
# Numeric(20, 2), server_default="0.00"
# ) # sana düz 75.00 TL yapar
#
# service_id = mapped_column(ForeignKey("services.id"), nullable=False)
# employee_id = mapped_column(ForeignKey("employees.id"), nullable=False)
#
# __table_args__ = ({"comment": "Modules2EmployeeServices Information"},)
# class Actions(CrudCollection):
# """
# Actions class based on declarative_base and BaseMixin via session
# """
#
# __tablename__ = "actions"
# __exclude__fields__ = []
#
# action_table = mapped_column(String, nullable=False, comment="Action Table")
# action_type = mapped_column(String, nullable=False, comment="Action Type")
# action_description = mapped_column(String, server_default="")
# action_code = mapped_column(String, nullable=False, comment="Action Code")
# endpoint_id = mapped_column(ForeignKey("endpoint_restriction.id"), nullable=True)
# endpoint_uu_id = mapped_column(String, nullable=True, comment="Endpoint UUID")
#
# @property
# def action_name(self):
# return f"{self.action_table} {self.action_type}"
#
# @property
# def total_cost(self):
# return self.cost * self.unit_price
#
# __table_args__ = ({"comment": "Actions Information"},)

View File

@@ -1,35 +1,54 @@
from api_library.date_time_actions.date_functions import system_arrow
from api_configs import Auth, ApiStatic, RelationAccess
from datetime import timedelta
from typing import Optional, List
from fastapi import HTTPException
from databases.sql_models.core_mixin import CrudCollection
from databases.extensions import SelectAction, SelectActionWithEmployee
from databases.extensions.auth import UserLoginModule
from sqlalchemy import (
String,
Boolean,
TIMESTAMP,
ForeignKey,
func,
Numeric,
Index,
BigInteger,
Integer,
Boolean,
ForeignKey,
Index,
TIMESTAMP,
func,
Text,
BigInteger,
Numeric,
or_,
)
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 (
UsersTokensLanguageModel,
UsersLanguageModel,
PeopleLanguageModel,
RelationshipDutyPeopleLanguageModel,
RelationshipEmployee2PostCodeLanguageModel,
AddressPostcodeLanguageModel,
AddressesLanguageModel,
AddressGeographicLocationsLanguageModel,
AddressCountryLanguageModel,
AddressStateLanguageModel,
AddressCityLanguageModel,
AddressDistrictLanguageModel,
AddressLocalityLanguageModel,
AddressNeighborhoodLanguageModel,
AddressStreetLanguageModel,
OccupantTypesLanguageModel,
ContractsLanguageModel,
)
class UsersTokens(CrudCollection):
__tablename__ = "users_tokens"
__exclude__fields__ = []
__language_model__ = UsersTokensLanguageModel
user_id: Mapped[int] = mapped_column(ForeignKey("users.id"), nullable=False)
@@ -56,6 +75,7 @@ class Users(CrudCollection, UserLoginModule, SelectAction):
"expiry_begins",
"related_company",
]
__language_model__ = UsersLanguageModel
user_tag: Mapped[str] = mapped_column(
String(64), server_default="", comment="Unique tag for the user", index=True
@@ -85,10 +105,10 @@ class Users(CrudCollection, UserLoginModule, SelectAction):
Boolean, server_default="0", comment="Flag to remember user login"
)
password_expires_day: Mapped[str] = mapped_column(
password_expires_day: Mapped[int] = mapped_column(
"expires_day",
String,
server_default=str(Auth.PASSWORD_EXPIRE_DAY),
Integer,
server_default=str(Auth.PASSWORD_EXPIRE_DAY.days),
comment="Password expires in days",
)
password_expiry_begins: Mapped[TIMESTAMP] = mapped_column(
@@ -233,6 +253,7 @@ class RelationshipDutyPeople(CrudCollection):
__tablename__ = "relationship_duty_people"
__exclude__fields__ = []
__access_by__ = RelationAccess.SuperAccessList
__language_model__ = RelationshipDutyPeopleLanguageModel
company_id: Mapped[int] = mapped_column(
ForeignKey("companies.id"), nullable=False
@@ -285,6 +306,7 @@ class People(CrudCollection, SelectAction):
"birth_date",
"tax_no",
]
__language_model__ = PeopleLanguageModel
firstname: Mapped[str] = mapped_column(
String, nullable=False, comment="First name of the person"
@@ -395,6 +417,7 @@ class RelationshipEmployee2PostCode(CrudCollection):
__tablename__ = "relationship_employee2postcode"
__exclude__fields__ = []
__include__fields__ = []
__language_model__ = RelationshipEmployee2PostCodeLanguageModel
company_id: Mapped[int] = mapped_column(
ForeignKey("companies.id"), nullable=True
@@ -421,6 +444,7 @@ class AddressPostcode(CrudCollection, SelectActionWithEmployee):
__exclude__fields__ = []
__access_by__ = []
__many__table__ = RelationshipEmployee2PostCode
__language_model__ = AddressPostcodeLanguageModel
street_id: Mapped[int] = mapped_column(ForeignKey("address_street.id"))
street_uu_id: Mapped[str] = mapped_column(
@@ -440,6 +464,7 @@ class Addresses(CrudCollection):
__tablename__ = "addresses"
__exclude__fields__ = []
__language_model__ = AddressesLanguageModel
build_number: Mapped[str] = mapped_column(
String(24), nullable=False, comment="Build Number"
@@ -537,6 +562,7 @@ class AddressGeographicLocations(CrudCollection):
__tablename__ = "address_geographic_locations"
__exclude__fields__ = []
__language_model__ = AddressGeographicLocationsLanguageModel
geo_table: Mapped[str] = mapped_column(
String, nullable=False, comment="Address Table Name"
@@ -588,6 +614,7 @@ class AddressCountry(CrudCollection):
__tablename__ = "address_country"
__exclude__fields__ = []
__language_model__ = AddressCountryLanguageModel
country_code: Mapped[str] = mapped_column(
String(16), nullable=False, comment="Country Code"
@@ -619,6 +646,7 @@ class AddressState(CrudCollection):
__tablename__ = "address_state"
__exclude__fields__ = []
__language_model__ = AddressStateLanguageModel
state_code: Mapped[str] = mapped_column(
String(16), nullable=False, comment="State Code"
@@ -662,6 +690,7 @@ class AddressCity(CrudCollection):
__tablename__ = "address_city"
__exclude__fields__ = []
__language_model__ = AddressCityLanguageModel
city_code: Mapped[str] = mapped_column(
String(24), nullable=False, comment="City Code"
@@ -703,6 +732,7 @@ class AddressDistrict(CrudCollection):
__tablename__ = "address_district"
__exclude__fields__ = []
__language_model__ = AddressDistrictLanguageModel
district_code: Mapped[str] = mapped_column(
String(16), nullable=False, comment="District Code"
@@ -745,6 +775,7 @@ class AddressLocality(CrudCollection):
__tablename__ = "address_locality"
__exclude__fields__ = []
__language_model__ = AddressLocalityLanguageModel
locality_code: Mapped[str] = mapped_column(
String(16), nullable=False, comment="Locality Code"
@@ -789,6 +820,7 @@ class AddressNeighborhood(CrudCollection):
__tablename__ = "address_neighborhood"
__exclude__fields__ = []
__language_model__ = AddressNeighborhoodLanguageModel
neighborhood_code: Mapped[str] = mapped_column(
String(16), nullable=False, comment="Neighborhood Code"
@@ -839,6 +871,7 @@ class AddressStreet(CrudCollection):
__tablename__ = "address_street"
__exclude__fields__ = []
__language_model__ = AddressStreetLanguageModel
street_code: Mapped[str] = mapped_column(
String(16), nullable=False, comment="Street Code"
@@ -940,6 +973,7 @@ class OccupantTypes(CrudCollection):
__tablename__ = "occupant_types"
__exclude__fields__ = []
__language_model__ = OccupantTypesLanguageModel
occupant_type: Mapped[str] = mapped_column(
String, nullable=False, comment="Occupant Type"
@@ -971,6 +1005,7 @@ class Contracts(CrudCollection):
__tablename__ = "contracts"
__exclude__fields__ = []
__language_model__ = ContractsLanguageModel
contract_type: Mapped[str] = mapped_column(
String(5),
@@ -1021,49 +1056,3 @@ class Contracts(CrudCollection):
Index("_contract_ndx_01", contract_code, unique=True),
{"comment": "Contract Information"},
)
# def selected_employee_and_duty_details(self, selected_duty_uu_id):
# from database_sql_models import (
# Companies,
# Employees,
# Duties,
# Departments,
# )
#
# found_person = People.find_one(id=self.person_id)
# found_employee = Employees.find_one(
# people_id=found_person.id, is_confirmed=True
# )
# found_duty = Duties.find_one(uu_id=selected_duty_uu_id)
# found_department = Departments.find_one(id=found_duty.department_id)
# found_company = Companies.find_one(id=found_department.company_id)
# return {
# "duty_list": {
# "duty_id": found_duty.id,
# "duty_uu_id": found_duty.uu_id.__str__(),
# "duty_code": found_duty.duty_code,
# "duty_name": found_duty.duty_name,
# "duty_description": found_duty.duty_description,
# },
# "employee_list": {
# "employee_id": found_employee.id,
# "employee_uu_id": found_employee.uu_id.__str__(),
# "people_id": found_employee.people_id,
# "duty_id": found_employee.duty_id,
# "employee_description": found_employee.employee_description,
# },
# "department_list": {
# "department_id": found_department.id,
# "department_uu_id": found_department.uu_id.__str__(),
# "company_id": found_department.company_id,
# "department_name": found_department.department_name,
# "department_description": found_department.department_description,
# },
# "companies_list": {
# "company_id": found_company.id,
# "company_uu_id": found_company.uu_id.__str__(),
# "formal_name": found_company.formal_name,
# "company_tag": found_company.company_tag,
# },
# }