Chapter/Issue level Reviews and Ratings (#3778)
Co-authored-by: Joseph Milazzo <josephmajora@gmail.com>
This commit is contained in:
parent
3b8997e46e
commit
4f7625ea77
60 changed files with 5097 additions and 497 deletions
40
API/Helpers/Builders/AppUserChapterRatingBuilder.cs
Normal file
40
API/Helpers/Builders/AppUserChapterRatingBuilder.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
#nullable enable
|
||||
using System;
|
||||
using API.Entities;
|
||||
|
||||
namespace API.Helpers.Builders;
|
||||
|
||||
public class ChapterRatingBuilder : IEntityBuilder<AppUserChapterRating>
|
||||
{
|
||||
private readonly AppUserChapterRating _rating;
|
||||
public AppUserChapterRating Build() => _rating;
|
||||
|
||||
public ChapterRatingBuilder(AppUserChapterRating? rating = null)
|
||||
{
|
||||
_rating = rating ?? new AppUserChapterRating();
|
||||
}
|
||||
|
||||
public ChapterRatingBuilder WithSeriesId(int seriesId)
|
||||
{
|
||||
_rating.SeriesId = seriesId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChapterRatingBuilder WithChapterId(int chapterId)
|
||||
{
|
||||
_rating.ChapterId = chapterId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChapterRatingBuilder WithRating(int rating)
|
||||
{
|
||||
_rating.Rating = Math.Clamp(rating, 0, 5);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChapterRatingBuilder WithBody(string body)
|
||||
{
|
||||
_rating.Review = body;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue