feat(tenancy): add profile editing in merchant team edit modal
Some checks failed
Some checks failed
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user