using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Microsoft.EntityFrameworkCore; namespace Iceshrimp.Backend.Core.Database.Tables; [Table("oauth_token")] [Index(nameof(Token))] [Index(nameof(Code))] public class OauthToken { [Key] [Column("id")] [StringLength(32)] public string Id { get; set; } = null!; /// /// The created date of the OAuth token /// [Column("createdAt")] public DateTime CreatedAt { get; set; } [Column("appId")] [StringLength(32)] public string AppId { get; set; } = null!; [Column("userId")] [StringLength(32)] public string UserId { get; set; } = null!; /// /// The auth code for the OAuth token /// [Column("code")] [StringLength(64)] public string Code { get; set; } = null!; /// /// The OAuth token /// [Column("token")] [StringLength(64)] public string Token { get; set; } = null!; /// /// Whether or not the token has been activated /// [Column("active")] public bool Active { get; set; } /// /// The scopes requested by the OAuth token /// [Column("scopes", TypeName = "character varying(64)[]")] public List Scopes { get; set; } = null!; /// /// The redirect URI of the OAuth token /// [Column("redirectUri")] [StringLength(512)] public string RedirectUri { get; set; } = null!; [ForeignKey(nameof(AppId))] [InverseProperty(nameof(OauthApp.OauthTokens))] public virtual OauthApp App { get; set; } = null!; [ForeignKey(nameof(UserId))] [InverseProperty(nameof(Tables.User.OauthTokens))] public virtual User User { get; set; } = null!; [InverseProperty(nameof(Tables.PushSubscription.OauthToken))] public virtual PushSubscription? PushSubscription { get; set; } [Column("supportsHtmlFormatting")] public bool SupportsHtmlFormatting { get; set; } [Column("autoDetectQuotes")] public bool AutoDetectQuotes { get; set; } [Column("isPleroma")] public bool IsPleroma { get; set; } [Column("lastActiveDate")] public DateTime? LastActiveDate { get; set; } }