ruff and prettier fixes
This commit is contained in:
@@ -34,31 +34,31 @@ async def generate_invitation_link(
|
||||
],
|
||||
) -> InvitationResponse:
|
||||
"""Generate a new invitation link for user registration.
|
||||
|
||||
|
||||
The invitation token is valid for 24 hours and can be used once.
|
||||
Requires admin role.
|
||||
|
||||
|
||||
Args:
|
||||
user_id: Admin user ID (from verify_admin)
|
||||
invitation_repository: Invitation storage backend
|
||||
|
||||
|
||||
Returns:
|
||||
InvitationResponse with token and expiration details
|
||||
"""
|
||||
|
||||
|
||||
# Generate secure random token
|
||||
invitation_token = secrets.token_urlsafe(32)
|
||||
|
||||
|
||||
# Calculate expiration (24 hours from now)
|
||||
expires_at = datetime.now(UTC) + timedelta(hours=24)
|
||||
|
||||
|
||||
# Store invitation token in database
|
||||
invitation_repository.create_invitation(
|
||||
token=invitation_token,
|
||||
created_by_user_id=user_id,
|
||||
expires_at=expires_at,
|
||||
)
|
||||
|
||||
|
||||
return InvitationResponse(
|
||||
token=invitation_token,
|
||||
expires_at=expires_at.isoformat(),
|
||||
|
||||
Reference in New Issue
Block a user