Skip to content

Commit

Permalink
fix(organization): fix update tenant without updated_at (#1212)
Browse files Browse the repository at this point in the history
  • Loading branch information
neronkl authored Sep 4, 2023
1 parent fa9435a commit 46969ee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/bk-user/bkuser/apis/web/tenant/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ def get_data_sources(self, obj: Tenant) -> List[Dict]:

class TenantUpdateInputSLZ(serializers.Serializer):
name = serializers.CharField(help_text="租户名称")
logo = serializers.CharField(help_text="租户 Logo", required=False, default=settings.DEFAULT_TENANT_LOGO)
logo = serializers.CharField(
help_text="租户 Logo", required=False, allow_blank=True, default=settings.DEFAULT_TENANT_LOGO
)
manager_ids = serializers.ListField(child=serializers.CharField(), help_text="租户用户 ID 列表", allow_empty=False)
feature_flags = TenantFeatureFlagSLZ(help_text="租户特性集")

Expand Down
3 changes: 2 additions & 1 deletion src/bk-user/bkuser/biz/tenant.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from typing import Dict, List, Optional

from django.db import transaction
from django.utils.timezone import now
from pydantic import BaseModel

from bkuser.apps.data_source.models import (
Expand Down Expand Up @@ -307,7 +308,7 @@ def update_with_managers(tenant_id: str, tenant_info: TenantEditableBaseInfo, ma

with transaction.atomic():
# 更新基本信息
Tenant.objects.filter(id=tenant_id).update(**tenant_info.model_dump())
Tenant.objects.filter(id=tenant_id).update(updated_at=now(), **tenant_info.model_dump())

if should_deleted_manager_ids:
TenantManager.objects.filter(
Expand Down

0 comments on commit 46969ee

Please sign in to comment.