63 lines
No EOL
1.9 KiB
C#
63 lines
No EOL
1.9 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Iceshrimp.Backend.Core.Database.Tables;
|
|
|
|
[Table("access_token")]
|
|
[Index("Hash", Name = "IDX_64c327441248bae40f7d92f34f")]
|
|
[Index("Token", Name = "IDX_70ba8f6af34bc924fc9e12adb8")]
|
|
[Index("UserId", Name = "IDX_9949557d0e1b2c19e5344c171e")]
|
|
[Index("Session", Name = "IDX_bf3a053c07d9fb5d87317c56ee")]
|
|
public class AccessToken {
|
|
[Key]
|
|
[Column("id")]
|
|
[StringLength(32)]
|
|
public string Id { get; set; } = null!;
|
|
|
|
/// <summary>
|
|
/// The created date of the AccessToken.
|
|
/// </summary>
|
|
[Column("createdAt")]
|
|
public DateTime CreatedAt { get; set; }
|
|
|
|
[Column("token")] [StringLength(128)] public string Token { get; set; } = null!;
|
|
|
|
[Column("hash")] [StringLength(128)] public string Hash { get; set; } = null!;
|
|
|
|
[Column("userId")] [StringLength(32)] public string UserId { get; set; } = null!;
|
|
|
|
[Column("appId")] [StringLength(32)] public string? AppId { get; set; }
|
|
|
|
[Column("lastUsedAt")] public DateTime? LastUsedAt { get; set; }
|
|
|
|
[Column("session")]
|
|
[StringLength(128)]
|
|
public string? Session { get; set; }
|
|
|
|
[Column("name")] [StringLength(128)] public string? Name { get; set; }
|
|
|
|
[Column("description")]
|
|
[StringLength(512)]
|
|
public string? Description { get; set; }
|
|
|
|
[Column("iconUrl")]
|
|
[StringLength(512)]
|
|
public string? IconUrl { get; set; }
|
|
|
|
[Column("permission", TypeName = "character varying(64)[]")]
|
|
public List<string> Permission { get; set; } = null!;
|
|
|
|
[Column("fetched")] public bool Fetched { get; set; }
|
|
|
|
[ForeignKey("AppId")]
|
|
[InverseProperty("AccessTokens")]
|
|
public virtual App? App { get; set; }
|
|
|
|
[InverseProperty("AppAccessToken")]
|
|
public virtual ICollection<Notification> Notifications { get; set; } = new List<Notification>();
|
|
|
|
[ForeignKey("UserId")]
|
|
[InverseProperty("AccessTokens")]
|
|
public virtual User User { get; set; } = null!;
|
|
} |