2024-12-11 21:36:30 +01:00
|
|
|
// <copyright file="User.cs" company="alveus.dev">
|
|
|
|
// Copyright (c) alveus.dev. All rights reserved. Licensed under the MIT License.
|
|
|
|
// </copyright>
|
|
|
|
|
|
|
|
using Astral.Core.Attributes.EntityAnnotation;
|
2024-12-14 17:31:17 +01:00
|
|
|
using Astral.Core.Constants;
|
2024-12-11 21:36:30 +01:00
|
|
|
|
|
|
|
namespace Astral.Core.Entities;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// User entity.
|
|
|
|
/// </summary>
|
|
|
|
[TableMapping("users")]
|
|
|
|
public class User
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// User id.
|
|
|
|
/// </summary>
|
|
|
|
[ColumnMapping("id")]
|
|
|
|
[PrimaryKey]
|
|
|
|
public Guid Id { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// When the user was created.
|
|
|
|
/// </summary>
|
|
|
|
[ColumnMapping("createdAt")]
|
|
|
|
public DateTime CreatedAt { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// When the user's entity was last updated.
|
|
|
|
/// </summary>
|
|
|
|
[ColumnMapping("updatedAt")]
|
|
|
|
public DateTime UpdatedAt { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The user's name.
|
|
|
|
/// </summary>
|
|
|
|
[ColumnMapping("username")]
|
|
|
|
public string Username { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The user's email address.
|
|
|
|
/// </summary>
|
|
|
|
[ColumnMapping("email")]
|
|
|
|
public string EmailAddress { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Authentication hash.
|
|
|
|
/// </summary>
|
|
|
|
[ColumnMapping("authHash")]
|
|
|
|
public string PasswordHash { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Authentication salt.
|
|
|
|
/// </summary>
|
|
|
|
[ColumnMapping("authSalt")]
|
|
|
|
public string PasswordSalt { get; set; }
|
|
|
|
|
2024-12-14 17:31:17 +01:00
|
|
|
/// <summary>
|
|
|
|
/// State of the user's account.
|
|
|
|
/// </summary>
|
|
|
|
[ColumnMapping("userState")]
|
|
|
|
public UserState State { get; set; }
|
|
|
|
|
2024-12-11 21:36:30 +01:00
|
|
|
/// <summary>
|
|
|
|
/// The ip address of the creator.
|
|
|
|
/// </summary>
|
|
|
|
[ColumnMapping("creatorIp")]
|
|
|
|
public string CreatorIp { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// When the user last logged in.
|
|
|
|
/// </summary>
|
|
|
|
[ColumnMapping("lastLoggedIn")]
|
|
|
|
public DateTime LastLoggedIn { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The user's role.
|
|
|
|
/// </summary>
|
|
|
|
[ColumnMapping("role")]
|
2024-12-14 17:31:17 +01:00
|
|
|
public UserRole Role { get; set; }
|
2024-12-11 21:36:30 +01:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Group for this user's connections.
|
|
|
|
/// </summary>
|
|
|
|
[ColumnMapping("connectionGroup")]
|
|
|
|
public Guid ConnectionGroup { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Group for this user's friends.
|
|
|
|
/// </summary>
|
|
|
|
[ColumnMapping("friendGroup")]
|
|
|
|
public Guid FriendsGroup { get; set; }
|
|
|
|
}
|