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)
This commit is contained in:
Brody Wang 2024-10-25 18:39:09 +08:00 committed by GitHub
parent d78f215caa
commit 391b950be6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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)
return server_error_response(e)