UX Overhaul Part 2 (#3112)

Co-authored-by: Robbie Davis <robbie@therobbiedavis.com>
This commit is contained in:
Joe Milazzo 2024-08-16 19:37:12 -05:00 committed by GitHub
parent 0247bc5012
commit 3d8aa2ad24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
192 changed files with 14808 additions and 1874 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,249 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace API.Data.Migrations
{
/// <inheritdoc />
public partial class ChapterMetadataLocks : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "AgeRatingLocked",
table: "Chapter",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "CharacterLocked",
table: "Chapter",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "ColoristLocked",
table: "Chapter",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "CoverArtistLocked",
table: "Chapter",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "EditorLocked",
table: "Chapter",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "GenresLocked",
table: "Chapter",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "ISBNLocked",
table: "Chapter",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "ImprintLocked",
table: "Chapter",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "InkerLocked",
table: "Chapter",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "LanguageLocked",
table: "Chapter",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "LettererLocked",
table: "Chapter",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "LocationLocked",
table: "Chapter",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "PencillerLocked",
table: "Chapter",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "PublisherLocked",
table: "Chapter",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "ReleaseDateLocked",
table: "Chapter",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "SummaryLocked",
table: "Chapter",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "TagsLocked",
table: "Chapter",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "TeamLocked",
table: "Chapter",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "TitleNameLocked",
table: "Chapter",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "TranslatorLocked",
table: "Chapter",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "WriterLocked",
table: "Chapter",
type: "INTEGER",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "AgeRatingLocked",
table: "Chapter");
migrationBuilder.DropColumn(
name: "CharacterLocked",
table: "Chapter");
migrationBuilder.DropColumn(
name: "ColoristLocked",
table: "Chapter");
migrationBuilder.DropColumn(
name: "CoverArtistLocked",
table: "Chapter");
migrationBuilder.DropColumn(
name: "EditorLocked",
table: "Chapter");
migrationBuilder.DropColumn(
name: "GenresLocked",
table: "Chapter");
migrationBuilder.DropColumn(
name: "ISBNLocked",
table: "Chapter");
migrationBuilder.DropColumn(
name: "ImprintLocked",
table: "Chapter");
migrationBuilder.DropColumn(
name: "InkerLocked",
table: "Chapter");
migrationBuilder.DropColumn(
name: "LanguageLocked",
table: "Chapter");
migrationBuilder.DropColumn(
name: "LettererLocked",
table: "Chapter");
migrationBuilder.DropColumn(
name: "LocationLocked",
table: "Chapter");
migrationBuilder.DropColumn(
name: "PencillerLocked",
table: "Chapter");
migrationBuilder.DropColumn(
name: "PublisherLocked",
table: "Chapter");
migrationBuilder.DropColumn(
name: "ReleaseDateLocked",
table: "Chapter");
migrationBuilder.DropColumn(
name: "SummaryLocked",
table: "Chapter");
migrationBuilder.DropColumn(
name: "TagsLocked",
table: "Chapter");
migrationBuilder.DropColumn(
name: "TeamLocked",
table: "Chapter");
migrationBuilder.DropColumn(
name: "TitleNameLocked",
table: "Chapter");
migrationBuilder.DropColumn(
name: "TranslatorLocked",
table: "Chapter");
migrationBuilder.DropColumn(
name: "WriterLocked",
table: "Chapter");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace API.Data.Migrations
{
/// <inheritdoc />
public partial class VolumeCoverLocked : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "CoverImageLocked",
table: "Volume",
type: "INTEGER",
nullable: false,
defaultValue: false);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CoverImageLocked",
table: "Volume");
}
}
}

View file

