mirror of
https://github.com/RedWizardsLab/EchoHub.git
synced 2026-09-04 08:36:11 +02:00
feat: Add invite codes and message replies functionality
- Introduced a new migration to add InviteCodes table and ReplyToMessageId column in Messages. - Updated ChatHub to support replying to messages. - Enhanced ChatService to handle message replies and validate reply targets. - Modified UserService to implement invite-only registration mode with invite code consumption. - Added configuration options for registration modes in appsettings. - Created unit tests for new features including invite code registration and message reply formatting.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
namespace EchoHub.Core.Models;
|
||||
|
||||
/// <summary>
|
||||
/// A registration invite code. When the server runs with <c>Server:Registration = "invite"</c>,
|
||||
/// new accounts (REST and IRC alike) require a valid, unexpired, not-fully-used code.
|
||||
/// </summary>
|
||||
public class InviteCode
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public required string Code { get; set; }
|
||||
public Guid CreatedByUserId { get; set; }
|
||||
public string CreatedByUsername { get; set; } = string.Empty;
|
||||
public DateTimeOffset CreatedAt { get; set; } = DateTimeOffset.UtcNow;
|
||||
|
||||
/// <summary>Null means the code never expires.</summary>
|
||||
public DateTimeOffset? ExpiresAt { get; set; }
|
||||
|
||||
public int MaxUses { get; set; } = 1;
|
||||
public int UseCount { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user