feat(tenancy): add resend invitation for pending team members
Some checks failed
CI / validate (push) Has been cancelled
CI / dependency-scanning (push) Has been cancelled
CI / docs (push) Has been cancelled
CI / deploy (push) Has been cancelled
CI / pytest (push) Has been cancelled
CI / ruff (push) Successful in 14s

New resend_invitation() service method regenerates the token and
resends the invitation email for pending members.

Available on all frontends:
- Merchant: POST /merchants/account/team/stores/{sid}/members/{uid}/resend
- Store: POST /store/team/members/{uid}/resend

UI: paper-airplane icon appears on pending members in both merchant
and store team pages.

i18n: resend_invitation + invitation_resent keys in 4 locales.
Also translated previously untranslated invitation_sent_successfully
in fr/de/lb.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-29 16:48:12 +02:00
parent dab5560de8
commit 823935c016
11 changed files with 175 additions and 3 deletions

View File

@@ -299,6 +299,26 @@ async def merchant_team_update_role(
return {"message": "Role updated successfully"}
@_account_router.post("/team/stores/{store_id}/members/{user_id}/resend")
async def merchant_team_resend_invitation(
store_id: int,
user_id: int,
current_user: UserContext = Depends(get_current_merchant_api),
merchant=Depends(get_merchant_for_current_user),
db: Session = Depends(get_db),
):
"""Resend invitation to a pending team member."""
from app.modules.tenancy.services.store_team_service import store_team_service
store = merchant_store_service.validate_store_ownership(db, merchant.id, store_id)
inviter = merchant_store_service.get_user(db, current_user.id)
result = store_team_service.resend_invitation(
db, store=store, user_id=user_id, inviter=inviter,
)
db.commit()
return result
@_account_router.delete("/team/stores/{store_id}/members/{user_id}", status_code=204)
async def merchant_team_remove_member(
store_id: int,

View File

@@ -303,6 +303,26 @@ def update_team_member(
return TeamMemberResponse(**member)
@store_team_router.post("/members/{user_id}/resend")
def resend_team_invitation(
user_id: int,
request: Request,
db: Session = Depends(get_db),
current_user: UserContext = Depends(require_store_owner),
):
"""
Resend invitation to a pending team member.
**Required:** Store owner role
"""
store = request.state.store
result = store_team_service.resend_invitation(
db, store=store, user_id=user_id, inviter=current_user,
)
db.commit()
return result
@store_team_router.delete("/members/{user_id}")
def remove_team_member(
user_id: int,