@ -719,6 +719,9 @@ namespace API.Data.Migrations
b.Property<int>("AgeRating")
.HasColumnType("INTEGER");
b.Property<bool>("AgeRatingLocked")
.HasColumnType("INTEGER");
b.Property<int>("AlternateCount")
.HasColumnType("INTEGER");
@ -731,9 +734,18 @@ namespace API.Data.Migrations
b.Property<int>("AvgHoursToRead")
.HasColumnType("INTEGER");
b.Property<bool>("CharacterLocked")
.HasColumnType("INTEGER");
b.Property<bool>("ColoristLocked")
.HasColumnType("INTEGER");
b.Property<int>("Count")
.HasColumnType("INTEGER");
b.Property<bool>("CoverArtistLocked")
.HasColumnType("INTEGER");
b.Property<string>("CoverImage")
.HasColumnType("TEXT");
@ -746,23 +758,47 @@ namespace API.Data.Migrations
b.Property<DateTime>("CreatedUtc")
.HasColumnType("TEXT");
b.Property<bool>("EditorLocked")
.HasColumnType("INTEGER");
b.Property<bool>("GenresLocked")
.HasColumnType("INTEGER");
b.Property<string>("ISBN")
.ValueGeneratedOnAdd()
.HasColumnType("TEXT")
.HasDefaultValue("");
b.Property<bool>("ISBNLocked")
.HasColumnType("INTEGER");
b.Property<bool>("ImprintLocked")
.HasColumnType("INTEGER");
b.Property<bool>("InkerLocked")
.HasColumnType("INTEGER");
b.Property<bool>("IsSpecial")
.HasColumnType("INTEGER");
b.Property<string>("Language")
.HasColumnType("TEXT");
b.Property<bool>("LanguageLocked")
.HasColumnType("INTEGER");
b.Property<DateTime>("LastModified")
.HasColumnType("TEXT");
b.Property<DateTime>("LastModifiedUtc")
.HasColumnType("TEXT");
b.Property<bool>("LettererLocked")
.HasColumnType("INTEGER");
b.Property<bool>("LocationLocked")
.HasColumnType("INTEGER");
b.Property<int>("MaxHoursToRead")
.HasColumnType("INTEGER");
@ -781,15 +817,24 @@ namespace API.Data.Migrations
b.Property<int>("Pages")
.HasColumnType("INTEGER");
b.Property<bool>("PencillerLocked")
.HasColumnType("INTEGER");
b.Property<string>("PrimaryColor")
.HasColumnType("TEXT");
b.Property<bool>("PublisherLocked")
.HasColumnType("INTEGER");
b.Property<string>("Range")
.HasColumnType("TEXT");
b.Property<DateTime>("ReleaseDate")
.HasColumnType("TEXT");
b.Property<bool>("ReleaseDateLocked")
.HasColumnType("INTEGER");
b.Property<string>("SecondaryColor")
.HasColumnType("TEXT");
@ -811,15 +856,30 @@ namespace API.Data.Migrations
b.Property<string>("Summary")
.HasColumnType("TEXT");
b.Property<bool>("SummaryLocked")
.HasColumnType("INTEGER");
b.Property<bool>("TagsLocked")
.HasColumnType("INTEGER");
b.Property<bool>("TeamLocked")
.HasColumnType("INTEGER");
b.Property<string>("Title")
.HasColumnType("TEXT");
b.Property<string>("TitleName")
.HasColumnType("TEXT");
b.Property<bool>("TitleNameLocked")
.HasColumnType("INTEGER");
b.Property<int>("TotalCount")
.HasColumnType("INTEGER");
b.Property<bool>("TranslatorLocked")
.HasColumnType("INTEGER");
b.Property<int>("VolumeId")
.HasColumnType("INTEGER");
@ -831,6 +891,9 @@ namespace API.Data.Migrations
b.Property<long>("WordCount")
.HasColumnType("INTEGER");
b.Property<bool>("WriterLocked")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("VolumeId");
@ -1983,6 +2046,9 @@ namespace API.Data.Migrations
b.Property<string>("CoverImage")
.HasColumnType("TEXT");
b.Property<bool>("CoverImageLocked")
.HasColumnType("INTEGER");
b.Property<DateTime>("Created")
.HasColumnType("TEXT");

View file

@ -22,12 +22,15 @@ public enum ChapterIncludes
None = 1,
Volumes = 2,
Files = 4,
People = 8
People = 8,
Genres = 16,
Tags = 32
}
public interface IChapterRepository
{
void Update(Chapter chapter);
void Remove(Chapter chapter);
Task<IEnumerable<Chapter>> GetChaptersByIdsAsync(IList<int> chapterIds, ChapterIncludes includes = ChapterIncludes.None);
Task<IChapterInfoDto?> GetChapterInfoDtoAsync(int chapterId);
Task<int> GetChapterTotalPagesAsync(int chapterId);
@ -60,6 +63,11 @@ public class ChapterRepository : IChapterRepository
_context.Entry(chapter).State = EntityState.Modified;
}
public void Remove(Chapter chapter)
{
_context.Chapter.Remove(chapter);
}
public async Task<IEnumerable<Chapter>> GetChaptersByIdsAsync(IList<int> chapterIds, ChapterIncludes includes = ChapterIncludes.None)
{
return await _context.Chapter

View file

@ -36,6 +36,8 @@ public interface IReadingListRepository
Task<IEnumerable<ReadingListItem>> GetReadingListItemsByIdAsync(int readingListId);
Task<IEnumerable<ReadingListDto>> GetReadingListDtosForSeriesAndUserAsync(int userId, int seriesId,
bool includePromoted);
Task<IEnumerable<ReadingListDto>> GetReadingListDtosForChapterAndUserAsync(int userId, int chapterId,
bool includePromoted);
void Remove(ReadingListItem item);
void Add(ReadingList list);
void BulkRemove(IEnumerable<ReadingListItem> items);
@ -166,6 +168,8 @@ public class ReadingListRepository : IReadingListRepository
.ToListAsync();
}
public void Remove(ReadingListItem item)
{
_context.ReadingListItem.Remove(item);
@ -204,6 +208,19 @@ public class ReadingListRepository : IReadingListRepository
return await query.ToListAsync();
}
public async Task<IEnumerable<ReadingListDto>> GetReadingListDtosForChapterAndUserAsync(int userId, int chapterId, bool includePromoted)
{
var query = _context.ReadingList
.Where(l => l.AppUserId == userId || (includePromoted && l.Promoted ))
.Where(l => l.Items.Any(i => i.ChapterId == chapterId))
.AsSplitQuery()
.OrderBy(l => l.Title)
.ProjectTo<ReadingListDto>(_mapper.ConfigurationProvider)
.AsNoTracking();
return await query.ToListAsync();
}
public async Task<ReadingList?> GetReadingListByIdAsync(int readingListId, ReadingListIncludes includes = ReadingListIncludes.None)
{
return await _context.ReadingList