feat(tenancy): add profile editing in merchant team edit modal
Some checks failed
CI / ruff (push) Successful in 16s
CI / docs (push) Has been cancelled
CI / deploy (push) Has been cancelled
CI / validate (push) Has been cancelled
CI / dependency-scanning (push) Has been cancelled
CI / pytest (push) Has been cancelled

Edit modal now has editable first_name, last_name, email fields with
a "Save Profile" button, alongside the existing per-store role management.

New:
- PUT /merchants/account/team/members/{user_id}/profile endpoint
- MerchantTeamProfileUpdate schema
- update_team_member_profile() service method with ownership validation
- 2 new i18n keys across 4 locales (personal_info, save_profile)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-29 13:31:23 +02:00
parent 211c46ebbc
commit 157b4c6ec3
9 changed files with 147 additions and 15 deletions

View File

@@ -25,7 +25,10 @@ from app.modules.tenancy.schemas import (
MerchantStoreUpdate,
)
from app.modules.tenancy.schemas.auth import UserContext
from app.modules.tenancy.schemas.team import MerchantTeamInvite
from app.modules.tenancy.schemas.team import (
MerchantTeamInvite,
MerchantTeamProfileUpdate,
)
from app.modules.tenancy.services.merchant_service import merchant_service
from app.modules.tenancy.services.merchant_store_service import merchant_store_service
@@ -252,6 +255,26 @@ async def merchant_team_invite(
)
@_account_router.put("/team/members/{user_id}/profile")
async def merchant_team_update_profile(
user_id: int,
data: MerchantTeamProfileUpdate,
current_user: UserContext = Depends(get_current_merchant_api),
merchant=Depends(get_merchant_for_current_user),
db: Session = Depends(get_db),
):
"""Update a team member's profile (first name, last name, email)."""
merchant_store_service.update_team_member_profile(
db, merchant.id, user_id, data.model_dump(exclude_unset=True)
)
db.commit()
logger.info(
f"Merchant {merchant.id} updated profile for user {user_id} "
f"by {current_user.username}"
)
return {"message": "Profile updated successfully"}
@_account_router.put("/team/stores/{store_id}/members/{user_id}")
async def merchant_team_update_role(
store_id: int,