29 lines
1.3 KiB
C#
29 lines
1.3 KiB
C#
using ROLAC.API.DTOs.Invitations;
|
|
using ROLAC.API.Entities;
|
|
|
|
namespace ROLAC.API.Services;
|
|
|
|
public interface IInvitationService
|
|
{
|
|
/// <summary>
|
|
/// Generates a single-use, 7-day invitation link for a member. Auto-creates the member's
|
|
/// login account (no password) when none exists, and revokes any prior unused invitation for
|
|
/// that account. Returns the raw token (shown once) and its expiry.
|
|
/// Throws <see cref="InvalidOperationException"/> when the member is missing or has no email.
|
|
/// </summary>
|
|
Task<CreateInvitationResult> CreateAsync(CreateInvitationRequest request);
|
|
|
|
/// <summary>Checks whether a raw token is still usable, without mutating it.</summary>
|
|
Task<ValidateInvitationResult> ValidateAsync(string rawToken);
|
|
|
|
/// <summary>
|
|
/// Consumes an invitation: validates the token, sets the account password (enforcing the
|
|
/// Identity policy), and marks the invitation used. Returns the account on success, or an
|
|
/// error message describing why it failed (invalid/expired/used token or a policy violation).
|
|
/// </summary>
|
|
Task<(AppUser? User, string? Error)> AcceptAsync(string rawToken, string newPassword);
|
|
|
|
/// <summary>E-mails an already-generated invitation link to the member via IEmailService.</summary>
|
|
Task SendEmailAsync(int memberId, string link);
|
|
}
|