Fixed dockerfiles and fixed chapter upserts
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -0,0 +1,275 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using DBConnection.Contexts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DBConnection.Migrations.PostgresSql
|
||||
{
|
||||
[DbContext(typeof(PostgresSqlAppDbContext))]
|
||||
[Migration("20220717133208_Fix up UserNovel model and add index on User Email")]
|
||||
partial class FixupUserNovelmodelandaddindexonUserEmail
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.7")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("NovelTag", b =>
|
||||
{
|
||||
b.Property<string>("NovelsUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TagsTagValue")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("NovelsUrl", "TagsTagValue");
|
||||
|
||||
b.HasIndex("TagsTagValue");
|
||||
|
||||
b.ToTable("NovelTag");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.Author", b =>
|
||||
{
|
||||
b.Property<string>("Url")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Url");
|
||||
|
||||
b.ToTable("Authors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.Chapter", b =>
|
||||
{
|
||||
b.Property<string>("Url")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("ChapterNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime?>("DatePosted")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime?>("DateUpdated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime?>("LastContentFetch")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("NovelUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RawContent")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Url");
|
||||
|
||||
b.HasIndex("NovelUrl");
|
||||
|
||||
b.ToTable("Chapters");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.Novel", b =>
|
||||
{
|
||||
b.Property<string>("Url")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("AuthorUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime>("DatePosted")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("Guid")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTime>("LastUpdated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Url");
|
||||
|
||||
b.HasIndex("AuthorUrl");
|
||||
|
||||
b.HasIndex("Guid");
|
||||
|
||||
b.ToTable("Novels");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.Tag", b =>
|
||||
{
|
||||
b.Property<string>("TagValue")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("TagValue");
|
||||
|
||||
b.ToTable("Tags");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<DateTime>("DateCreated")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime>("DateModified")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Email");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.UserNovel", b =>
|
||||
{
|
||||
b.Property<string>("NovelUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("LastChapterRead")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("NovelUrl", "UserId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("UserNovels");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NovelTag", b =>
|
||||
{
|
||||
b.HasOne("Treestar.Shared.Models.DBDomain.Novel", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("NovelsUrl")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Treestar.Shared.Models.DBDomain.Tag", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("TagsTagValue")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.Chapter", b =>
|
||||
{
|
||||
b.HasOne("Treestar.Shared.Models.DBDomain.Novel", "Novel")
|
||||
.WithMany("Chapters")
|
||||
.HasForeignKey("NovelUrl")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Novel");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.Novel", b =>
|
||||
{
|
||||
b.HasOne("Treestar.Shared.Models.DBDomain.Author", "Author")
|
||||
.WithMany("Novels")
|
||||
.HasForeignKey("AuthorUrl");
|
||||
|
||||
b.Navigation("Author");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.UserNovel", b =>
|
||||
{
|
||||
b.HasOne("Treestar.Shared.Models.DBDomain.Novel", "Novel")
|
||||
.WithMany()
|
||||
.HasForeignKey("NovelUrl")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Treestar.Shared.Models.DBDomain.User", "User")
|
||||
.WithMany("WatchedNovels")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Novel");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.Author", b =>
|
||||
{
|
||||
b.Navigation("Novels");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.Novel", b =>
|
||||
{
|
||||
b.Navigation("Chapters");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.User", b =>
|
||||
{
|
||||
b.Navigation("WatchedNovels");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DBConnection.Migrations.PostgresSql
|
||||
{
|
||||
public partial class FixupUserNovelmodelandaddindexonUserEmail : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Users_Email",
|
||||
table: "Users",
|
||||
column: "Email");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Users_Email",
|
||||
table: "Users");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -176,6 +176,8 @@ namespace DBConnection.Migrations.PostgresSql
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Email");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
@@ -214,11 +216,13 @@ namespace DBConnection.Migrations.PostgresSql
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.Chapter", b =>
|
||||
{
|
||||
b.HasOne("Treestar.Shared.Models.DBDomain.Novel", null)
|
||||
b.HasOne("Treestar.Shared.Models.DBDomain.Novel", "Novel")
|
||||
.WithMany("Chapters")
|
||||
.HasForeignKey("NovelUrl")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Novel");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.Novel", b =>
|
||||
|
||||
@@ -0,0 +1,268 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using DBConnection.Contexts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DBConnection.Migrations.Sqlite
|
||||
{
|
||||
[DbContext(typeof(SqliteAppDbContext))]
|
||||
[Migration("20220717133151_Fix up UserNovel model and add index on User Email")]
|
||||
partial class FixupUserNovelmodelandaddindexonUserEmail
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "6.0.7");
|
||||
|
||||
modelBuilder.Entity("NovelTag", b =>
|
||||
{
|
||||
b.Property<string>("NovelsUrl")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("TagsTagValue")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("NovelsUrl", "TagsTagValue");
|
||||
|
||||
b.HasIndex("TagsTagValue");
|
||||
|
||||
b.ToTable("NovelTag");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.Author", b =>
|
||||
{
|
||||
b.Property<string>("Url")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("DateCreated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("DateModified")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Url");
|
||||
|
||||
b.ToTable("Authors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.Chapter", b =>
|
||||
{
|
||||
b.Property<string>("Url")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("ChapterNumber")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("DateCreated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("DateModified")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime?>("DatePosted")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime?>("DateUpdated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime?>("LastContentFetch")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("NovelUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("RawContent")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Url");
|
||||
|
||||
b.HasIndex("NovelUrl");
|
||||
|
||||
b.ToTable("Chapters");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.Novel", b =>
|
||||
{
|
||||
b.Property<string>("Url")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("AuthorUrl")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("DateCreated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("DateModified")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("DatePosted")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid>("Guid")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("LastUpdated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Url");
|
||||
|
||||
b.HasIndex("AuthorUrl");
|
||||
|
||||
b.HasIndex("Guid");
|
||||
|
||||
b.ToTable("Novels");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.Tag", b =>
|
||||
{
|
||||
b.Property<string>("TagValue")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("DateCreated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("DateModified")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("TagValue");
|
||||
|
||||
b.ToTable("Tags");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("DateCreated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("DateModified")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Email");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.UserNovel", b =>
|
||||
{
|
||||
b.Property<string>("NovelUrl")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("LastChapterRead")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("NovelUrl", "UserId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("UserNovels");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NovelTag", b =>
|
||||
{
|
||||
b.HasOne("Treestar.Shared.Models.DBDomain.Novel", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("NovelsUrl")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Treestar.Shared.Models.DBDomain.Tag", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("TagsTagValue")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.Chapter", b =>
|
||||
{
|
||||
b.HasOne("Treestar.Shared.Models.DBDomain.Novel", "Novel")
|
||||
.WithMany("Chapters")
|
||||
.HasForeignKey("NovelUrl")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Novel");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.Novel", b =>
|
||||
{
|
||||
b.HasOne("Treestar.Shared.Models.DBDomain.Author", "Author")
|
||||
.WithMany("Novels")
|
||||
.HasForeignKey("AuthorUrl");
|
||||
|
||||
b.Navigation("Author");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.UserNovel", b =>
|
||||
{
|
||||
b.HasOne("Treestar.Shared.Models.DBDomain.Novel", "Novel")
|
||||
.WithMany()
|
||||
.HasForeignKey("NovelUrl")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Treestar.Shared.Models.DBDomain.User", "User")
|
||||
.WithMany("WatchedNovels")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Novel");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.Author", b =>
|
||||
{
|
||||
b.Navigation("Novels");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.Novel", b =>
|
||||
{
|
||||
b.Navigation("Chapters");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.User", b =>
|
||||
{
|
||||
b.Navigation("WatchedNovels");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DBConnection.Migrations.Sqlite
|
||||
{
|
||||
public partial class FixupUserNovelmodelandaddindexonUserEmail : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Users_Email",
|
||||
table: "Users",
|
||||
column: "Email");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Users_Email",
|
||||
table: "Users");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -169,6 +169,8 @@ namespace DBConnection.Migrations.Sqlite
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Email");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
@@ -207,11 +209,13 @@ namespace DBConnection.Migrations.Sqlite
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.Chapter", b =>
|
||||
{
|
||||
b.HasOne("Treestar.Shared.Models.DBDomain.Novel", null)
|
||||
b.HasOne("Treestar.Shared.Models.DBDomain.Novel", "Novel")
|
||||
.WithMany("Chapters")
|
||||
.HasForeignKey("NovelUrl")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Novel");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Treestar.Shared.Models.DBDomain.Novel", b =>
|
||||
|
||||
@@ -19,24 +19,27 @@ public class NovelRepository : BaseRepository<Novel>, INovelRepository
|
||||
|
||||
public override async Task<Novel> Upsert(Novel entity, bool saveAfter=true)
|
||||
{
|
||||
var dbEntity = await GetIncluded(entity) ?? entity;
|
||||
// Author
|
||||
if (entity.Author != null)
|
||||
{
|
||||
entity.Author = await _authorRepository.Upsert(entity.Author, saveAfter);
|
||||
entity.Author = await _authorRepository.Upsert(entity.Author, false);
|
||||
}
|
||||
|
||||
//Tags
|
||||
var newTags = await _tagRepository.UpsertMany(entity.Tags, false);
|
||||
entity.Tags.Clear();
|
||||
entity.Tags = newTags.ToList();
|
||||
//chapters
|
||||
|
||||
//chapters are getting deleted now that their required...
|
||||
var newChapters = await _chapterRepository.UpsertMany(entity.Chapters, false);
|
||||
entity.Chapters.Clear();
|
||||
entity.Chapters = newChapters.ToList();
|
||||
|
||||
// update in db
|
||||
var dbEntity = await GetIncluded(entity) ?? entity;
|
||||
entity.Guid = dbEntity.Guid;
|
||||
DbContext.Entry(dbEntity).CurrentValues.SetValues(entity);
|
||||
dbEntity.Tags.Clear();
|
||||
dbEntity.Tags.AddRange(newTags);
|
||||
dbEntity.Chapters.Clear();
|
||||
dbEntity.Chapters.AddRange(newChapters);
|
||||
|
||||
if (DbContext.Entry(dbEntity).State == EntityState.Detached)
|
||||
{
|
||||
dbEntity.Guid = Guid.NewGuid();
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Treestar.Shared.Models.DBDomain
|
||||
public DateTime? DateUpdated { get; set; }
|
||||
public DateTime? LastContentFetch { get; set; }
|
||||
[Required]
|
||||
public string NovelUrl { get; set; }
|
||||
public Novel Novel { get; set; }
|
||||
|
||||
protected bool Equals(Chapter other)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Treestar.Shared.Models.DBDomain
|
||||
{
|
||||
[Index(nameof(Email))]
|
||||
public class User : BaseEntity
|
||||
{
|
||||
[Key]
|
||||
|
||||
@@ -4,10 +4,10 @@ namespace Treestar.Shared.Models.DBDomain
|
||||
{
|
||||
public class UserNovel
|
||||
{
|
||||
[JsonIgnore]
|
||||
public int UserId { get; set; }
|
||||
public string NovelUrl { get; set; }
|
||||
public Novel Novel { get; set; }
|
||||
[JsonIgnore]
|
||||
public User User { get; set; }
|
||||
public int LastChapterRead { get; set; }
|
||||
}
|
||||
|
||||
29
WebNovelPortal/Controllers/AccountController.cs
Normal file
29
WebNovelPortal/Controllers/AccountController.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace WebNovelPortal.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class AccountController : ControllerBase
|
||||
{
|
||||
[HttpGet]
|
||||
[Route("account/login")]
|
||||
public async Task Login()
|
||||
{
|
||||
await HttpContext.ChallengeAsync();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("account/logout")]
|
||||
public async Task Logout()
|
||||
{
|
||||
await HttpContext.SignOutAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ EXPOSE 443
|
||||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||
WORKDIR /src
|
||||
COPY ["WebNovelPortal/WebNovelPortal.csproj", "WebNovelPortal/"]
|
||||
COPY ["Treestar.Shared/Treestar.Shared.csproj", "Treestar.Shared/"]
|
||||
RUN dotnet restore "WebNovelPortal/WebNovelPortal.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/WebNovelPortal"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Newtonsoft.Json;
|
||||
using WebNovelPortal.AccessLayers;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
@@ -8,6 +9,10 @@ var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddScoped(fac => new WebApiAccessLayer(builder.Configuration["WebAPIUrl"]));
|
||||
builder.Services.AddRazorPages();
|
||||
builder.Services.AddServerSideBlazor();
|
||||
builder.Services.AddControllers().AddNewtonsoftJson(opt =>
|
||||
{
|
||||
opt.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
@@ -27,5 +32,6 @@ app.UseRouting();
|
||||
|
||||
app.MapBlazorHub();
|
||||
app.MapFallbackToPage("/_Host");
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
@@ -8,6 +8,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Authentication" />
|
||||
<Folder Include="Controllers" />
|
||||
<Folder Include="Data" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -15,4 +17,9 @@
|
||||
<ProjectReference Include="..\Treestar.Shared\Treestar.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.7" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.7" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -7,7 +7,7 @@ FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||
WORKDIR /src
|
||||
COPY ["WebNovelPortalAPI/WebNovelPortalAPI.csproj", "WebNovelPortalAPI/"]
|
||||
COPY ["DBConnection/DBConnection.csproj", "DBConnection/"]
|
||||
COPY ["Shared/Shared.csproj", "Shared/"]
|
||||
COPY ["Treestar.Shared/Treestar.Shared.csproj", "Treestar.Shared/"]
|
||||
RUN dotnet restore "WebNovelPortalAPI/WebNovelPortalAPI.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/WebNovelPortalAPI"
|
||||
|
||||
Reference in New Issue
Block a user