namespace IOL.GreatOffice.Api.Data.Database; public class ApiAccessToken : Base { public User User { get; set; } public DateTime ExpiryDate { get; set; } public bool AllowRead { get; set; } public bool AllowCreate { get; set; } public bool AllowUpdate { get; set; } public bool AllowDelete { get; set; } public bool HasExpired => ExpiryDate < DateTime.UtcNow; public ApiAccessTokenDto AsDto => new(this); public class ApiAccessTokenDto { public ApiAccessTokenDto(ApiAccessToken source) { ExpiryDate = source.ExpiryDate; AllowRead = source.AllowRead; AllowCreate = source.AllowCreate; AllowUpdate = source.AllowUpdate; AllowDelete = source.AllowDelete; } public DateTime ExpiryDate { get; set; } public bool AllowRead { get; set; } public bool AllowCreate { get; set; } public bool AllowUpdate { get; set; } public bool AllowDelete { get; set; } public bool HasExpired => ExpiryDate < DateTime.UtcNow; } }