Brody Wang
commited on
Commit
·
1fa04f3
1
Parent(s):
10bca92
Fix non-null violation when inviting people to team (#3015)
Browse files### 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 +2 -1
api/apps/tenant_app.py
CHANGED
@@ -57,6 +57,7 @@ def create(tenant_id):
|
|
57 |
id=get_uuid(),
|
58 |
user_id=user_id,
|
59 |
tenant_id=tenant_id,
|
|
|
60 |
role=UserTenantRole.INVITE,
|
61 |
status=StatusEnum.VALID.value)
|
62 |
|
@@ -95,4 +96,4 @@ def agree(tenant_id):
|
|
95 |
UserTenantService.filter_update([UserTenant.tenant_id == tenant_id, UserTenant.user_id == current_user.id], {"role": UserTenantRole.NORMAL})
|
96 |
return get_json_result(data=True)
|
97 |
except Exception as e:
|
98 |
-
return server_error_response(e)
|
|
|
57 |
id=get_uuid(),
|
58 |
user_id=user_id,
|
59 |
tenant_id=tenant_id,
|
60 |
+
invited_by=current_user.id,
|
61 |
role=UserTenantRole.INVITE,
|
62 |
status=StatusEnum.VALID.value)
|
63 |
|
|
|
96 |
UserTenantService.filter_update([UserTenant.tenant_id == tenant_id, UserTenant.user_id == current_user.id], {"role": UserTenantRole.NORMAL})
|
97 |
return get_json_result(data=True)
|
98 |
except Exception as e:
|
99 |
+
return server_error_response(e)
|