Implement collection suggestions and bulk show addition features
Added new API endpoints for suggesting collections based on existing shows and for bulk adding shows to collections. Enhanced the backend with necessary logic and DTOs to support these features. Updated the frontend to include new components for displaying collection suggestions and managing bulk additions, improving the user experience for collection management. Localization updates were made to support these new features in both English and Russian.
This commit is contained in:
@@ -107,10 +107,30 @@ public sealed class TmdbMetadataProvider(
|
||||
GetString(root, "overview"),
|
||||
PosterUrl(GetString(root, "poster_path")),
|
||||
GenresFrom(root),
|
||||
movie ? MovieCertification(root) : TvCertification(root)
|
||||
movie ? MovieCertification(root) : TvCertification(root),
|
||||
FranchiseFrom(root)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Франшиза фильма: TMDb отдаёт её прямо в ответе по фильму (<c>belongs_to_collection</c>),
|
||||
/// отдельного запроса не нужно. У сериалов этого поля нет.
|
||||
/// </summary>
|
||||
private static MetadataFranchise? FranchiseFrom(JsonElement root)
|
||||
{
|
||||
if (
|
||||
!root.TryGetProperty("belongs_to_collection", out var block)
|
||||
|| block.ValueKind != JsonValueKind.Object
|
||||
)
|
||||
return null;
|
||||
|
||||
var id = GetInt(block, "id");
|
||||
var name = GetString(block, "name");
|
||||
return id is null || string.IsNullOrWhiteSpace(name)
|
||||
? null
|
||||
: new MetadataFranchise(id.Value.ToString(CultureInfo.InvariantCulture), name.Trim());
|
||||
}
|
||||
|
||||
/// <summary>Код прокатного релиза в справочнике типов релизов TMDb.</summary>
|
||||
private const int TheatricalReleaseType = 3;
|
||||
|
||||
|
||||
+1407
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,38 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace TeleWave.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class ShowFranchise : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "FranchiseExternalId",
|
||||
table: "Shows",
|
||||
type: "character varying(64)",
|
||||
maxLength: 64,
|
||||
nullable: true
|
||||
);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "FranchiseName",
|
||||
table: "Shows",
|
||||
type: "character varying(256)",
|
||||
maxLength: 256,
|
||||
nullable: true
|
||||
);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(name: "FranchiseExternalId", table: "Shows");
|
||||
|
||||
migrationBuilder.DropColumn(name: "FranchiseName", table: "Shows");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -585,6 +585,14 @@ namespace TeleWave.Infrastructure.Migrations
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<string>("FranchiseExternalId")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("character varying(64)");
|
||||
|
||||
b.Property<string>("FranchiseName")
|
||||
.HasMaxLength(256)
|
||||
.HasColumnType("character varying(256)");
|
||||
|
||||
b.Property<int>("Kind")
|
||||
.HasColumnType("integer");
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ public class ShowConfiguration : IEntityTypeConfiguration<Show>
|
||||
builder.Property(x => x.MetadataProvider).HasMaxLength(16);
|
||||
builder.Property(x => x.MetadataExternalId).HasMaxLength(64);
|
||||
builder.Property(x => x.OriginalName).HasMaxLength(256);
|
||||
builder.Property(x => x.FranchiseExternalId).HasMaxLength(64);
|
||||
builder.Property(x => x.FranchiseName).HasMaxLength(256);
|
||||
|
||||
builder
|
||||
.HasMany(x => x.Episodes)
|
||||
|
||||
Reference in New Issue
Block a user