2023-05-23 08:37:20 +08:00

33 lines
1.1 KiB
C#

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Blahblah.FlowerStory.Server.Data.Model;
[Table("users")]
public class UserItem
{
[Column("uid"), Key, Required]
public int Id { get; set; }
[Column("id"), Required]
public required string UserId { get; set; }
[Column("password"), Required]
public required string Password { get; set; }
[Column("level"), Required]
public int Level { get; set; }
[Column("regdate"), Required]
public long RegisterDateUnixTime { get; set; }
[Column("activedate")]
public long? ActiveDateUnixTime { get; set; }
[Column("name"), Required]
public required string Name { get; set; }
[Column("email")]
public string? Email { get; set; }
[Column("mobile")]
public string? Mobile { get; set; }
[NotMapped]
public DateTimeOffset RegisterDate => DateTimeOffset.FromUnixTimeMilliseconds(RegisterDateUnixTime);
[NotMapped]
public DateTimeOffset? ActiveDate => ActiveDateUnixTime == null ? null : DateTimeOffset.FromUnixTimeMilliseconds(ActiveDateUnixTime.Value);
}