fix(tenancy): fix team CRUD bugs + add member integration tests

Store team page:
- Fix undefined user_id (API returns `id`, JS used `user_id`)
- Fix wrong URL path in updateMember (remove redundant storeCode)
- Fix update_member_role route passing wrong kwarg (new_role_id → new_role_name)
- Add update_member() service method for role_id + is_active updates
- Add :selected binding for role pre-selection in edit modal

Merchant team page:
- Add missing db.commit() on invite, update, and remove endpoints
- Fix forward-reference string type annotation on MerchantTeamInvite
- Add :selected binding for role pre-selection in edit modal

Shared fixes:
- Replace removed subscription_service.check_team_limit with usage_service
- Replace removed subscription_service.get_current_tier in email service
- Fix email config bool settings crashing on .lower() (value_type=boolean)

Tests: 15 new integration tests for store team member API endpoints.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-28 21:06:21 +01:00
parent 0455e63a2e
commit 332960de30
10 changed files with 541 additions and 22 deletions

View File

@@ -194,7 +194,7 @@ function storeTeam() {
this.saving = true;
try {
await apiClient.put(
`/store/${this.storeCode}/team/members/${this.selectedMember.user_id}`,
`/store/team/members/${this.selectedMember.id}`,
this.editForm
);
@@ -228,7 +228,7 @@ function storeTeam() {
this.saving = true;
try {
await apiClient.delete(`/store/team/members/${this.selectedMember.user_id}`);
await apiClient.delete(`/store/team/members/${this.selectedMember.id}`);
Utils.showToast(I18n.t('tenancy.messages.team_member_removed'), 'success');
storeTeamLog.info('Removed team member:', this.selectedMember.user_id);