Revert "Unify ChapterRating with Rating"

This wasn't working out, there is still some duplicate code. But not
that much, and from the API, there is no different. Hooray!
This commit is contained in:
Amelia 2025-04-28 17:11:39 +02:00
parent 052b3f9fe4
commit 184cf46533
No known key found for this signature in database
GPG key ID: D6D0ECE365407EAA
21 changed files with 389 additions and 87 deletions

View 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;
}
}