ini
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
namespace AuthHex.Models;
|
||||
public class AuthEventLog
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
public Guid? UserId { get; set; }
|
||||
|
||||
public string? EventType { get; set; } // LOGIN_SUCCESS, LOGIN_FAILED, LOCKED
|
||||
public string? IPAddress { get; set; }
|
||||
public string? UserAgent { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace AuthHex.Models.IOs
|
||||
{
|
||||
[NotMapped]
|
||||
public class ApiRequest
|
||||
{
|
||||
[Required]
|
||||
public string FunctionName { get; set; } = string.Empty;
|
||||
|
||||
public object Payload { get; set; } = new();
|
||||
|
||||
[Required(AllowEmptyStrings = true)]
|
||||
public string? Reference { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace AuthHex.Models.IOs
|
||||
{
|
||||
[NotMapped]
|
||||
public class ApiResponse
|
||||
{
|
||||
public int StatusCode { get; set; } = 200;
|
||||
public bool Success { get; set; } = true;
|
||||
public string? Message { get; set; }
|
||||
public object? Data { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
namespace AuthHex.Models
|
||||
{
|
||||
public class Recovery
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public Guid? UserId { get; set; }
|
||||
public User? User { get; set; }
|
||||
|
||||
public string? RecoveryReferenceNum { get; set; }
|
||||
|
||||
// For OTP-based recovery
|
||||
public string? OTP { get; set; }
|
||||
public string? OTPReferenceNum { get; set; }
|
||||
|
||||
|
||||
// For Token-based reset (SECURE - hashed)
|
||||
public string? ResetTokenHash { get; set; }
|
||||
public string? ResetToken { get; set; } // Plain token (only for email, not saved)
|
||||
|
||||
|
||||
public string Status { get; set; } = "Pending"; // Pending, Used, Expired
|
||||
public bool IsUsed { get; set; } = false; // Prevent token reuse
|
||||
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime ExpirationTime { get; set; } = DateTime.UtcNow.AddMinutes(15);
|
||||
|
||||
// Recovery type: OTP or ResetLink
|
||||
public string RecoveryType { get; set; } = "OTP"; // OTP, ResetLink
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace AuthHex.Models
|
||||
{
|
||||
public class Role
|
||||
{
|
||||
public Guid RoleId { get; set; }
|
||||
|
||||
public string Code { get; set; } = string.Empty; // ADMIN, USER, STAFF
|
||||
public string?Name { get; set; } = string.Empty;
|
||||
|
||||
public bool? IsSystemRole { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace AuthHex.Models
|
||||
{
|
||||
public class SysConfig
|
||||
{
|
||||
[Key]
|
||||
public int SysConfigId { get; set; }
|
||||
public int TenantId { get; set; }
|
||||
public string Configuration { get; set; }
|
||||
public string Value { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public bool IsActive { get; set; } = true;
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime LastUpdatedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace AuthHex.Models
|
||||
{
|
||||
public class Token
|
||||
{
|
||||
|
||||
public Guid TokenId { get; set; }
|
||||
|
||||
public Guid UserId { get; set; }
|
||||
public User? User { get; set; }
|
||||
|
||||
public string? TokenHash { get; set; }
|
||||
|
||||
public string? Type { get; set; } // email verify, password reset, etc.
|
||||
|
||||
public DateTime ExpiresAt { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime? UsedAt { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System.Data;
|
||||
|
||||
namespace AuthHex.Models
|
||||
{
|
||||
public class User
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
public string? FullName { get; set; }
|
||||
public string? UserName { get; set; }
|
||||
public string? Nic { get; set; }
|
||||
public string? Address { get; set; }
|
||||
public string? Optional1 { get; set; } //in gym case use in secondary contact number
|
||||
public bool? Optional1Verified { get; set; } = false;
|
||||
public string? Optional2 { get; set; }
|
||||
public string? PasswordHash { get; set; }
|
||||
|
||||
public string? Email { get; set; }
|
||||
public bool? EmailVerified { get; set; } = false;
|
||||
|
||||
public string? MobileNumber { get; set; }
|
||||
public bool? MobileNumberVerified { get; set; } = false;
|
||||
|
||||
public bool? IsActive { get; set; } = true;
|
||||
public bool? IsLocked { get; set; } = false;
|
||||
public DateTime? DeletedAt { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
|
||||
//2FA
|
||||
public bool IsMfaEnabled { get; set; }
|
||||
public UserMfa? UserMfa { get; set; }
|
||||
|
||||
//User Role and Type
|
||||
public Guid RoleId { get; set; }
|
||||
public Role? Role { get; set; }
|
||||
|
||||
public Guid UserTypeId { get; set; }
|
||||
public UserType? UserType { get; set; }
|
||||
|
||||
|
||||
public ICollection<UserSession>? Sessions { get; set; }
|
||||
public ICollection<UserProvider>? Providers { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace AuthHex.Models;
|
||||
|
||||
public class UserMfa
|
||||
{
|
||||
public Guid UserMfaId { get; set; }
|
||||
|
||||
public Guid UserId { get; set; }
|
||||
public User User { get; set; } = null!;
|
||||
|
||||
public string? SecretKey { get; set; } // encrypted
|
||||
public bool? IsEnabled { get; set; }
|
||||
public bool? IsVerified { get; set; } = false;
|
||||
public string? BackupCodes { get; set; } // JSON array of backup codes
|
||||
public DateTime? LastUsedAt { get; set; }
|
||||
public DateTime? VerifiedAt { get; set; }
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime? UpdatedAt { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace AuthHex.Models;
|
||||
public class UserProvider
|
||||
{
|
||||
public Guid ProviderId { get; set; }
|
||||
|
||||
public Guid UserId { get; set; }
|
||||
public User User { get; set; } = null!;
|
||||
|
||||
public string? Provider { get; set; } // Google, facebook, etc.
|
||||
public string? ProviderUserId { get; set; }
|
||||
|
||||
public DateTime LinkedAt { get; set; } = DateTime.UtcNow;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
namespace AuthHex.Models
|
||||
{
|
||||
public class UserSession
|
||||
{
|
||||
|
||||
public Guid SessionId { get; set; }
|
||||
|
||||
public Guid UserId { get; set; }
|
||||
|
||||
public User User { get; set; } = null!;
|
||||
|
||||
public string RefreshTokenHash { get; set; } = string.Empty;
|
||||
|
||||
public string? DeviceName { get; set; }
|
||||
public string? OS { get; set; }
|
||||
public string? Browser { get; set; }
|
||||
public string? IPAddress { get; set; }
|
||||
|
||||
public DateTime ExpiresAt { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public DateTime? RevokedAt { get; set; }
|
||||
|
||||
public bool IsActive => RevokedAt == null && ExpiresAt > DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace AuthHex.Models
|
||||
{
|
||||
public class UserType
|
||||
{
|
||||
public Guid UserTypeId { get; set; }
|
||||
|
||||
public string Code { get; set; } = string.Empty; // INDIVIDUAL, MERCHANT, AGENT
|
||||
public string? Description { get; set; } = string.Empty;
|
||||
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user