From 391b950be6cb679e60716a7be90cea20ef374ae8 Mon Sep 17 00:00:00 2001 From: Brody Wang <10542356+b246wang@users.noreply.github.com> Date: Fri, 25 Oct 2024 18:39:09 +0800 Subject: [PATCH] Fix non-null violation when inviting people to team (#3015) ### What problem does this PR solve? Not sure why MySQL is inserting empty string in this case, but when I use postgres I got `null value in column "invited_by" of relation "user_tenant" violates not-null constraint` ### Type of change - [X] Bug Fix (non-breaking change which fixes an issue) --- api/apps/tenant_app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/apps/tenant_app.py b/api/apps/tenant_app.py index e852b2ca4..98992c033 100644 --- a/api/apps/tenant_app.py +++ b/api/apps/tenant_app.py @@ -57,6 +57,7 @@ def create(tenant_id): id=get_uuid(), user_id=user_id, tenant_id=tenant_id, + invited_by=current_user.id, role=UserTenantRole.INVITE, status=StatusEnum.VALID.value) @@ -95,4 +96,4 @@ def agree(tenant_id): UserTenantService.filter_update([UserTenant.tenant_id == tenant_id, UserTenant.user_id == current_user.id], {"role": UserTenantRole.NORMAL}) return get_json_result(data=True) except Exception as e: - return server_error_response(e) \ No newline at end of file + return server_error_response(e)