mongo updated
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
from datetime import timedelta
|
||||
from typing import Optional, List
|
||||
|
||||
from fastapi import HTTPException
|
||||
from sqlalchemy import (
|
||||
@@ -106,13 +105,11 @@ class Users(CrudCollection, UserLoginModule, SelectAction):
|
||||
)
|
||||
|
||||
password_expires_day: Mapped[int] = mapped_column(
|
||||
"expires_day",
|
||||
Integer,
|
||||
server_default=str(Auth.PASSWORD_EXPIRE_DAY.days),
|
||||
comment="Password expires in days",
|
||||
)
|
||||
password_expiry_begins: Mapped[TIMESTAMP] = mapped_column(
|
||||
"expiry_begins",
|
||||
TIMESTAMP(timezone=True),
|
||||
server_default=func.now(),
|
||||
comment="Timestamp when password expiry begins",
|
||||
@@ -243,9 +240,15 @@ class Users(CrudCollection, UserLoginModule, SelectAction):
|
||||
|
||||
query_engine = MongoQueryIdentity(company_uuid=self.related_company)
|
||||
domain_via_user = query_engine.get_domain_via_user(user_uu_id=str(self.uu_id))
|
||||
if not domain_via_user:
|
||||
raise HTTPException(
|
||||
status_code=401,
|
||||
detail="Domain not found. Please contact the admin.",
|
||||
)
|
||||
domain_via_user = domain_via_user[0]
|
||||
if get_main_domain:
|
||||
return domain_via_user.get("main_domain")
|
||||
return domain_via_user.get("other_domains_list")
|
||||
return domain_via_user.get("main_domain", None)
|
||||
return domain_via_user.get("other_domains_list", None)
|
||||
|
||||
|
||||
class RelationshipDutyPeople(CrudCollection):
|
||||
|
||||
Reference in New Issue
Block a user