set domain inactive -> userdomain.active =false

This commit is contained in:
2024-11-25 18:36:21 +09:00
parent 0d825f6387
commit cc726c7f68

View File

@@ -283,6 +283,7 @@ def create_domain(db: Session, domain: schemas.DomainIn,userid:int):
tenantid = domain.tenantid,
name=domain.name,
url=domain.url,
is_active=domain.is_active,
kintoneuser=domain.kintoneuser,
kintonepwd=domain.kintonepwd,
createuserid = userid,
@@ -316,6 +317,11 @@ def edit_domain(
db_domain.tenantid = domain.tenantid
db_domain.name=domain.name
db_domain.url=domain.url
if db_domain.is_active == True and domain.is_active == False:
db_userdomains = db.query(models.UserDomain).filter(and_(models.UserDomain.domainid == db_domain.id,models.UserDomain.active == True)).all()
for userdomain in db_userdomains:
userdomain.active = False
db.add(userdomain)
db_domain.is_active=domain.is_active
db_domain.kintoneuser=domain.kintoneuser
if domain.kintonepwd != "":