Adjust ChapterRating Entity slightly
This commit is contained in:
parent
4f3cb6a407
commit
f85703eca2
9 changed files with 25 additions and 18 deletions
|
|
@ -87,7 +87,7 @@ public class ReviewController : BaseApiController
|
||||||
.WithChapterId(chapter.Id)
|
.WithChapterId(chapter.Id)
|
||||||
.WithRating(dto.Rating)
|
.WithRating(dto.Rating)
|
||||||
.WithReview(dto.Body)
|
.WithReview(dto.Body)
|
||||||
.WithProvider(RatingProvider.Kavita)
|
.WithProvider(ScrobbleProvider.Kavita)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
if (rating.Id == 0)
|
if (rating.Id == 0)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using API.Services.Plus;
|
using API.Entities;
|
||||||
|
using API.Services.Plus;
|
||||||
|
|
||||||
namespace API.DTOs.SeriesDetail;
|
namespace API.DTOs.SeriesDetail;
|
||||||
#nullable enable
|
#nullable enable
|
||||||
|
|
@ -56,4 +57,5 @@ public class UserReviewDto
|
||||||
/// If this review is External, which Provider did it come from
|
/// If this review is External, which Provider did it come from
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ScrobbleProvider Provider { get; set; } = ScrobbleProvider.Kavita;
|
public ScrobbleProvider Provider { get; set; } = ScrobbleProvider.Kavita;
|
||||||
|
public ReviewAuthority Authority { get; set; } = ReviewAuthority.User;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
namespace API.Data.Migrations
|
namespace API.Data.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(DataContext))]
|
[DbContext(typeof(DataContext))]
|
||||||
[Migration("20250425160251_ChapterRatings")]
|
[Migration("20250426142952_ChapterRating")]
|
||||||
partial class ChapterRatings
|
partial class ChapterRating
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
|
@ -207,6 +207,9 @@ namespace API.Data.Migrations
|
||||||
b.Property<int>("AppUserId")
|
b.Property<int>("AppUserId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("Authority")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<int>("ChapterId")
|
b.Property<int>("ChapterId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
namespace API.Data.Migrations
|
namespace API.Data.Migrations
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public partial class ChapterRatings : Migration
|
public partial class ChapterRating : Migration
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
|
@ -20,6 +20,7 @@ namespace API.Data.Migrations
|
||||||
HasBeenRated = table.Column<bool>(type: "INTEGER", nullable: false),
|
HasBeenRated = table.Column<bool>(type: "INTEGER", nullable: false),
|
||||||
Review = table.Column<string>(type: "TEXT", nullable: true),
|
Review = table.Column<string>(type: "TEXT", nullable: true),
|
||||||
Provider = table.Column<int>(type: "INTEGER", nullable: false),
|
Provider = table.Column<int>(type: "INTEGER", nullable: false),
|
||||||
|
Authority = table.Column<int>(type: "INTEGER", nullable: false),
|
||||||
SeriesId = table.Column<int>(type: "INTEGER", nullable: false),
|
SeriesId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||||
ChapterId = table.Column<int>(type: "INTEGER", nullable: false),
|
ChapterId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||||
VolumeId = table.Column<int>(type: "INTEGER", nullable: false),
|
VolumeId = table.Column<int>(type: "INTEGER", nullable: false),
|
||||||
|
|
@ -204,6 +204,9 @@ namespace API.Data.Migrations
|
||||||
b.Property<int>("AppUserId")
|
b.Property<int>("AppUserId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<int>("Authority")
|
||||||
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
b.Property<int>("ChapterId")
|
b.Property<int>("ChapterId")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,24 @@
|
||||||
using API.Entities.Enums;
|
using API.Entities.Enums;
|
||||||
|
using API.Services.Plus;
|
||||||
|
|
||||||
namespace API.Entities;
|
namespace API.Entities;
|
||||||
|
|
||||||
#nullable enable
|
#nullable enable
|
||||||
|
|
||||||
|
public enum ReviewAuthority
|
||||||
|
{
|
||||||
|
User = 0,
|
||||||
|
Critic = 1,
|
||||||
|
}
|
||||||
|
|
||||||
public class AppUserChapterRating
|
public class AppUserChapterRating
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public float Rating { get; set; }
|
public float Rating { get; set; }
|
||||||
public bool HasBeenRated { get; set; }
|
public bool HasBeenRated { get; set; }
|
||||||
public string? Review { get; set; }
|
public string? Review { get; set; }
|
||||||
public RatingProvider Provider {get; set; }
|
public ScrobbleProvider Provider { get; set; } = ScrobbleProvider.Kavita;
|
||||||
|
public ReviewAuthority Authority { get; set; } = ReviewAuthority.User;
|
||||||
|
|
||||||
public int SeriesId { get; set; }
|
public int SeriesId { get; set; }
|
||||||
public Series Series { get; set; } = null!;
|
public Series Series { get; set; } = null!;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
namespace API.Entities.Enums;
|
|
||||||
|
|
||||||
public enum RatingProvider
|
|
||||||
{
|
|
||||||
Kavita = 0,
|
|
||||||
AniList = 1,
|
|
||||||
Mal = 2,
|
|
||||||
CbrUser = 3,
|
|
||||||
CbrCritic = 4,
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using API.Entities;
|
using API.Entities;
|
||||||
using API.Entities.Enums;
|
using API.Entities.Enums;
|
||||||
|
using API.Services.Plus;
|
||||||
|
|
||||||
namespace API.Helpers.Builders;
|
namespace API.Helpers.Builders;
|
||||||
|
|
||||||
|
|
@ -47,7 +48,7 @@ public class ChapterRatingBuilder
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChapterRatingBuilder WithProvider(RatingProvider provider)
|
public ChapterRatingBuilder WithProvider(ScrobbleProvider provider)
|
||||||
{
|
{
|
||||||
_rating.Provider = provider;
|
_rating.Provider = provider;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ namespace API.Services.Plus;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Misleading name but is the source of data (like a review coming from AniList)
|
/// Misleading name but is the source of data (like a review coming from AniList)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>Keep <see cref="RatingProvider"/> in sync</remarks>
|
|
||||||
public enum ScrobbleProvider
|
public enum ScrobbleProvider
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue