using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using Microsoft.EntityFrameworkCore; namespace Iceshrimp.Backend.Core.Database.Tables; [Table("app")] [Index("CreatedAt")] [Index("UserId")] [Index("Secret")] public class App { [Key] [Column("id")] [StringLength(32)] public string Id { get; set; } = null!; /// /// The created date of the App. /// [Column("createdAt")] public DateTime CreatedAt { get; set; } /// /// The owner ID. /// [Column("userId")] [StringLength(32)] public string? UserId { get; set; } /// /// The secret key of the App. /// [Column("secret")] [StringLength(64)] public string Secret { get; set; } = null!; /// /// The name of the App. /// [Column("name")] [StringLength(128)] public string Name { get; set; } = null!; /// /// The description of the App. /// [Column("description")] [StringLength(512)] public string Description { get; set; } = null!; /// /// The permission of the App. /// [Column("permission", TypeName = "character varying(64)[]")] public List Permission { get; set; } = null!; /// /// The callbackUrl of the App. /// [Column("callbackUrl")] [StringLength(512)] public string? CallbackUrl { get; set; } [InverseProperty("App")] public virtual ICollection AccessTokens { get; set; } = new List(); [InverseProperty("App")] public virtual ICollection AuthSessions { get; set; } = new List(); [ForeignKey("UserId")] [InverseProperty("Apps")] public virtual User? User { get; set; } }