Entity & rough internal API outline

This commit is contained in:
Amelia 2025-05-15 21:57:18 +02:00
parent 8ed2fa3829
commit 23c4a451b4
No known key found for this signature in database
GPG key ID: D6D0ECE365407EAA
15 changed files with 4695 additions and 2 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,157 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace API.Data.Migrations
{
/// <inheritdoc />
public partial class AppUserReadingProfiles : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "DefaultReadingProfileId",
table: "AppUserPreferences",
type: "INTEGER",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateTable(
name: "AppUserReadingProfile",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
UserId = table.Column<int>(type: "INTEGER", nullable: false),
ReadingDirection = table.Column<int>(type: "INTEGER", nullable: false),
ScalingOption = table.Column<int>(type: "INTEGER", nullable: false),
PageSplitOption = table.Column<int>(type: "INTEGER", nullable: false),
ReaderMode = table.Column<int>(type: "INTEGER", nullable: false),
AutoCloseMenu = table.Column<bool>(type: "INTEGER", nullable: false),
ShowScreenHints = table.Column<bool>(type: "INTEGER", nullable: false),
EmulateBook = table.Column<bool>(type: "INTEGER", nullable: false),
LayoutMode = table.Column<int>(type: "INTEGER", nullable: false),
BackgroundColor = table.Column<string>(type: "TEXT", nullable: true),
SwipeToPaginate = table.Column<bool>(type: "INTEGER", nullable: false),
AllowAutomaticWebtoonReaderDetection = table.Column<bool>(type: "INTEGER", nullable: false),
WidthOverride = table.Column<int>(type: "INTEGER", nullable: true),
BookReaderMargin = table.Column<int>(type: "INTEGER", nullable: false),
BookReaderLineSpacing = table.Column<int>(type: "INTEGER", nullable: false),
BookReaderFontSize = table.Column<int>(type: "INTEGER", nullable: false),
BookReaderFontFamily = table.Column<string>(type: "TEXT", nullable: true),
BookReaderTapToPaginate = table.Column<bool>(type: "INTEGER", nullable: false),
BookReaderReadingDirection = table.Column<int>(type: "INTEGER", nullable: false),
BookReaderWritingStyle = table.Column<int>(type: "INTEGER", nullable: false),
BookThemeName = table.Column<string>(type: "TEXT", nullable: true),
BookReaderLayoutMode = table.Column<int>(type: "INTEGER", nullable: false),
BookReaderImmersiveMode = table.Column<bool>(type: "INTEGER", nullable: false),
PdfTheme = table.Column<int>(type: "INTEGER", nullable: false),
PdfScrollMode = table.Column<int>(type: "INTEGER", nullable: false),
PdfSpreadMode = table.Column<int>(type: "INTEGER", nullable: false),
Implicit = table.Column<bool>(type: "INTEGER", nullable: false),
AppUserPreferencesId = table.Column<int>(type: "INTEGER", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AppUserReadingProfile", x => x.Id);
table.ForeignKey(
name: "FK_AppUserReadingProfile_AppUserPreferences_AppUserPreferencesId",
column: x => x.AppUserPreferencesId,
principalTable: "AppUserPreferences",
principalColumn: "Id");
table.ForeignKey(
name: "FK_AppUserReadingProfile_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AppUserReadingProfileLibrary",
columns: table => new
{
LibrariesId = table.Column<int>(type: "INTEGER", nullable: false),
ReadingProfilesId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AppUserReadingProfileLibrary", x => new { x.LibrariesId, x.ReadingProfilesId });
table.ForeignKey(
name: "FK_AppUserReadingProfileLibrary_AppUserReadingProfile_ReadingProfilesId",
column: x => x.ReadingProfilesId,
principalTable: "AppUserReadingProfile",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AppUserReadingProfileLibrary_Library_LibrariesId",
column: x => x.LibrariesId,
principalTable: "Library",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "AppUserReadingProfileSeries",
columns: table => new
{
ReadingProfilesId = table.Column<int>(type: "INTEGER", nullable: false),
SeriesId = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AppUserReadingProfileSeries", x => new { x.ReadingProfilesId, x.SeriesId });
table.ForeignKey(
name: "FK_AppUserReadingProfileSeries_AppUserReadingProfile_ReadingProfilesId",
column: x => x.ReadingProfilesId,
principalTable: "AppUserReadingProfile",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AppUserReadingProfileSeries_Series_SeriesId",
column: x => x.SeriesId,
principalTable: "Series",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AppUserReadingProfile_AppUserPreferencesId",
table: "AppUserReadingProfile",
column: "AppUserPreferencesId");
migrationBuilder.CreateIndex(
name: "IX_AppUserReadingProfile_UserId",
table: "AppUserReadingProfile",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_AppUserReadingProfileLibrary_ReadingProfilesId",
table: "AppUserReadingProfileLibrary",
column: "ReadingProfilesId");
migrationBuilder.CreateIndex(
name: "IX_AppUserReadingProfileSeries_SeriesId",
table: "AppUserReadingProfileSeries",
column: "SeriesId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AppUserReadingProfileLibrary");
migrationBuilder.DropTable(
name: "AppUserReadingProfileSeries");
migrationBuilder.DropTable(
name: "AppUserReadingProfile");
migrationBuilder.DropColumn(
name: "DefaultReadingProfileId",
table: "AppUserPreferences");
}
}
}

View file

@ -455,6 +455,9 @@ namespace API.Data.Migrations
b.Property<bool>("CollapseSeriesRelationships")
.HasColumnType("INTEGER");
b.Property<int>("DefaultReadingProfileId")
.HasColumnType("INTEGER");
b.Property<bool>("EmulateBook")
.HasColumnType("INTEGER");
@ -609,6 +612,105 @@ namespace API.Data.Migrations
b.ToTable("AppUserRating");
});
modelBuilder.Entity("API.Entities.AppUserReadingProfile", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<bool>("AllowAutomaticWebtoonReaderDetection")
.HasColumnType("INTEGER");
b.Property<int?>("AppUserPreferencesId")
.HasColumnType("INTEGER");
b.Property<bool>("AutoCloseMenu")
.HasColumnType("INTEGER");
b.Property<string>("BackgroundColor")
.HasColumnType("TEXT");
b.Property<string>("BookReaderFontFamily")
.HasColumnType("TEXT");
b.Property<int>("BookReaderFontSize")
.HasColumnType("INTEGER");
b.Property<bool>("BookReaderImmersiveMode")
.HasColumnType("INTEGER");
b.Property<int>("BookReaderLayoutMode")
.HasColumnType("INTEGER");
b.Property<int>("BookReaderLineSpacing")
.HasColumnType("INTEGER");
b.Property<int>("BookReaderMargin")
.HasColumnType("INTEGER");
b.Property<int>("BookReaderReadingDirection")
.HasColumnType("INTEGER");
b.Property<bool>("BookReaderTapToPaginate")
.HasColumnType("INTEGER");
b.Property<int>("BookReaderWritingStyle")
.HasColumnType("INTEGER");
b.Property<string>("BookThemeName")
.HasColumnType("TEXT");
b.Property<bool>("EmulateBook")
.HasColumnType("INTEGER");
b.Property<bool>("Implicit")
.HasColumnType("INTEGER");
b.Property<int>("LayoutMode")
.HasColumnType("INTEGER");
b.Property<int>("PageSplitOption")
.HasColumnType("INTEGER");
b.Property<int>("PdfScrollMode")
.HasColumnType("INTEGER");
b.Property<int>("PdfSpreadMode")
.HasColumnType("INTEGER");
b.Property<int>("PdfTheme")
.HasColumnType("INTEGER");
b.Property<int>("ReaderMode")
.HasColumnType("INTEGER");
b.Property<int>("ReadingDirection")
.HasColumnType("INTEGER");
b.Property<int>("ScalingOption")
.HasColumnType("INTEGER");
b.Property<bool>("ShowScreenHints")
.HasColumnType("INTEGER");
b.Property<bool>("SwipeToPaginate")
.HasColumnType("INTEGER");
b.Property<int>("UserId")
.HasColumnType("INTEGER");
b.Property<int?>("WidthOverride")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("AppUserPreferencesId");
b.HasIndex("UserId");
b.ToTable("AppUserReadingProfile");
});
modelBuilder.Entity("API.Entities.AppUserRole", b =>
{
b.Property<int>("UserId")
@ -2479,6 +2581,36 @@ namespace API.Data.Migrations
b.ToTable("AppUserLibrary");
});
modelBuilder.Entity("AppUserReadingProfileLibrary", b =>
{
b.Property<int>("LibrariesId")
.HasColumnType("INTEGER");
b.Property<int>("ReadingProfilesId")
.HasColumnType("INTEGER");
b.HasKey("LibrariesId", "ReadingProfilesId");
b.HasIndex("ReadingProfilesId");
b.ToTable("AppUserReadingProfileLibrary");
});
modelBuilder.Entity("AppUserReadingProfileSeries", b =>
{
b.Property<int>("ReadingProfilesId")
.HasColumnType("INTEGER");
b.Property<int>("SeriesId")
.HasColumnType("INTEGER");
b.HasKey("ReadingProfilesId", "SeriesId");
b.HasIndex("SeriesId");
b.ToTable("AppUserReadingProfileSeries");
});
modelBuilder.Entity("ChapterGenre", b =>
{
b.Property<int>("ChaptersId")
@ -2838,6 +2970,21 @@ namespace API.Data.Migrations
b.Navigation("Series");
});
modelBuilder.Entity("API.Entities.AppUserReadingProfile", b =>
{
b.HasOne("API.Entities.AppUserPreferences", null)
.WithMany("ReadingProfiles")
.HasForeignKey("AppUserPreferencesId");
b.HasOne("API.Entities.AppUser", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("API.Entities.AppUserRole", b =>
{
b.HasOne("API.Entities.AppRole", "Role")
@ -3295,6 +3442,36 @@ namespace API.Data.Migrations
.IsRequired();
});
modelBuilder.Entity("AppUserReadingProfileLibrary", b =>
{
b.HasOne("API.Entities.Library", null)
.WithMany()
.HasForeignKey("LibrariesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("API.Entities.AppUserReadingProfile", null)
.WithMany()
.HasForeignKey("ReadingProfilesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("AppUserReadingProfileSeries", b =>
{
b.HasOne("API.Entities.AppUserReadingProfile", null)
.WithMany()
.HasForeignKey("ReadingProfilesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("API.Entities.Series", null)
.WithMany()
.HasForeignKey("SeriesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ChapterGenre", b =>
{
b.HasOne("API.Entities.Chapter", null)
@ -3491,6 +3668,11 @@ namespace API.Data.Migrations
b.Navigation("WantToRead");
});
modelBuilder.Entity("API.Entities.AppUserPreferences", b =>
{
b.Navigation("ReadingProfiles");
});
modelBuilder.Entity("API.Entities.Chapter", b =>
{
b.Navigation("ExternalRatings");