修改接口

This commit is contained in:
2025-10-16 15:21:52 +08:00
parent 82220ce0b8
commit dd398c1c32
274 changed files with 22777 additions and 22905 deletions

View File

@@ -1,559 +0,0 @@
// <auto-generated />
using System;
using FutureMailAPI.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace FutureMailAPI.Migrations
{
[DbContext(typeof(FutureMailDbContext))]
[Migration("20251016011551_AddOAuthEntities")]
partial class AddOAuthEntities
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "9.0.9");
modelBuilder.Entity("FutureMailAPI.Models.OAuthAccessToken", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
b.Property<DateTime>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<DateTime>("ExpiresAt")
.HasColumnType("TEXT");
b.Property<bool>("IsRevoked")
.HasColumnType("INTEGER");
b.Property<string>("Scopes")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Token")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("UserId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("UserId");
b.ToTable("OAuthAccessTokens");
});
modelBuilder.Entity("FutureMailAPI.Models.OAuthAuthorizationCode", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
b.Property<string>("Code")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<DateTime>("ExpiresAt")
.HasColumnType("TEXT");
b.Property<bool>("IsUsed")
.HasColumnType("INTEGER");
b.Property<string>("RedirectUri")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Scopes")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("UserId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("UserId");
b.ToTable("OAuthAuthorizationCodes");
});
modelBuilder.Entity("FutureMailAPI.Models.OAuthClient", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClientId")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("ClientSecret")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<bool>("IsActive")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("RedirectUris")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Scopes")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime>("UpdatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.HasKey("Id");
b.HasIndex("ClientId")
.IsUnique();
b.ToTable("OAuthClients");
});
modelBuilder.Entity("FutureMailAPI.Models.OAuthRefreshToken", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
b.Property<DateTime>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<DateTime>("ExpiresAt")
.HasColumnType("TEXT");
b.Property<bool>("IsUsed")
.HasColumnType("INTEGER");
b.Property<string>("Token")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("UserId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("UserId");
b.ToTable("OAuthRefreshTokens");
});
modelBuilder.Entity("FutureMailAPI.Models.ReceivedMail", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<bool>("IsRead")
.HasColumnType("INTEGER");
b.Property<bool>("IsReplied")
.HasColumnType("INTEGER");
b.Property<DateTime?>("ReadAt")
.HasColumnType("TEXT");
b.Property<DateTime>("ReceivedAt")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<int>("RecipientId")
.HasColumnType("INTEGER");
b.Property<int>("RecipientId1")
.HasColumnType("INTEGER");
b.Property<int?>("ReplyMailId")
.HasColumnType("INTEGER");
b.Property<int>("SentMailId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("RecipientId");
b.HasIndex("RecipientId1");
b.HasIndex("SentMailId");
b.ToTable("ReceivedMails");
});
modelBuilder.Entity("FutureMailAPI.Models.SentMail", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Attachments")
.HasColumnType("TEXT");
b.Property<string>("Content")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime>("DeliveryTime")
.HasColumnType("TEXT");
b.Property<string>("EncryptionKey")
.HasColumnType("TEXT");
b.Property<bool>("IsEncrypted")
.HasColumnType("INTEGER");
b.Property<int?>("RecipientId")
.HasColumnType("INTEGER");
b.Property<int?>("RecipientId1")
.HasColumnType("INTEGER");
b.Property<int>("RecipientType")
.HasColumnType("INTEGER");
b.Property<int>("SenderId")
.HasColumnType("INTEGER");
b.Property<DateTime>("SentAt")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<int>("Status")
.HasColumnType("INTEGER");
b.Property<string>("Theme")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<string>("TriggerDetails")
.HasColumnType("TEXT");
b.Property<int>("TriggerType")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("RecipientId");
b.HasIndex("RecipientId1");
b.HasIndex("SenderId");
b.ToTable("SentMails");
});
modelBuilder.Entity("FutureMailAPI.Models.TimeCapsule", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Color")
.HasMaxLength(20)
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<double>("Opacity")
.HasColumnType("REAL");
b.Property<double>("PositionX")
.HasColumnType("REAL");
b.Property<double>("PositionY")
.HasColumnType("REAL");
b.Property<double>("PositionZ")
.HasColumnType("REAL");
b.Property<double>("Rotation")
.HasColumnType("REAL");
b.Property<int>("SentMailId")
.HasColumnType("INTEGER");
b.Property<int>("SentMailId1")
.HasColumnType("INTEGER");
b.Property<double>("Size")
.HasColumnType("REAL");
b.Property<int>("Status")
.HasColumnType("INTEGER");
b.Property<int>("Type")
.HasColumnType("INTEGER");
b.Property<int>("UserId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("SentMailId");
b.HasIndex("SentMailId1");
b.HasIndex("UserId");
b.ToTable("TimeCapsules");
});
modelBuilder.Entity("FutureMailAPI.Models.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Avatar")
.HasMaxLength(500)
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("TEXT");
b.Property<bool>("IsActive")
.HasColumnType("INTEGER");
b.Property<DateTime?>("LastLoginAt")
.HasColumnType("TEXT");
b.Property<string>("Nickname")
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<string>("PasswordHash")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("TEXT");
b.Property<string>("PreferredBackground")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<string>("PreferredScene")
.HasMaxLength(20)
.HasColumnType("TEXT");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Email")
.IsUnique();
b.HasIndex("Username")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("FutureMailAPI.Models.OAuthAccessToken", b =>
{
b.HasOne("FutureMailAPI.Models.OAuthClient", "Client")
.WithMany()
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FutureMailAPI.Models.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("User");
});
modelBuilder.Entity("FutureMailAPI.Models.OAuthAuthorizationCode", b =>
{
b.HasOne("FutureMailAPI.Models.OAuthClient", "Client")
.WithMany()
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FutureMailAPI.Models.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("User");
});
modelBuilder.Entity("FutureMailAPI.Models.OAuthRefreshToken", b =>
{
b.HasOne("FutureMailAPI.Models.OAuthClient", "Client")
.WithMany()
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FutureMailAPI.Models.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("User");
});
modelBuilder.Entity("FutureMailAPI.Models.ReceivedMail", b =>
{
b.HasOne("FutureMailAPI.Models.User", null)
.WithMany()
.HasForeignKey("RecipientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FutureMailAPI.Models.User", "Recipient")
.WithMany("ReceivedMails")
.HasForeignKey("RecipientId1")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FutureMailAPI.Models.SentMail", "SentMail")
.WithMany()
.HasForeignKey("SentMailId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Recipient");
b.Navigation("SentMail");
});
modelBuilder.Entity("FutureMailAPI.Models.SentMail", b =>
{
b.HasOne("FutureMailAPI.Models.User", null)
.WithMany()
.HasForeignKey("RecipientId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("FutureMailAPI.Models.User", "Recipient")
.WithMany()
.HasForeignKey("RecipientId1");
b.HasOne("FutureMailAPI.Models.User", "Sender")
.WithMany("SentMails")
.HasForeignKey("SenderId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Recipient");
b.Navigation("Sender");
});
modelBuilder.Entity("FutureMailAPI.Models.TimeCapsule", b =>
{
b.HasOne("FutureMailAPI.Models.SentMail", null)
.WithMany()
.HasForeignKey("SentMailId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FutureMailAPI.Models.SentMail", "SentMail")
.WithMany()
.HasForeignKey("SentMailId1")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FutureMailAPI.Models.User", "User")
.WithMany("TimeCapsules")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("SentMail");
b.Navigation("User");
});
modelBuilder.Entity("FutureMailAPI.Models.User", b =>
{
b.Navigation("ReceivedMails");
b.Navigation("SentMails");
b.Navigation("TimeCapsules");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,180 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace FutureMailAPI.Migrations
{
/// <inheritdoc />
public partial class AddOAuthEntities : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "OAuthClients",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ClientId = table.Column<string>(type: "TEXT", nullable: false),
ClientSecret = table.Column<string>(type: "TEXT", nullable: false),
Name = table.Column<string>(type: "TEXT", nullable: false),
RedirectUris = table.Column<string>(type: "TEXT", nullable: false),
Scopes = table.Column<string>(type: "TEXT", nullable: false),
IsActive = table.Column<bool>(type: "INTEGER", nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
UpdatedAt = table.Column<DateTime>(type: "TEXT", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP")
},
constraints: table =>
{
table.PrimaryKey("PK_OAuthClients", x => x.Id);
});
migrationBuilder.CreateTable(
name: "OAuthAccessTokens",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Token = table.Column<string>(type: "TEXT", nullable: false),
ClientId = table.Column<int>(type: "INTEGER", nullable: false),
UserId = table.Column<int>(type: "INTEGER", nullable: false),
Scopes = table.Column<string>(type: "TEXT", nullable: false),
IsRevoked = table.Column<bool>(type: "INTEGER", nullable: false),
ExpiresAt = table.Column<DateTime>(type: "TEXT", nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP")
},
constraints: table =>
{
table.PrimaryKey("PK_OAuthAccessTokens", x => x.Id);
table.ForeignKey(
name: "FK_OAuthAccessTokens_OAuthClients_ClientId",
column: x => x.ClientId,
principalTable: "OAuthClients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_OAuthAccessTokens_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "OAuthAuthorizationCodes",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Code = table.Column<string>(type: "TEXT", nullable: false),
ClientId = table.Column<int>(type: "INTEGER", nullable: false),
UserId = table.Column<int>(type: "INTEGER", nullable: false),
RedirectUri = table.Column<string>(type: "TEXT", nullable: false),
Scopes = table.Column<string>(type: "TEXT", nullable: false),
IsUsed = table.Column<bool>(type: "INTEGER", nullable: false),
ExpiresAt = table.Column<DateTime>(type: "TEXT", nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP")
},
constraints: table =>
{
table.PrimaryKey("PK_OAuthAuthorizationCodes", x => x.Id);
table.ForeignKey(
name: "FK_OAuthAuthorizationCodes_OAuthClients_ClientId",
column: x => x.ClientId,
principalTable: "OAuthClients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_OAuthAuthorizationCodes_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "OAuthRefreshTokens",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Token = table.Column<string>(type: "TEXT", nullable: false),
ClientId = table.Column<int>(type: "INTEGER", nullable: false),
UserId = table.Column<int>(type: "INTEGER", nullable: false),
IsUsed = table.Column<bool>(type: "INTEGER", nullable: false),
ExpiresAt = table.Column<DateTime>(type: "TEXT", nullable: false),
CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP")
},
constraints: table =>
{
table.PrimaryKey("PK_OAuthRefreshTokens", x => x.Id);
table.ForeignKey(
name: "FK_OAuthRefreshTokens_OAuthClients_ClientId",
column: x => x.ClientId,
principalTable: "OAuthClients",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_OAuthRefreshTokens_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_OAuthAccessTokens_ClientId",
table: "OAuthAccessTokens",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_OAuthAccessTokens_UserId",
table: "OAuthAccessTokens",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_OAuthAuthorizationCodes_ClientId",
table: "OAuthAuthorizationCodes",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_OAuthAuthorizationCodes_UserId",
table: "OAuthAuthorizationCodes",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_OAuthClients_ClientId",
table: "OAuthClients",
column: "ClientId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_OAuthRefreshTokens_ClientId",
table: "OAuthRefreshTokens",
column: "ClientId");
migrationBuilder.CreateIndex(
name: "IX_OAuthRefreshTokens_UserId",
table: "OAuthRefreshTokens",
column: "UserId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "OAuthAccessTokens");
migrationBuilder.DropTable(
name: "OAuthAuthorizationCodes");
migrationBuilder.DropTable(
name: "OAuthRefreshTokens");
migrationBuilder.DropTable(
name: "OAuthClients");
}
}
}

View File

@@ -1,564 +0,0 @@
// <auto-generated />
using System;
using FutureMailAPI.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace FutureMailAPI.Migrations
{
[DbContext(typeof(FutureMailDbContext))]
[Migration("20251016012504_AddSaltToUser")]
partial class AddSaltToUser
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "9.0.9");
modelBuilder.Entity("FutureMailAPI.Models.OAuthAccessToken", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
b.Property<DateTime>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<DateTime>("ExpiresAt")
.HasColumnType("TEXT");
b.Property<bool>("IsRevoked")
.HasColumnType("INTEGER");
b.Property<string>("Scopes")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Token")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("UserId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("UserId");
b.ToTable("OAuthAccessTokens");
});
modelBuilder.Entity("FutureMailAPI.Models.OAuthAuthorizationCode", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
b.Property<string>("Code")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<DateTime>("ExpiresAt")
.HasColumnType("TEXT");
b.Property<bool>("IsUsed")
.HasColumnType("INTEGER");
b.Property<string>("RedirectUri")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Scopes")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("UserId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("UserId");
b.ToTable("OAuthAuthorizationCodes");
});
modelBuilder.Entity("FutureMailAPI.Models.OAuthClient", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClientId")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("ClientSecret")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<bool>("IsActive")
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("RedirectUris")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Scopes")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime>("UpdatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.HasKey("Id");
b.HasIndex("ClientId")
.IsUnique();
b.ToTable("OAuthClients");
});
modelBuilder.Entity("FutureMailAPI.Models.OAuthRefreshToken", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
b.Property<DateTime>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<DateTime>("ExpiresAt")
.HasColumnType("TEXT");
b.Property<bool>("IsUsed")
.HasColumnType("INTEGER");
b.Property<string>("Token")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("UserId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("UserId");
b.ToTable("OAuthRefreshTokens");
});
modelBuilder.Entity("FutureMailAPI.Models.ReceivedMail", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<bool>("IsRead")
.HasColumnType("INTEGER");
b.Property<bool>("IsReplied")
.HasColumnType("INTEGER");
b.Property<DateTime?>("ReadAt")
.HasColumnType("TEXT");
b.Property<DateTime>("ReceivedAt")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<int>("RecipientId")
.HasColumnType("INTEGER");
b.Property<int>("RecipientId1")
.HasColumnType("INTEGER");
b.Property<int?>("ReplyMailId")
.HasColumnType("INTEGER");
b.Property<int>("SentMailId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("RecipientId");
b.HasIndex("RecipientId1");
b.HasIndex("SentMailId");
b.ToTable("ReceivedMails");
});
modelBuilder.Entity("FutureMailAPI.Models.SentMail", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Attachments")
.HasColumnType("TEXT");
b.Property<string>("Content")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime>("DeliveryTime")
.HasColumnType("TEXT");
b.Property<string>("EncryptionKey")
.HasColumnType("TEXT");
b.Property<bool>("IsEncrypted")
.HasColumnType("INTEGER");
b.Property<int?>("RecipientId")
.HasColumnType("INTEGER");
b.Property<int?>("RecipientId1")
.HasColumnType("INTEGER");
b.Property<int>("RecipientType")
.HasColumnType("INTEGER");
b.Property<int>("SenderId")
.HasColumnType("INTEGER");
b.Property<DateTime>("SentAt")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<int>("Status")
.HasColumnType("INTEGER");
b.Property<string>("Theme")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<string>("TriggerDetails")
.HasColumnType("TEXT");
b.Property<int>("TriggerType")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("RecipientId");
b.HasIndex("RecipientId1");
b.HasIndex("SenderId");
b.ToTable("SentMails");
});
modelBuilder.Entity("FutureMailAPI.Models.TimeCapsule", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Color")
.HasMaxLength(20)
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<double>("Opacity")
.HasColumnType("REAL");
b.Property<double>("PositionX")
.HasColumnType("REAL");
b.Property<double>("PositionY")
.HasColumnType("REAL");
b.Property<double>("PositionZ")
.HasColumnType("REAL");
b.Property<double>("Rotation")
.HasColumnType("REAL");
b.Property<int>("SentMailId")
.HasColumnType("INTEGER");
b.Property<int>("SentMailId1")
.HasColumnType("INTEGER");
b.Property<double>("Size")
.HasColumnType("REAL");
b.Property<int>("Status")
.HasColumnType("INTEGER");
b.Property<int>("Type")
.HasColumnType("INTEGER");
b.Property<int>("UserId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("SentMailId");
b.HasIndex("SentMailId1");
b.HasIndex("UserId");
b.ToTable("TimeCapsules");
});
modelBuilder.Entity("FutureMailAPI.Models.User", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Avatar")
.HasMaxLength(500)
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<string>("Email")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("TEXT");
b.Property<bool>("IsActive")
.HasColumnType("INTEGER");
b.Property<DateTime?>("LastLoginAt")
.HasColumnType("TEXT");
b.Property<string>("Nickname")
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<string>("PasswordHash")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("TEXT");
b.Property<string>("PreferredBackground")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<string>("PreferredScene")
.HasMaxLength(20)
.HasColumnType("TEXT");
b.Property<string>("Salt")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("TEXT");
b.Property<string>("Username")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Email")
.IsUnique();
b.HasIndex("Username")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("FutureMailAPI.Models.OAuthAccessToken", b =>
{
b.HasOne("FutureMailAPI.Models.OAuthClient", "Client")
.WithMany()
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FutureMailAPI.Models.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("User");
});
modelBuilder.Entity("FutureMailAPI.Models.OAuthAuthorizationCode", b =>
{
b.HasOne("FutureMailAPI.Models.OAuthClient", "Client")
.WithMany()
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FutureMailAPI.Models.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("User");
});
modelBuilder.Entity("FutureMailAPI.Models.OAuthRefreshToken", b =>
{
b.HasOne("FutureMailAPI.Models.OAuthClient", "Client")
.WithMany()
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FutureMailAPI.Models.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("User");
});
modelBuilder.Entity("FutureMailAPI.Models.ReceivedMail", b =>
{
b.HasOne("FutureMailAPI.Models.User", null)
.WithMany()
.HasForeignKey("RecipientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FutureMailAPI.Models.User", "Recipient")
.WithMany("ReceivedMails")
.HasForeignKey("RecipientId1")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FutureMailAPI.Models.SentMail", "SentMail")
.WithMany()
.HasForeignKey("SentMailId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Recipient");
b.Navigation("SentMail");
});
modelBuilder.Entity("FutureMailAPI.Models.SentMail", b =>
{
b.HasOne("FutureMailAPI.Models.User", null)
.WithMany()
.HasForeignKey("RecipientId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("FutureMailAPI.Models.User", "Recipient")
.WithMany()
.HasForeignKey("RecipientId1");
b.HasOne("FutureMailAPI.Models.User", "Sender")
.WithMany("SentMails")
.HasForeignKey("SenderId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Recipient");
b.Navigation("Sender");
});
modelBuilder.Entity("FutureMailAPI.Models.TimeCapsule", b =>
{
b.HasOne("FutureMailAPI.Models.SentMail", null)
.WithMany()
.HasForeignKey("SentMailId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FutureMailAPI.Models.SentMail", "SentMail")
.WithMany()
.HasForeignKey("SentMailId1")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FutureMailAPI.Models.User", "User")
.WithMany("TimeCapsules")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("SentMail");
b.Navigation("User");
});
modelBuilder.Entity("FutureMailAPI.Models.User", b =>
{
b.Navigation("ReceivedMails");
b.Navigation("SentMails");
b.Navigation("TimeCapsules");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -17,90 +17,6 @@ namespace FutureMailAPI.Migrations
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "9.0.9");
modelBuilder.Entity("FutureMailAPI.Models.OAuthAccessToken", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
b.Property<DateTime>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<DateTime>("ExpiresAt")
.HasColumnType("TEXT");
b.Property<bool>("IsRevoked")
.HasColumnType("INTEGER");
b.Property<string>("Scopes")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Token")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("UserId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("UserId");
b.ToTable("OAuthAccessTokens");
});
modelBuilder.Entity("FutureMailAPI.Models.OAuthAuthorizationCode", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
b.Property<string>("Code")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<DateTime>("ExpiresAt")
.HasColumnType("TEXT");
b.Property<bool>("IsUsed")
.HasColumnType("INTEGER");
b.Property<string>("RedirectUri")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Scopes")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int>("UserId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("UserId");
b.ToTable("OAuthAuthorizationCodes");
});
modelBuilder.Entity("FutureMailAPI.Models.OAuthClient", b =>
{
b.Property<int>("Id")
@@ -109,10 +25,12 @@ namespace FutureMailAPI.Migrations
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<string>("ClientSecret")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("TEXT");
b.Property<DateTime>("CreatedAt")
@@ -125,6 +43,7 @@ namespace FutureMailAPI.Migrations
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<string>("RedirectUris")
@@ -148,12 +67,17 @@ namespace FutureMailAPI.Migrations
b.ToTable("OAuthClients");
});
modelBuilder.Entity("FutureMailAPI.Models.OAuthRefreshToken", b =>
modelBuilder.Entity("FutureMailAPI.Models.OAuthToken", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("AccessToken")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("TEXT");
b.Property<int>("ClientId")
.HasColumnType("INTEGER");
@@ -165,11 +89,22 @@ namespace FutureMailAPI.Migrations
b.Property<DateTime>("ExpiresAt")
.HasColumnType("TEXT");
b.Property<bool>("IsUsed")
.HasColumnType("INTEGER");
b.Property<string>("Token")
b.Property<string>("RefreshToken")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("TEXT");
b.Property<DateTime?>("RevokedAt")
.HasColumnType("TEXT");
b.Property<string>("Scope")
.HasColumnType("TEXT");
b.Property<string>("TokenType")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime?>("UpdatedAt")
.HasColumnType("TEXT");
b.Property<int>("UserId")
@@ -177,11 +112,17 @@ namespace FutureMailAPI.Migrations
b.HasKey("Id");
b.HasIndex("AccessToken")
.IsUnique();
b.HasIndex("ClientId");
b.HasIndex("RefreshToken")
.IsUnique();
b.HasIndex("UserId");
b.ToTable("OAuthRefreshTokens");
b.ToTable("OAuthTokens");
});
modelBuilder.Entity("FutureMailAPI.Models.ReceivedMail", b =>
@@ -397,6 +338,13 @@ namespace FutureMailAPI.Migrations
.HasMaxLength(20)
.HasColumnType("TEXT");
b.Property<string>("RefreshToken")
.HasMaxLength(500)
.HasColumnType("TEXT");
b.Property<DateTime?>("RefreshTokenExpiryTime")
.HasColumnType("TEXT");
b.Property<string>("Salt")
.IsRequired()
.HasMaxLength(255)
@@ -418,48 +366,10 @@ namespace FutureMailAPI.Migrations
b.ToTable("Users");
});
modelBuilder.Entity("FutureMailAPI.Models.OAuthAccessToken", b =>
modelBuilder.Entity("FutureMailAPI.Models.OAuthToken", b =>
{
b.HasOne("FutureMailAPI.Models.OAuthClient", "Client")
.WithMany()
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FutureMailAPI.Models.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("User");
});
modelBuilder.Entity("FutureMailAPI.Models.OAuthAuthorizationCode", b =>
{
b.HasOne("FutureMailAPI.Models.OAuthClient", "Client")
.WithMany()
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("FutureMailAPI.Models.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("User");
});
modelBuilder.Entity("FutureMailAPI.Models.OAuthRefreshToken", b =>
{
b.HasOne("FutureMailAPI.Models.OAuthClient", "Client")
.WithMany()
.WithMany("Tokens")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
@@ -547,6 +457,11 @@ namespace FutureMailAPI.Migrations
b.Navigation("User");
});
modelBuilder.Entity("FutureMailAPI.Models.OAuthClient", b =>
{
b.Navigation("Tokens");
});
modelBuilder.Entity("FutureMailAPI.Models.User", b =>
{
b.Navigation("ReceivedMails");