Tweaks (#1890)
* Updated number inputs with a more mobile friendly control * Started writing lots of unit tests on PersonHelper to try and hammer out foreign constraint * Fixes side-nav actionable alignment * Added some unit tests * Buffed out the unit tests * Applied input modes throughout the app * Fixed a small bug in refresh token validation to make it work correctly * Try out a new way to block multithreading from interacting with people during series metadata update. * Fixed the lock code to properly lock, which should help with any constraint issues. * Locking notes * Tweaked locking on people to prevent a constraint issue. This slows down the scanner a bit, but not much. Will tweak after validating on a user's server. * Replaced all DBFactory.Series with SeriesBuilder. * Replaced all DBFactory.Volume() with VolumeBuilder * Replaced SeriesMetadata with Builder * Replaced DBFactory.CollectionTag * Lots of refactoring to streamline entity creation * Fixed one of the unit tests * Refactored all of new Library() * Removed tag and genre * Removed new SeriesMetadata * Refactored new Volume() * MangaFile() * ReadingList() * Refactored all of Chapter and ReadingList * Add title to all event widget flows * Updated Base Url to inform user it doesn't work for docker users with non-root user. * Added unit test coverage to FormatChapterTitle and FormatChapterName. * Started on Unit test for scanner, but need to finish it later. --------- Co-authored-by: Robbie Davis <robbie@therobbiedavis.com>
This commit is contained in:
parent
eec03d7e96
commit
385f61f9f0
105 changed files with 2257 additions and 2660 deletions
40
API/Helpers/Builders/AppUserBuilder.cs
Normal file
40
API/Helpers/Builders/AppUserBuilder.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using API.Data;
|
||||
using API.Entities;
|
||||
using Kavita.Common;
|
||||
|
||||
namespace API.Helpers.Builders;
|
||||
|
||||
public class AppUserBuilder : IEntityBuilder<AppUser>
|
||||
{
|
||||
private readonly AppUser _appUser;
|
||||
public AppUser Build() => _appUser;
|
||||
|
||||
public AppUserBuilder(string username, string email, SiteTheme? theme = null)
|
||||
{
|
||||
_appUser = new AppUser()
|
||||
{
|
||||
UserName = username,
|
||||
Email = email,
|
||||
ApiKey = HashUtil.ApiKey(),
|
||||
UserPreferences = new AppUserPreferences
|
||||
{
|
||||
Theme = theme ?? Seed.DefaultThemes.First()
|
||||
},
|
||||
ReadingLists = new List<ReadingList>(),
|
||||
Bookmarks = new List<AppUserBookmark>(),
|
||||
Libraries = new List<Library>(),
|
||||
Ratings = new List<AppUserRating>(),
|
||||
Progresses = new List<AppUserProgress>(),
|
||||
Devices = new List<Device>(),
|
||||
Id = 0
|
||||
};
|
||||
}
|
||||
|
||||
public AppUserBuilder WithLibrary(Library library)
|
||||
{
|
||||
_appUser.Libraries.Add(library);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using API.Entities;
|
||||
using API.Entities.Enums;
|
||||
using API.Services.Tasks.Scanner.Parser;
|
||||
|
||||
namespace API.Helpers.Builders;
|
||||
|
||||
|
@ -16,12 +17,43 @@ public class ChapterBuilder : IEntityBuilder<Chapter>
|
|||
{
|
||||
Range = string.IsNullOrEmpty(range) ? number : range,
|
||||
Title = string.IsNullOrEmpty(range) ? number : range,
|
||||
Number = API.Services.Tasks.Scanner.Parser.Parser.MinNumberFromRange(number) + string.Empty,
|
||||
Number = Services.Tasks.Scanner.Parser.Parser.MinNumberFromRange(number) + string.Empty,
|
||||
Files = new List<MangaFile>(),
|
||||
Pages = 1
|
||||
};
|
||||
}
|
||||
|
||||
public static ChapterBuilder FromParserInfo(ParserInfo info)
|
||||
{
|
||||
var specialTreatment = info.IsSpecialInfo();
|
||||
var specialTitle = specialTreatment ? info.Filename : info.Chapters;
|
||||
var builder = new ChapterBuilder(Services.Tasks.Scanner.Parser.Parser.DefaultChapter);
|
||||
return builder.WithNumber(specialTreatment ? Services.Tasks.Scanner.Parser.Parser.DefaultChapter : Services.Tasks.Scanner.Parser.Parser.MinNumberFromRange(info.Chapters) + string.Empty)
|
||||
.WithRange(specialTreatment ? info.Filename : info.Chapters)
|
||||
.WithTitle((specialTreatment && info.Format == MangaFormat.Epub)
|
||||
? info.Title
|
||||
: specialTitle)
|
||||
.WithIsSpecial(specialTreatment);
|
||||
}
|
||||
|
||||
public ChapterBuilder WithId(int id)
|
||||
{
|
||||
_chapter.Id = Math.Max(id, 0);
|
||||
return this;
|
||||
}
|
||||
|
||||
private ChapterBuilder WithNumber(string number)
|
||||
{
|
||||
_chapter.Number = number;
|
||||
return this;
|
||||
}
|
||||
|
||||
private ChapterBuilder WithRange(string range)
|
||||
{
|
||||
_chapter.Range = range;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChapterBuilder WithReleaseDate(DateTime time)
|
||||
{
|
||||
_chapter.ReleaseDate = time;
|
||||
|
@ -61,4 +93,24 @@ public class ChapterBuilder : IEntityBuilder<Chapter>
|
|||
_chapter.Files.Add(file);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChapterBuilder WithFiles(IList<MangaFile> files)
|
||||
{
|
||||
_chapter.Files = files ?? new List<MangaFile>();
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChapterBuilder WithLastModified(DateTime lastModified)
|
||||
{
|
||||
_chapter.LastModified = lastModified;
|
||||
_chapter.LastModifiedUtc = lastModified.ToUniversalTime();
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChapterBuilder WithCreated(DateTime created)
|
||||
{
|
||||
_chapter.Created = created;
|
||||
_chapter.CreatedUtc = created.ToUniversalTime();
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
57
API/Helpers/Builders/CollectionTagBuilder.cs
Normal file
57
API/Helpers/Builders/CollectionTagBuilder.cs
Normal file
|
@ -0,0 +1,57 @@
|
|||
using System.Collections.Generic;
|
||||
using API.Entities;
|
||||
using API.Entities.Metadata;
|
||||
using API.Extensions;
|
||||
|
||||
namespace API.Helpers.Builders;
|
||||
|
||||
public class CollectionTagBuilder : IEntityBuilder<CollectionTag>
|
||||
{
|
||||
private readonly CollectionTag _collectionTag;
|
||||
public CollectionTag Build() => _collectionTag;
|
||||
|
||||
public CollectionTagBuilder(string title, bool promoted = false)
|
||||
{
|
||||
title = title.Trim();
|
||||
_collectionTag = new CollectionTag()
|
||||
{
|
||||
Id = 0,
|
||||
NormalizedTitle = title.ToNormalized(),
|
||||
Title = title,
|
||||
Promoted = promoted,
|
||||
Summary = string.Empty,
|
||||
SeriesMetadatas = new List<SeriesMetadata>()
|
||||
};
|
||||
}
|
||||
|
||||
public CollectionTagBuilder WithId(int id)
|
||||
{
|
||||
_collectionTag.Id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CollectionTagBuilder WithSummary(string summary)
|
||||
{
|
||||
_collectionTag.Summary = summary;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CollectionTagBuilder WithIsPromoted(bool promoted)
|
||||
{
|
||||
_collectionTag.Promoted = promoted;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CollectionTagBuilder WithSeriesMetadata(SeriesMetadata seriesMetadata)
|
||||
{
|
||||
_collectionTag.SeriesMetadatas ??= new List<SeriesMetadata>();
|
||||
_collectionTag.SeriesMetadatas.Add(seriesMetadata);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CollectionTagBuilder WithCoverImage(string cover)
|
||||
{
|
||||
_collectionTag.CoverImage = cover;
|
||||
return this;
|
||||
}
|
||||
}
|
30
API/Helpers/Builders/DeviceBuilder.cs
Normal file
30
API/Helpers/Builders/DeviceBuilder.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using API.Entities;
|
||||
using API.Entities.Enums.Device;
|
||||
|
||||
namespace API.Helpers.Builders;
|
||||
|
||||
public class DeviceBuilder : IEntityBuilder<Device>
|
||||
{
|
||||
private readonly Device _device;
|
||||
public Device Build() => _device;
|
||||
|
||||
public DeviceBuilder(string name)
|
||||
{
|
||||
_device = new Device()
|
||||
{
|
||||
Name = name,
|
||||
Platform = DevicePlatform.Custom
|
||||
};
|
||||
}
|
||||
|
||||
public DeviceBuilder WithPlatform(DevicePlatform platform)
|
||||
{
|
||||
_device.Platform = platform;
|
||||
return this;
|
||||
}
|
||||
public DeviceBuilder WithEmail(string email)
|
||||
{
|
||||
_device.EmailAddress = email;
|
||||
return this;
|
||||
}
|
||||
}
|
19
API/Helpers/Builders/FolderPathBuilder.cs
Normal file
19
API/Helpers/Builders/FolderPathBuilder.cs
Normal file
|
@ -0,0 +1,19 @@
|
|||
using System.IO;
|
||||
using API.Entities;
|
||||
|
||||
namespace API.Helpers.Builders;
|
||||
|
||||
public class FolderPathBuilder : IEntityBuilder<FolderPath>
|
||||
{
|
||||
private readonly FolderPath _folderPath;
|
||||
public FolderPath Build() => _folderPath;
|
||||
|
||||
public FolderPathBuilder(string directory)
|
||||
{
|
||||
_folderPath = new FolderPath()
|
||||
{
|
||||
Path = directory,
|
||||
Id = 0
|
||||
};
|
||||
}
|
||||
}
|
30
API/Helpers/Builders/GenreBuilder.cs
Normal file
30
API/Helpers/Builders/GenreBuilder.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using System.Collections.Generic;
|
||||
using API.Entities;
|
||||
using API.Entities.Metadata;
|
||||
using API.Extensions;
|
||||
|
||||
namespace API.Helpers.Builders;
|
||||
|
||||
public class GenreBuilder : IEntityBuilder<Genre>
|
||||
{
|
||||
private readonly Genre _genre;
|
||||
public Genre Build() => _genre;
|
||||
|
||||
public GenreBuilder(string name)
|
||||
{
|
||||
_genre = new Genre()
|
||||
{
|
||||
Title = name.Trim().SentenceCase(),
|
||||
NormalizedTitle = name.ToNormalized(),
|
||||
Chapters = new List<Chapter>(),
|
||||
SeriesMetadatas = new List<SeriesMetadata>()
|
||||
};
|
||||
}
|
||||
|
||||
public GenreBuilder WithSeriesMetadata(SeriesMetadata seriesMetadata)
|
||||
{
|
||||
_genre.SeriesMetadatas ??= new List<SeriesMetadata>();
|
||||
_genre.SeriesMetadatas.Add(seriesMetadata);
|
||||
return this;
|
||||
}
|
||||
}
|
46
API/Helpers/Builders/LibraryBuilder.cs
Normal file
46
API/Helpers/Builders/LibraryBuilder.cs
Normal file
|
@ -0,0 +1,46 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using API.Entities;
|
||||
using API.Entities.Enums;
|
||||
using SQLitePCL;
|
||||
|
||||
namespace API.Helpers.Builders;
|
||||
|
||||
public class LibraryBuilder : IEntityBuilder<Library>
|
||||
{
|
||||
private readonly Library _library;
|
||||
public Library Build() => _library;
|
||||
|
||||
public LibraryBuilder(string name, LibraryType type = LibraryType.Manga)
|
||||
{
|
||||
_library = new Library()
|
||||
{
|
||||
Name = name,
|
||||
Type = type,
|
||||
Series = new List<Series>(),
|
||||
Folders = new List<FolderPath>(),
|
||||
AppUsers = new List<AppUser>()
|
||||
};
|
||||
}
|
||||
|
||||
public LibraryBuilder WithFolderPath(FolderPath folderPath)
|
||||
{
|
||||
_library.Folders ??= new List<FolderPath>();
|
||||
if (_library.Folders.All(f => f != folderPath)) _library.Folders.Add(folderPath);
|
||||
return this;
|
||||
}
|
||||
|
||||
public LibraryBuilder WithSeries(Series series)
|
||||
{
|
||||
_library.Series ??= new List<Series>();
|
||||
_library.Series.Add(series);
|
||||
return this;
|
||||
}
|
||||
|
||||
public LibraryBuilder WithAppUser(AppUser appUser)
|
||||
{
|
||||
_library.AppUsers ??= new List<AppUser>();
|
||||
_library.AppUsers.Add(appUser);
|
||||
return this;
|
||||
}
|
||||
}
|
61
API/Helpers/Builders/MangaFileBuilder.cs
Normal file
61
API/Helpers/Builders/MangaFileBuilder.cs
Normal file
|
@ -0,0 +1,61 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using API.Entities;
|
||||
using API.Entities.Enums;
|
||||
|
||||
namespace API.Helpers.Builders;
|
||||
|
||||
public class MangaFileBuilder : IEntityBuilder<MangaFile>
|
||||
{
|
||||
private readonly MangaFile _mangaFile;
|
||||
public MangaFile Build() => _mangaFile;
|
||||
|
||||
public MangaFileBuilder(string filePath, MangaFormat format, int pages = 0)
|
||||
{
|
||||
_mangaFile = new MangaFile()
|
||||
{
|
||||
FilePath = filePath,
|
||||
Format = format,
|
||||
Pages = pages,
|
||||
LastModified = File.GetLastWriteTime(filePath),
|
||||
LastModifiedUtc = File.GetLastWriteTimeUtc(filePath),
|
||||
};
|
||||
}
|
||||
|
||||
public MangaFileBuilder WithFormat(MangaFormat format)
|
||||
{
|
||||
_mangaFile.Format = format;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MangaFileBuilder WithPages(int pages)
|
||||
{
|
||||
_mangaFile.Pages = Math.Max(pages, 0);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MangaFileBuilder WithExtension(string extension)
|
||||
{
|
||||
_mangaFile.Extension = extension.ToLowerInvariant();
|
||||
return this;
|
||||
}
|
||||
|
||||
public MangaFileBuilder WithBytes(long bytes)
|
||||
{
|
||||
_mangaFile.Bytes = Math.Max(0, bytes);
|
||||
return this;
|
||||
}
|
||||
|
||||
public MangaFileBuilder WithLastModified(DateTime dateTime)
|
||||
{
|
||||
_mangaFile.LastModified = dateTime;
|
||||
_mangaFile.LastModifiedUtc = dateTime.ToUniversalTime();
|
||||
return this;
|
||||
}
|
||||
|
||||
public MangaFileBuilder WithId(int id)
|
||||
{
|
||||
_mangaFile.Id = Math.Max(id, 0);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -23,6 +23,17 @@ public class PersonBuilder : IEntityBuilder<Person>
|
|||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Only call for Unit Tests
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public PersonBuilder WithId(int id)
|
||||
{
|
||||
_person.Id = id;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PersonBuilder WithSeriesMetadata(SeriesMetadata metadata)
|
||||
{
|
||||
_person.SeriesMetadatas ??= new List<SeriesMetadata>();
|
||||
|
|
57
API/Helpers/Builders/ReadingListBuilder.cs
Normal file
57
API/Helpers/Builders/ReadingListBuilder.cs
Normal file
|
@ -0,0 +1,57 @@
|
|||
using System.Collections.Generic;
|
||||
using API.Entities;
|
||||
using API.Entities.Enums;
|
||||
using API.Extensions;
|
||||
|
||||
namespace API.Helpers.Builders;
|
||||
|
||||
public class ReadingListBuilder : IEntityBuilder<ReadingList>
|
||||
{
|
||||
private readonly ReadingList _readingList;
|
||||
public ReadingList Build() => _readingList;
|
||||
|
||||
public ReadingListBuilder(string title)
|
||||
{
|
||||
title = title.Trim();
|
||||
_readingList = new ReadingList()
|
||||
{
|
||||
Title = title,
|
||||
NormalizedTitle = title.ToNormalized(),
|
||||
Summary = string.Empty,
|
||||
Promoted = false,
|
||||
Items = new List<ReadingListItem>(),
|
||||
AgeRating = AgeRating.Unknown
|
||||
};
|
||||
}
|
||||
|
||||
public ReadingListBuilder WithSummary(string summary)
|
||||
{
|
||||
_readingList.Summary = summary ?? string.Empty;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ReadingListBuilder WithItem(ReadingListItem item)
|
||||
{
|
||||
_readingList.Items ??= new List<ReadingListItem>();
|
||||
_readingList.Items.Add(item);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ReadingListBuilder WithRating(AgeRating rating)
|
||||
{
|
||||
_readingList.AgeRating = rating;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ReadingListBuilder WithPromoted(bool promoted)
|
||||
{
|
||||
_readingList.Promoted = promoted;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ReadingListBuilder WithCoverImage(string coverImage)
|
||||
{
|
||||
_readingList.CoverImage = coverImage;
|
||||
return this;
|
||||
}
|
||||
}
|
21
API/Helpers/Builders/ReadingListItemBuilder.cs
Normal file
21
API/Helpers/Builders/ReadingListItemBuilder.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using API.Entities;
|
||||
|
||||
namespace API.Helpers.Builders;
|
||||
|
||||
public class ReadingListItemBuilder : IEntityBuilder<ReadingListItem>
|
||||
{
|
||||
private readonly ReadingListItem _item;
|
||||
public ReadingListItem Build() => _item;
|
||||
|
||||
public ReadingListItemBuilder(int index, int seriesId, int volumeId, int chapterId)
|
||||
{
|
||||
_item = new ReadingListItem()
|
||||
{
|
||||
Order = index,
|
||||
ChapterId = chapterId,
|
||||
SeriesId = seriesId,
|
||||
VolumeId = volumeId
|
||||
};
|
||||
|
||||
}
|
||||
}
|
|
@ -26,13 +26,22 @@ public class SeriesBuilder : IEntityBuilder<Series>
|
|||
SortName = name,
|
||||
NormalizedName = name.ToNormalized(),
|
||||
NormalizedLocalizedName = name.ToNormalized(),
|
||||
Metadata = new SeriesMetadata(),
|
||||
Metadata = new SeriesMetadataBuilder().Build(),
|
||||
Volumes = new List<Volume>()
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the localized name. If null or empty, defaults back to the
|
||||
/// </summary>
|
||||
/// <param name="localizedName"></param>
|
||||
/// <returns></returns>
|
||||
public SeriesBuilder WithLocalizedName(string localizedName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(localizedName))
|
||||
{
|
||||
localizedName = _series.Name;
|
||||
}
|
||||
_series.LocalizedName = localizedName;
|
||||
_series.NormalizedLocalizedName = localizedName.ToNormalized();
|
||||
return this;
|
||||
|
@ -68,4 +77,16 @@ public class SeriesBuilder : IEntityBuilder<Series>
|
|||
_series.Pages = pages;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SeriesBuilder WithCoverImage(string cover)
|
||||
{
|
||||
_series.CoverImage = cover;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SeriesBuilder WithLibraryId(int id)
|
||||
{
|
||||
_series.LibraryId = id;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,14 +23,26 @@ public class SeriesMetadataBuilder : IEntityBuilder<SeriesMetadata>
|
|||
|
||||
public SeriesMetadataBuilder WithCollectionTag(CollectionTag tag)
|
||||
{
|
||||
_seriesMetadata.CollectionTags ??= new List<API.Entities.CollectionTag>();
|
||||
_seriesMetadata.CollectionTags ??= new List<CollectionTag>();
|
||||
_seriesMetadata.CollectionTags.Add(tag);
|
||||
return this;
|
||||
}
|
||||
public SeriesMetadataBuilder WithCollectionTags(IList<CollectionTag> tags)
|
||||
{
|
||||
if (tags == null) return this;
|
||||
_seriesMetadata.CollectionTags ??= new List<CollectionTag>();
|
||||
_seriesMetadata.CollectionTags = tags;
|
||||
return this;
|
||||
}
|
||||
public SeriesMetadataBuilder WithPublicationStatus(PublicationStatus status)
|
||||
{
|
||||
_seriesMetadata.PublicationStatus = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SeriesMetadataBuilder WithAgeRating(AgeRating rating)
|
||||
{
|
||||
_seriesMetadata.AgeRating = rating;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
30
API/Helpers/Builders/TagBuilder.cs
Normal file
30
API/Helpers/Builders/TagBuilder.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using System.Collections.Generic;
|
||||
using API.Entities;
|
||||
using API.Entities.Metadata;
|
||||
using API.Extensions;
|
||||
|
||||
namespace API.Helpers.Builders;
|
||||
|
||||
public class TagBuilder : IEntityBuilder<Tag>
|
||||
{
|
||||
private readonly Tag _tag;
|
||||
public Tag Build() => _tag;
|
||||
|
||||
public TagBuilder(string name)
|
||||
{
|
||||
_tag = new Tag()
|
||||
{
|
||||
Title = name.Trim().SentenceCase(),
|
||||
NormalizedTitle = name.ToNormalized(),
|
||||
Chapters = new List<Chapter>(),
|
||||
SeriesMetadatas = new List<SeriesMetadata>()
|
||||
};
|
||||
}
|
||||
|
||||
public TagBuilder WithSeriesMetadata(SeriesMetadata seriesMetadata)
|
||||
{
|
||||
_tag.SeriesMetadatas ??= new List<SeriesMetadata>();
|
||||
_tag.SeriesMetadatas.Add(seriesMetadata);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -12,7 +12,12 @@ public class VolumeBuilder : IEntityBuilder<Volume>
|
|||
|
||||
public VolumeBuilder(string volumeNumber)
|
||||
{
|
||||
_volume = DbFactory.Volume(volumeNumber);
|
||||
_volume = new Volume()
|
||||
{
|
||||
Name = volumeNumber,
|
||||
Number = (int) Services.Tasks.Scanner.Parser.Parser.MinNumberFromRange(volumeNumber),
|
||||
Chapters = new List<Chapter>()
|
||||
};
|
||||
}
|
||||
|
||||
public VolumeBuilder WithName(string name)
|
||||
|
@ -40,4 +45,16 @@ public class VolumeBuilder : IEntityBuilder<Volume>
|
|||
_volume.Pages = _volume.Chapters.Sum(c => c.Pages);
|
||||
return this;
|
||||
}
|
||||
|
||||
public VolumeBuilder WithSeriesId(int seriesId)
|
||||
{
|
||||
_volume.SeriesId = seriesId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public VolumeBuilder WithCoverImage(string cover)
|
||||
{
|
||||
_volume.CoverImage = cover;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue