2021-05-02 16:37:03 +01:00
|
|
|
using System;
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
|
|
2021-08-15 19:09:01 +01:00
|
|
|
namespace isnd.Data.ApiKeys
|
2021-05-02 16:37:03 +01:00
|
|
|
{
|
|
|
|
|
public class ApiKey
|
|
|
|
|
{
|
|
|
|
|
[Required][Key][DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
|
|
|
|
|
[Required][ForeignKey("User")]
|
|
|
|
|
public string UserId { get; set; }
|
|
|
|
|
|
|
|
|
|
public virtual ApplicationUser User { get; set; }
|
|
|
|
|
|
|
|
|
|
public string Name { get; set; }
|
|
|
|
|
|
|
|
|
|
public int ValidityPeriodInDays{ get; set; }
|
|
|
|
|
|
|
|
|
|
public DateTime CreationDate { get; set; }
|
2021-07-12 02:17:26 +01:00
|
|
|
|
|
|
|
|
public bool IsValid => CreationDate.AddDays(ValidityPeriodInDays) > DateTime.Now;
|
2021-05-02 16:37:03 +01:00
|
|
|
}
|
|
|
|
|
}
|