|
|
|
|
@ -36,7 +36,7 @@ class UsersTokens(CrudCollection):
|
|
|
|
|
token_type: Mapped[str] = mapped_column(String(16), server_default="RememberMe")
|
|
|
|
|
token: Mapped[str] = mapped_column(String, server_default="")
|
|
|
|
|
domain: Mapped[str] = mapped_column(String, server_default="")
|
|
|
|
|
expires_at = mapped_column(
|
|
|
|
|
expires_at: Mapped[TIMESTAMP] = mapped_column(
|
|
|
|
|
TIMESTAMP, default=str(system_arrow.shift(date=system_arrow.now(), days=3))
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ -56,16 +56,16 @@ class Users(CrudCollection, UserLoginModule, SelectAction):
|
|
|
|
|
"related_company",
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
user_tag = mapped_column(
|
|
|
|
|
user_tag: Mapped[str] = mapped_column(
|
|
|
|
|
String(64), server_default="", comment="Unique tag for the user", index=True
|
|
|
|
|
)
|
|
|
|
|
email = mapped_column(
|
|
|
|
|
email: Mapped[str] = mapped_column(
|
|
|
|
|
String(128), server_default="", comment="Email address of the user", index=True
|
|
|
|
|
)
|
|
|
|
|
phone_number = mapped_column(
|
|
|
|
|
phone_number: Mapped[str] = mapped_column(
|
|
|
|
|
String, server_default="", comment="Phone number of the user", index=True
|
|
|
|
|
)
|
|
|
|
|
via = mapped_column(
|
|
|
|
|
via: Mapped[str] = mapped_column(
|
|
|
|
|
String,
|
|
|
|
|
server_default="111",
|
|
|
|
|
comment="Email 1/ Phone 2/ User Tag 3 All 111 Only 100",
|
|
|
|
|
@ -84,13 +84,13 @@ class Users(CrudCollection, UserLoginModule, SelectAction):
|
|
|
|
|
Boolean, server_default="0", comment="Flag to remember user login"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
password_expires_day = mapped_column(
|
|
|
|
|
password_expires_day: Mapped[str] = mapped_column(
|
|
|
|
|
"expires_day",
|
|
|
|
|
String,
|
|
|
|
|
server_default=str(Auth.PASSWORD_EXPIRE_DAY),
|
|
|
|
|
comment="Password expires in days",
|
|
|
|
|
)
|
|
|
|
|
password_expiry_begins = mapped_column(
|
|
|
|
|
password_expiry_begins: Mapped[TIMESTAMP] = mapped_column(
|
|
|
|
|
"expiry_begins",
|
|
|
|
|
TIMESTAMP,
|
|
|
|
|
server_default=func.now(),
|
|
|
|
|
@ -98,10 +98,10 @@ class Users(CrudCollection, UserLoginModule, SelectAction):
|
|
|
|
|
)
|
|
|
|
|
related_company: Mapped[str] = mapped_column(String, comment="Related Company UUID")
|
|
|
|
|
|
|
|
|
|
person_id = mapped_column(
|
|
|
|
|
person_id: Mapped[int] = mapped_column(
|
|
|
|
|
ForeignKey("people.id"), nullable=False, comment="Foreign key to person table"
|
|
|
|
|
)
|
|
|
|
|
person_uu_id = mapped_column(
|
|
|
|
|
person_uu_id: Mapped[str] = mapped_column(
|
|
|
|
|
String, server_default="", comment="Person UUID", index=True
|
|
|
|
|
)
|
|
|
|
|
person = relationship("People", back_populates="user", foreign_keys=[person_id])
|
|
|
|
|
@ -177,7 +177,10 @@ class Users(CrudCollection, UserLoginModule, SelectAction):
|
|
|
|
|
def get_employee_and_duty_details(self):
|
|
|
|
|
from databases import Employees, Duties
|
|
|
|
|
|
|
|
|
|
found_person = People.find_one(id=self.person_id)
|
|
|
|
|
found_person = People.filter_one(
|
|
|
|
|
People.id==self.person_id,
|
|
|
|
|
*People.valid_record_args(People),
|
|
|
|
|
)
|
|
|
|
|
found_employees = Employees.filter_by_active(
|
|
|
|
|
people_id=found_person.id, is_confirmed=True
|
|
|
|
|
)
|
|
|
|
|
@ -228,14 +231,14 @@ class RelationshipDutyPeople(CrudCollection):
|
|
|
|
|
company_id: Mapped[int] = mapped_column(
|
|
|
|
|
ForeignKey("companies.id"), nullable=False
|
|
|
|
|
) # 1, 2, 3
|
|
|
|
|
duties_id = mapped_column(
|
|
|
|
|
duties_id: Mapped[int] = mapped_column(
|
|
|
|
|
ForeignKey("duties.id"), nullable=False
|
|
|
|
|
) # duty -> (n)person Evyos LTD
|
|
|
|
|
member_id: Mapped[int] = mapped_column(
|
|
|
|
|
ForeignKey("people.id"), nullable=False
|
|
|
|
|
) # 2, 3, 4
|
|
|
|
|
|
|
|
|
|
relationship_type = mapped_column(
|
|
|
|
|
relationship_type: Mapped[str] = mapped_column(
|
|
|
|
|
String, nullable=True, server_default="Employee"
|
|
|
|
|
) # Commercial
|
|
|
|
|
show_only: Mapped[bool] = mapped_column(Boolean, server_default="0")
|
|
|
|
|
@ -312,7 +315,7 @@ class People(CrudCollection, SelectAction):
|
|
|
|
|
birth_place: Mapped[str] = mapped_column(
|
|
|
|
|
String, server_default="", comment="Birth place of the person"
|
|
|
|
|
)
|
|
|
|
|
birth_date = mapped_column(
|
|
|
|
|
birth_date: Mapped[TIMESTAMP] = mapped_column(
|
|
|
|
|
TIMESTAMP, server_default="1900-01-01", comment="Birth date of the person"
|
|
|
|
|
)
|
|
|
|
|
tax_no: Mapped[str] = mapped_column(
|
|
|
|
|
@ -391,7 +394,7 @@ class RelationshipEmployee2PostCode(CrudCollection):
|
|
|
|
|
ForeignKey("address_postcode.id"), nullable=False
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
relationship_type = mapped_column(
|
|
|
|
|
relationship_type: Mapped[str] = mapped_column(
|
|
|
|
|
String, nullable=True, server_default="Employee"
|
|
|
|
|
) # Commercial
|
|
|
|
|
show_only: Mapped[bool] = mapped_column(Boolean, server_default="0")
|
|
|
|
|
@ -410,8 +413,8 @@ class AddressPostcode(CrudCollection, SelectActionWithEmployee):
|
|
|
|
|
__many__table__ = RelationshipEmployee2PostCode
|
|
|
|
|
|
|
|
|
|
street_id: Mapped[int] = mapped_column(ForeignKey("address_street.id"))
|
|
|
|
|
street_uu_id = mapped_column(String, server_default="", comment="Street UUID")
|
|
|
|
|
postcode = mapped_column(String(32), nullable=False, comment="Postcode")
|
|
|
|
|
street_uu_id: Mapped[str] = mapped_column(String, server_default="", comment="Street UUID")
|
|
|
|
|
postcode: Mapped[str] = mapped_column(String(32), nullable=False, comment="Postcode")
|
|
|
|
|
|
|
|
|
|
__table_args__ = ({"comment": "Postcode Information"},)
|
|
|
|
|
|
|
|
|
|
@ -450,10 +453,10 @@ class Addresses(CrudCollection):
|
|
|
|
|
street_id: Mapped[int] = mapped_column(
|
|
|
|
|
ForeignKey("address_street.id"), nullable=False
|
|
|
|
|
)
|
|
|
|
|
street_uu_id = mapped_column(String, server_default="", comment="Street UUID")
|
|
|
|
|
street_uu_id: Mapped[str] = mapped_column(String, server_default="", comment="Street UUID")
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def list_via_employee(cls, token_dict, filter_expr):
|
|
|
|
|
def list_via_employee(cls, token_dict, filter_expr = None):
|
|
|
|
|
post_code_list = RelationshipEmployee2PostCode.filter_all(
|
|
|
|
|
RelationshipEmployee2PostCode.employee_id
|
|
|
|
|
== token_dict.selected_company.employee_id,
|
|
|
|
|
@ -470,7 +473,7 @@ class Addresses(CrudCollection):
|
|
|
|
|
cls.pre_query = cls.filter_all(
|
|
|
|
|
cls.post_code_id.in_(post_code_id_list), cls.valid_record_args(cls)
|
|
|
|
|
).query
|
|
|
|
|
filter_cls = cls.filter_all(*filter_expr)
|
|
|
|
|
filter_cls = cls.filter_all(*filter_expr or [])
|
|
|
|
|
cls.pre_query = None
|
|
|
|
|
return filter_cls.data
|
|
|
|
|
|
|
|
|
|
@ -524,28 +527,28 @@ class AddressGeographicLocations(CrudCollection):
|
|
|
|
|
__tablename__ = "address_geographic_locations"
|
|
|
|
|
__exclude__fields__ = []
|
|
|
|
|
|
|
|
|
|
geo_table = mapped_column(String, nullable=False, comment="Address Table Name")
|
|
|
|
|
geo_id = mapped_column(Integer, nullable=False, comment="Address Table ID")
|
|
|
|
|
geo_name = mapped_column(String, nullable=False, comment="Geographic Location Name")
|
|
|
|
|
geo_latitude = mapped_column(
|
|
|
|
|
geo_table: Mapped[str] = mapped_column(String, nullable=False, comment="Address Table Name")
|
|
|
|
|
geo_id: Mapped[int] = mapped_column(Integer, nullable=False, comment="Address Table ID")
|
|
|
|
|
geo_name: Mapped[str] = mapped_column(String, nullable=False, comment="Geographic Location Name")
|
|
|
|
|
geo_latitude: Mapped[float] = mapped_column(
|
|
|
|
|
Numeric(20, 6), server_default="0", comment="Geographic Location Name"
|
|
|
|
|
)
|
|
|
|
|
geo_longitude = mapped_column(
|
|
|
|
|
geo_longitude: Mapped[float] = mapped_column(
|
|
|
|
|
Numeric(20, 6), server_default="0", comment="Geographic Location Latitude"
|
|
|
|
|
)
|
|
|
|
|
geo_altitude = mapped_column(
|
|
|
|
|
geo_altitude: Mapped[float] = mapped_column(
|
|
|
|
|
Numeric(20, 6), server_default="0", comment="Geographic Location Longitude"
|
|
|
|
|
)
|
|
|
|
|
geo_description = mapped_column(
|
|
|
|
|
geo_description: Mapped[str] = mapped_column(
|
|
|
|
|
Text, nullable=False, comment="Geographic Location Description"
|
|
|
|
|
)
|
|
|
|
|
geo_area_size = mapped_column(
|
|
|
|
|
geo_area_size: Mapped[float] = mapped_column(
|
|
|
|
|
Numeric(20, 2),
|
|
|
|
|
nullable=True,
|
|
|
|
|
server_default="0",
|
|
|
|
|
comment="Geographic Location Area Size",
|
|
|
|
|
)
|
|
|
|
|
geo_population = mapped_column(
|
|
|
|
|
geo_population: Mapped[int] = mapped_column(
|
|
|
|
|
BigInteger, nullable=True, comment="Geographic Location Population"
|
|
|
|
|
)
|
|
|
|
|
# geo_geom_point = mapped_column(Geometry('POINT', srid=4326), nullable=True, comment="Geographic Location Points")
|
|
|
|
|
@ -569,11 +572,11 @@ class AddressCountry(CrudCollection):
|
|
|
|
|
__tablename__ = "address_country"
|
|
|
|
|
__exclude__fields__ = []
|
|
|
|
|
|
|
|
|
|
country_code = mapped_column(String(16), nullable=False, comment="Country Code")
|
|
|
|
|
country_name = mapped_column(String, nullable=False, comment="Country Name")
|
|
|
|
|
money_code = mapped_column(String(12), nullable=True, comment="Money Code")
|
|
|
|
|
language = mapped_column(String, nullable=True, comment="Language Code")
|
|
|
|
|
address_geographic_id = mapped_column(
|
|
|
|
|
country_code: Mapped[str] = mapped_column(String(16), nullable=False, comment="Country Code")
|
|
|
|
|
country_name: Mapped[str] = mapped_column(String, nullable=False, comment="Country Name")
|
|
|
|
|
money_code: Mapped[str] = mapped_column(String(12), nullable=True, comment="Money Code")
|
|
|
|
|
language: Mapped[str] = mapped_column(String, nullable=True, comment="Language Code")
|
|
|
|
|
address_geographic_id: Mapped[int] = mapped_column(
|
|
|
|
|
BigInteger, nullable=True, comment="Address Geographic Id"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ -592,17 +595,17 @@ class AddressState(CrudCollection):
|
|
|
|
|
__tablename__ = "address_state"
|
|
|
|
|
__exclude__fields__ = []
|
|
|
|
|
|
|
|
|
|
state_code = mapped_column(String(16), nullable=False, comment="State Code")
|
|
|
|
|
state_name = mapped_column(String, nullable=False, comment="State Name")
|
|
|
|
|
licence_plate = mapped_column(String(24), nullable=True, comment="Sign Code")
|
|
|
|
|
phone_code = mapped_column(String(36), nullable=True, comment="Phone Code")
|
|
|
|
|
gov_code = mapped_column(String(128), nullable=True, comment="Government Code")
|
|
|
|
|
address_geographic_id = mapped_column(
|
|
|
|
|
state_code: Mapped[str] = mapped_column(String(16), nullable=False, comment="State Code")
|
|
|
|
|
state_name: Mapped[str] = mapped_column(String, nullable=False, comment="State Name")
|
|
|
|
|
licence_plate: Mapped[str] = mapped_column(String(24), nullable=True, comment="Sign Code")
|
|
|
|
|
phone_code: Mapped[str] = mapped_column(String(36), nullable=True, comment="Phone Code")
|
|
|
|
|
gov_code: Mapped[str] = mapped_column(String(128), nullable=True, comment="Government Code")
|
|
|
|
|
address_geographic_id: Mapped[int] = mapped_column(
|
|
|
|
|
BigInteger, nullable=True, comment="Address Geographic Id"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
country_id: Mapped[int] = mapped_column(ForeignKey("address_country.id"))
|
|
|
|
|
country_uu_id = mapped_column(String, server_default="", comment="Country UUID")
|
|
|
|
|
country_uu_id: Mapped[str] = mapped_column(String, server_default="", comment="Country UUID")
|
|
|
|
|
|
|
|
|
|
__table_args__ = (
|
|
|
|
|
Index(
|
|
|
|
|
@ -623,17 +626,17 @@ class AddressCity(CrudCollection):
|
|
|
|
|
__tablename__ = "address_city"
|
|
|
|
|
__exclude__fields__ = []
|
|
|
|
|
|
|
|
|
|
city_code = mapped_column(String(24), nullable=False, comment="City Code")
|
|
|
|
|
city_name = mapped_column(String, nullable=False, comment="City Name")
|
|
|
|
|
licence_plate = mapped_column(String(24), nullable=True, comment="Sign Code")
|
|
|
|
|
phone_code = mapped_column(String(36), nullable=True, comment="Phone Code")
|
|
|
|
|
gov_code = mapped_column(String(128), nullable=True, comment="Government Code")
|
|
|
|
|
address_geographic_id = mapped_column(
|
|
|
|
|
city_code: Mapped[str] = mapped_column(String(24), nullable=False, comment="City Code")
|
|
|
|
|
city_name: Mapped[str] = mapped_column(String, nullable=False, comment="City Name")
|
|
|
|
|
licence_plate: Mapped[str] = mapped_column(String(24), nullable=True, comment="Sign Code")
|
|
|
|
|
phone_code: Mapped[str] = mapped_column(String(36), nullable=True, comment="Phone Code")
|
|
|
|
|
gov_code: Mapped[str] = mapped_column(String(128), nullable=True, comment="Government Code")
|
|
|
|
|
address_geographic_id: Mapped[int] = mapped_column(
|
|
|
|
|
BigInteger, nullable=True, comment="Address Geographic Id"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
state_id: Mapped[int] = mapped_column(ForeignKey("address_state.id"))
|
|
|
|
|
state_uu_id = mapped_column(String, server_default="", comment="State UUID")
|
|
|
|
|
state_uu_id: Mapped[str] = mapped_column(String, server_default="", comment="State UUID")
|
|
|
|
|
|
|
|
|
|
__table_args__ = (
|
|
|
|
|
Index(
|
|
|
|
|
@ -654,18 +657,18 @@ class AddressDistrict(CrudCollection):
|
|
|
|
|
__tablename__ = "address_district"
|
|
|
|
|
__exclude__fields__ = []
|
|
|
|
|
|
|
|
|
|
district_code = mapped_column(String(16), nullable=False, comment="District Code")
|
|
|
|
|
district_name = mapped_column(String, nullable=False, comment="District Name")
|
|
|
|
|
phone_code = mapped_column(String(36), nullable=True, comment="Phone Code")
|
|
|
|
|
gov_code = mapped_column(String(128), nullable=True, comment="Government Code")
|
|
|
|
|
address_geographic_id = mapped_column(
|
|
|
|
|
district_code: Mapped[str] = mapped_column(String(16), nullable=False, comment="District Code")
|
|
|
|
|
district_name: Mapped[str] = mapped_column(String, nullable=False, comment="District Name")
|
|
|
|
|
phone_code: Mapped[str] = mapped_column(String(36), nullable=True, comment="Phone Code")
|
|
|
|
|
gov_code: Mapped[str] = mapped_column(String(128), nullable=True, comment="Government Code")
|
|
|
|
|
address_geographic_id: Mapped[int] = mapped_column(
|
|
|
|
|
BigInteger, nullable=True, comment="Address Geographic Id"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
city_id = mapped_column(
|
|
|
|
|
city_id: Mapped[int] = mapped_column(
|
|
|
|
|
ForeignKey("address_city.id"), nullable=False, comment="City ID"
|
|
|
|
|
)
|
|
|
|
|
city_uu_id = mapped_column(String, server_default="", comment="City UUID")
|
|
|
|
|
city_uu_id: Mapped[str] = mapped_column(String, server_default="", comment="City UUID")
|
|
|
|
|
|
|
|
|
|
__table_args__ = (
|
|
|
|
|
Index(
|
|
|
|
|
@ -686,20 +689,20 @@ class AddressLocality(CrudCollection):
|
|
|
|
|
__tablename__ = "address_locality"
|
|
|
|
|
__exclude__fields__ = []
|
|
|
|
|
|
|
|
|
|
locality_code = mapped_column(String(16), nullable=False, comment="Locality Code")
|
|
|
|
|
locality_name = mapped_column(String, nullable=False, comment="Locality Name")
|
|
|
|
|
type_code = mapped_column(String, nullable=True, comment="Type Name")
|
|
|
|
|
type_description = mapped_column(String, nullable=True, comment="Type Name")
|
|
|
|
|
gov_code = mapped_column(String(128), nullable=True, comment="Government Code")
|
|
|
|
|
locality_code: Mapped[str] = mapped_column(String(16), nullable=False, comment="Locality Code")
|
|
|
|
|
locality_name: Mapped[str] = mapped_column(String, nullable=False, comment="Locality Name")
|
|
|
|
|
type_code: Mapped[str] = mapped_column(String, nullable=True, comment="Type Name")
|
|
|
|
|
type_description: Mapped[str] = mapped_column(String, nullable=True, comment="Type Name")
|
|
|
|
|
gov_code: Mapped[str] = mapped_column(String(128), nullable=True, comment="Government Code")
|
|
|
|
|
address_show: Mapped[bool] = mapped_column(Boolean, server_default="1")
|
|
|
|
|
address_geographic_id = mapped_column(
|
|
|
|
|
address_geographic_id: Mapped[int] = mapped_column(
|
|
|
|
|
BigInteger, nullable=True, comment="Address Geographic Id"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
district_id = mapped_column(
|
|
|
|
|
district_id: Mapped[int] = mapped_column(
|
|
|
|
|
ForeignKey("address_district.id"), nullable=False, comment="District ID"
|
|
|
|
|
)
|
|
|
|
|
district_uu_id = mapped_column(String, server_default="", comment="District UUID")
|
|
|
|
|
district_uu_id: Mapped[str] = mapped_column(String, server_default="", comment="District UUID")
|
|
|
|
|
|
|
|
|
|
__table_args__ = (
|
|
|
|
|
Index(
|
|
|
|
|
@ -720,28 +723,28 @@ class AddressNeighborhood(CrudCollection):
|
|
|
|
|
__tablename__ = "address_neighborhood"
|
|
|
|
|
__exclude__fields__ = []
|
|
|
|
|
|
|
|
|
|
neighborhood_code = mapped_column(
|
|
|
|
|
neighborhood_code: Mapped[str] = mapped_column(
|
|
|
|
|
String(16), nullable=False, comment="Neighborhood Code"
|
|
|
|
|
)
|
|
|
|
|
neighborhood_name = mapped_column(
|
|
|
|
|
neighborhood_name: Mapped[str] = mapped_column(
|
|
|
|
|
String, nullable=False, comment="Neighborhood Name"
|
|
|
|
|
)
|
|
|
|
|
type_code = mapped_column(String, nullable=True, comment="Type Name")
|
|
|
|
|
type_description = mapped_column(String, nullable=True, comment="Type Name")
|
|
|
|
|
gov_code = mapped_column(String(128), nullable=True, comment="Government Code")
|
|
|
|
|
type_code: Mapped[str] = mapped_column(String, nullable=True, comment="Type Name")
|
|
|
|
|
type_description: Mapped[str] = mapped_column(String, nullable=True, comment="Type Name")
|
|
|
|
|
gov_code: Mapped[str] = mapped_column(String(128), nullable=True, comment="Government Code")
|
|
|
|
|
address_show: Mapped[bool] = mapped_column(Boolean, server_default="1")
|
|
|
|
|
address_geographic_id = mapped_column(
|
|
|
|
|
address_geographic_id: Mapped[int] = mapped_column(
|
|
|
|
|
BigInteger, nullable=True, comment="Address Geographic Id"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
district_id = mapped_column(
|
|
|
|
|
district_id: Mapped[int] = mapped_column(
|
|
|
|
|
ForeignKey("address_district.id"), nullable=True, comment="District ID"
|
|
|
|
|
)
|
|
|
|
|
district_uu_id = mapped_column(String, server_default="", comment="District UUID")
|
|
|
|
|
locality_id = mapped_column(
|
|
|
|
|
district_uu_id: Mapped[str] = mapped_column(String, server_default="", comment="District UUID")
|
|
|
|
|
locality_id: Mapped[int] = mapped_column(
|
|
|
|
|
ForeignKey("address_locality.id"), nullable=True, comment="Locality ID"
|
|
|
|
|
)
|
|
|
|
|
locality_uu_id = mapped_column(String, server_default="", comment="Locality UUID")
|
|
|
|
|
locality_uu_id: Mapped[str] = mapped_column(String, server_default="", comment="Locality UUID")
|
|
|
|
|
|
|
|
|
|
__table_args__ = (
|
|
|
|
|
Index(
|
|
|
|
|
@ -762,19 +765,19 @@ class AddressStreet(CrudCollection):
|
|
|
|
|
__tablename__ = "address_street"
|
|
|
|
|
__exclude__fields__ = []
|
|
|
|
|
|
|
|
|
|
street_code = mapped_column(String(16), nullable=False, comment="Street Code")
|
|
|
|
|
street_name = mapped_column(String, nullable=False, comment="Street Name")
|
|
|
|
|
type_code = mapped_column(String, nullable=True, comment="Type Name")
|
|
|
|
|
type_description = mapped_column(String, nullable=True, comment="Type Name")
|
|
|
|
|
gov_code = mapped_column(String(128), nullable=True, comment="Government Code")
|
|
|
|
|
street_code: Mapped[str] = mapped_column(String(16), nullable=False, comment="Street Code")
|
|
|
|
|
street_name: Mapped[str] = mapped_column(String, nullable=False, comment="Street Name")
|
|
|
|
|
type_code: Mapped[str] = mapped_column(String, nullable=True, comment="Type Name")
|
|
|
|
|
type_description: Mapped[str] = mapped_column(String, nullable=True, comment="Type Name")
|
|
|
|
|
gov_code: Mapped[str] = mapped_column(String(128), nullable=True, comment="Government Code")
|
|
|
|
|
|
|
|
|
|
address_geographic_id = mapped_column(
|
|
|
|
|
address_geographic_id: Mapped[int] = mapped_column(
|
|
|
|
|
BigInteger, nullable=True, comment="Address Geographic Id"
|
|
|
|
|
)
|
|
|
|
|
neighborhood_id = mapped_column(
|
|
|
|
|
neighborhood_id: Mapped[int] = mapped_column(
|
|
|
|
|
ForeignKey("address_neighborhood.id"), nullable=False, comment="Neighborhood ID"
|
|
|
|
|
)
|
|
|
|
|
neighborhood_uu_id = mapped_column(
|
|
|
|
|
neighborhood_uu_id: Mapped[str] = mapped_column(
|
|
|
|
|
String, server_default="", comment="Neighborhood UUID"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
@ -855,11 +858,11 @@ class OccupantTypes(CrudCollection):
|
|
|
|
|
__tablename__ = "occupant_types"
|
|
|
|
|
__exclude__fields__ = []
|
|
|
|
|
|
|
|
|
|
occupant_type = mapped_column(String, nullable=False, comment="Occupant Type")
|
|
|
|
|
occupant_description = mapped_column(String, server_default="")
|
|
|
|
|
occupant_code = mapped_column(String, server_default="")
|
|
|
|
|
occupant_category = mapped_column(String, server_default="")
|
|
|
|
|
occupant_category_type = mapped_column(String, server_default="")
|
|
|
|
|
occupant_type: Mapped[str] = mapped_column(String, nullable=False, comment="Occupant Type")
|
|
|
|
|
occupant_description: Mapped[str] = mapped_column(String, server_default="")
|
|
|
|
|
occupant_code: Mapped[str] = mapped_column(String, server_default="")
|
|
|
|
|
occupant_category: Mapped[str] = mapped_column(String, server_default="")
|
|
|
|
|
occupant_category_type: Mapped[str] = mapped_column(String, server_default="")
|
|
|
|
|
occupant_is_unique: Mapped[bool] = mapped_column(Boolean, server_default="0")
|
|
|
|
|
|
|
|
|
|
__table_args__ = ({"comment": "Occupant Types Information"},)
|
|
|
|
|
@ -884,39 +887,39 @@ class Contracts(CrudCollection):
|
|
|
|
|
__tablename__ = "contracts"
|
|
|
|
|
__exclude__fields__ = []
|
|
|
|
|
|
|
|
|
|
contract_type = mapped_column(
|
|
|
|
|
contract_type: Mapped[str] = mapped_column(
|
|
|
|
|
String(5),
|
|
|
|
|
nullable=False,
|
|
|
|
|
comment="The code for personnel is P and the code for companies is C.",
|
|
|
|
|
)
|
|
|
|
|
contract_title = mapped_column(String(255))
|
|
|
|
|
contract_details = mapped_column(Text)
|
|
|
|
|
contract_terms = mapped_column(Text)
|
|
|
|
|
contract_title: Mapped[str] = mapped_column(String(255))
|
|
|
|
|
contract_details: Mapped[str] = mapped_column(Text)
|
|
|
|
|
contract_terms: Mapped[str] = mapped_column(Text)
|
|
|
|
|
|
|
|
|
|
contract_code = mapped_column(
|
|
|
|
|
contract_code: Mapped[str] = mapped_column(
|
|
|
|
|
String(100),
|
|
|
|
|
nullable=False,
|
|
|
|
|
comment="contract_code is the unique code given by the system.",
|
|
|
|
|
)
|
|
|
|
|
contract_date = mapped_column(
|
|
|
|
|
contract_date: Mapped[TIMESTAMP] = mapped_column(
|
|
|
|
|
TIMESTAMP,
|
|
|
|
|
server_default="2099-12-31 23:59:59",
|
|
|
|
|
comment="contract date is the date the contract is made. "
|
|
|
|
|
"expire start is the start date of the contract, expire en is the end date of the contract.",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
company_id = mapped_column(Integer, ForeignKey("companies.id"), nullable=True)
|
|
|
|
|
company_uu_id = mapped_column(String, server_default="", comment="Company UUID")
|
|
|
|
|
company_id: Mapped[int] = mapped_column(Integer, ForeignKey("companies.id"), nullable=True)
|
|
|
|
|
company_uu_id: Mapped[str] = mapped_column(String, server_default="", comment="Company UUID")
|
|
|
|
|
|
|
|
|
|
person_id = mapped_column(Integer, ForeignKey("people.id"), nullable=True)
|
|
|
|
|
person_uu_id = mapped_column(String, server_default="", comment="Person UUID")
|
|
|
|
|
person_id: Mapped[int] = mapped_column(Integer, ForeignKey("people.id"), nullable=True)
|
|
|
|
|
person_uu_id: Mapped[str] = mapped_column(String, server_default="", comment="Person UUID")
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def retrieve_contact_no(cls):
|
|
|
|
|
import arrow
|
|
|
|
|
# from api_library.date_time_actions.date_functions import system_arrow
|
|
|
|
|
|
|
|
|
|
# todo When create record contract_code == below string
|
|
|
|
|
related_date, counter = arrow.now(), 1
|
|
|
|
|
related_date, counter = Contracts.client_arrow.now(), 1
|
|
|
|
|
return (
|
|
|
|
|
f"{related_date.date().year}{str(cls.contract_type)}{str(counter).zfill(6)}"
|
|
|
|
|
)
|
|
|
|
|
|