Add 'backend/' from commit '040cfd7a75423d4e6136e58a67b40579af4ee966'
git-subtree-dir: backend git-subtree-mainline:ab911955edgit-subtree-split:040cfd7a75
This commit is contained in:
21
backend/src/Web/Features/Contents/Data/Content.cs
Normal file
21
backend/src/Web/Features/Contents/Data/Content.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Data;
|
||||
|
||||
public class Content
|
||||
{
|
||||
public Guid Id { get; init; }
|
||||
public Guid CreatedBy { get; init; }
|
||||
public Creator? Creator { get; set; }
|
||||
public DateTimeOffset CreatedAt { get; init; }
|
||||
public Guid? DeletedBy { get; set; }
|
||||
public DateTimeOffset? DeletedAt { get; set; }
|
||||
[MaxLength(128)] public required string Title { get; set; }
|
||||
|
||||
[MaxLength(512)] public string? ThumbnailUrl { get; set; } = "";
|
||||
[MaxLength(2048)] public string Description { get; set; } = "";
|
||||
[MaxLength(2048)] public string? HtmlFileUrl { get; set; } = "";
|
||||
public IList<ContentReaction> Reactions { get; set; } = new List<ContentReaction>();
|
||||
public string[]? Urls { get; init; }
|
||||
|
||||
}
|
||||
68
backend/src/Web/Features/Contents/Data/ContentDbContext.cs
Normal file
68
backend/src/Web/Features/Contents/Data/ContentDbContext.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
namespace Hutopy.Web.Features.Contents.Data;
|
||||
|
||||
public class ContentDbContext(
|
||||
DbContextOptions<ContentDbContext> options)
|
||||
: DbContext(options)
|
||||
{
|
||||
public const string SchemaName = "Content";
|
||||
|
||||
public DbSet<Content> Contents => Set<Content>();
|
||||
public DbSet<Creator> Creators => Set<Creator>();
|
||||
|
||||
protected override void OnModelCreating(
|
||||
ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.HasDefaultSchema(SchemaName);
|
||||
|
||||
modelBuilder
|
||||
.Entity<Content>()
|
||||
.Property(c => c.CreatedAt)
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
modelBuilder
|
||||
.Entity<Content>()
|
||||
.HasOne(c => c.Creator)
|
||||
.WithMany()
|
||||
.HasForeignKey(c => c.CreatedBy);
|
||||
|
||||
modelBuilder
|
||||
.Entity<Content>()
|
||||
.OwnsMany(c => c.Reactions)
|
||||
.ToTable("Reactions");
|
||||
|
||||
modelBuilder
|
||||
.Entity<Content>()
|
||||
.Property(c => c.ThumbnailUrl);
|
||||
|
||||
modelBuilder
|
||||
.Entity<Creator>()
|
||||
.Property(x => x.NormalizedName)
|
||||
.HasComputedColumnSql("LOWER( \"Content\".\"Creators\".\"Name\")", stored: true);
|
||||
|
||||
modelBuilder
|
||||
.Entity<Creator>()
|
||||
.HasIndex(x => x.NormalizedName)
|
||||
.IsUnique();
|
||||
|
||||
modelBuilder
|
||||
.Entity<Creator>()
|
||||
.OwnsOne<Socials>(x => x.Socials)
|
||||
.ToTable(nameof(Socials));
|
||||
|
||||
modelBuilder
|
||||
.Entity<Creator>()
|
||||
.OwnsOne<Colors>(x => x.Colors)
|
||||
.ToTable(nameof(Colors));
|
||||
|
||||
modelBuilder
|
||||
.Entity<Creator>()
|
||||
.OwnsOne<Images>(x => x.Images)
|
||||
.ToTable(nameof(Images));
|
||||
|
||||
modelBuilder
|
||||
.Entity<Creator>()
|
||||
.OwnsOne<PresentationInfos>(x => x.PresentationInfos)
|
||||
.ToTable(nameof(PresentationInfos));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
namespace Hutopy.Web.Features.Contents.Data;
|
||||
|
||||
public static class InitializerExtensions
|
||||
{
|
||||
public static async Task InitialiseContentDbContextAsync(this WebApplication app)
|
||||
{
|
||||
using var scope = app.Services.CreateScope();
|
||||
|
||||
var initializer = scope.ServiceProvider.GetRequiredService<ContentDbContextInitializer>();
|
||||
|
||||
await initializer.InitialiseAsync();
|
||||
}
|
||||
}
|
||||
|
||||
public class ContentDbContextInitializer(
|
||||
ILogger<ContentDbContextInitializer> logger,
|
||||
ContentDbContext context
|
||||
)
|
||||
{
|
||||
public async Task InitialiseAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
await context.Database.MigrateAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, "An error occurred while initialising the content database.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
backend/src/Web/Features/Contents/Data/ContentReaction.cs
Normal file
11
backend/src/Web/Features/Contents/Data/ContentReaction.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Hutopy.Web.Features.Contents.Data.Enums;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Data;
|
||||
|
||||
public class ContentReaction
|
||||
{
|
||||
public required Reaction Reaction { get; set; }
|
||||
public required Guid UserId { get; set; }
|
||||
[MaxLength(128)] public required string UserName { get; set; }
|
||||
}
|
||||
72
backend/src/Web/Features/Contents/Data/Creator.cs
Normal file
72
backend/src/Web/Features/Contents/Data/Creator.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Data;
|
||||
|
||||
public class Creator
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public Guid CreatedBy { get; set; }
|
||||
public DateTimeOffset CreatedAt { get; init; }
|
||||
public bool AcceptDonation { get; set; }
|
||||
public bool Verified { get; set; }
|
||||
[MaxLength(255)] public string Name { get; set; } = null!;
|
||||
[MaxLength(255)] public string NormalizedName { get; set; } = null!;
|
||||
[MaxLength(255)] public string? Title { get; set; }
|
||||
public Socials Socials { get; set; } = new();
|
||||
public Colors Colors { get; set; } = new();
|
||||
public Images Images { get; set; } = new();
|
||||
public PresentationInfos PresentationInfos { get; set; } = new();
|
||||
}
|
||||
|
||||
public class Colors
|
||||
{
|
||||
[MaxLength(9)] public string Primary { get; set; } = null!;
|
||||
[MaxLength(9)] public string Secondary { get; set; } = null!;
|
||||
[MaxLength(9)] public string Background { get; set; } = null!;
|
||||
[MaxLength(9)] public string Surface { get; set; } = null!;
|
||||
[MaxLength(9)] public string Error { get; set; } = null!;
|
||||
[MaxLength(9)] public string OnPrimary { get; set; } = null!;
|
||||
[MaxLength(9)] public string OnSecondary { get; set; } = null!;
|
||||
[MaxLength(9)] public string OnBackground { get; set; } = null!;
|
||||
[MaxLength(9)] public string OnSurface { get; set; } = null!;
|
||||
[MaxLength(9)] public string OnError { get; set; } = null!;
|
||||
}
|
||||
|
||||
public class Socials
|
||||
{
|
||||
[MaxLength(255)] public string? FacebookUrl { get; set; }
|
||||
[MaxLength(255)] public string? InstagramUrl { get; set; }
|
||||
[MaxLength(255)] public string? XUrl { get; set; }
|
||||
[MaxLength(255)] public string? LinkedInUrl { get; set; }
|
||||
[MaxLength(255)] public string? TikTokUrl { get; set; }
|
||||
[MaxLength(255)] public string? YoutubeUrl { get; set; }
|
||||
[MaxLength(255)] public string? RedditUrl { get; set; }
|
||||
[MaxLength(255)] public string? WebsiteUrl { get; set; }
|
||||
}
|
||||
|
||||
public class Images
|
||||
{
|
||||
[MaxLength(255)] public string? Banner { get; set; }
|
||||
[MaxLength(255)] public string? Logo { get; set; }
|
||||
}
|
||||
|
||||
public class PresentationInfos
|
||||
{
|
||||
[MaxLength(255)] public string PhoneNumber { get; set; } = string.Empty;
|
||||
[MaxLength(255)] public string Email { get; set; } = string.Empty;
|
||||
[MaxLength(2000)] public string Title { get; set; } = string.Empty;
|
||||
[MaxLength(2000)] public string MainImageUrl { get; set; } = string.Empty;
|
||||
[MaxLength(10000)] public string MainImageText { get; set; } = string.Empty;
|
||||
[MaxLength(10000)] public string MainVideoText { get; set; } = string.Empty;
|
||||
[MaxLength(2000)] public string ImagesSubtitle { get; set; } = string.Empty;
|
||||
[MaxLength(2000)] public string Image1Url { get; set; } = string.Empty;
|
||||
[MaxLength(2000)] public string Image2Url { get; set; } = string.Empty;
|
||||
[MaxLength(2000)] public string Image3Url { get; set; } = string.Empty;
|
||||
[MaxLength(2000)] public string Image4Url { get; set; } = string.Empty;
|
||||
[MaxLength(10000)] public string ImagesText { get; set; } = string.Empty;
|
||||
[MaxLength(2000)] public string VideoSubtitle { get; set; } = string.Empty;
|
||||
[MaxLength(2000)] public string VideoSubtitleMain { get; set; } = string.Empty;
|
||||
[MaxLength(2000)] public string VideoUrlMain { get; set; } = string.Empty;
|
||||
[MaxLength(2000)] public string VideoUrl { get; set; } = string.Empty;
|
||||
[MaxLength(10000)] public string VideoText { get; set; } = string.Empty;
|
||||
}
|
||||
13
backend/src/Web/Features/Contents/Data/Enums/Reaction.cs
Normal file
13
backend/src/Web/Features/Contents/Data/Enums/Reaction.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace Hutopy.Web.Features.Contents.Data.Enums;
|
||||
|
||||
public enum Reaction
|
||||
{
|
||||
None = 0,
|
||||
Like = 1,
|
||||
Dislike = 2,
|
||||
Love = 3,
|
||||
Haha = 4,
|
||||
Wow = 5,
|
||||
Sad = 6,
|
||||
Angry = 7
|
||||
}
|
||||
285
backend/src/Web/Features/Contents/Data/Migrations/20241020202641_Initial.Designer.cs
generated
Normal file
285
backend/src/Web/Features/Contents/Data/Migrations/20241020202641_Initial.Designer.cs
generated
Normal file
@@ -0,0 +1,285 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ContentDbContext))]
|
||||
[Migration("20241020202641_Initial")]
|
||||
partial class Initial
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("Content")
|
||||
.HasAnnotation("ProductVersion", "8.0.10")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Content", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset?>("DeletedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid?>("DeletedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<string>("HtmlFileUrl")
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b.Property<string[]>("Urls")
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreatedBy");
|
||||
|
||||
b.ToTable("Contents", "Content");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Creators", "Content");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Content", b =>
|
||||
{
|
||||
b.HasOne("Hutopy.Web.Features.Contents.Data.Creator", "Creator")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedBy")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.OwnsMany("Hutopy.Web.Features.Contents.Data.ContentReaction", "Reactions", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("ContentId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property<int>("Id"));
|
||||
|
||||
b1.Property<int>("Reaction")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b1.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("UserName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b1.HasKey("ContentId", "Id");
|
||||
|
||||
b1.ToTable("Reactions", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("ContentId");
|
||||
});
|
||||
|
||||
b.Navigation("Creator");
|
||||
|
||||
b.Navigation("Reactions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b =>
|
||||
{
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Colors", "Colors", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("Background")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Error")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnBackground")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnError")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnPrimary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnSecondary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnSurface")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Primary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Secondary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Surface")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Colors", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Images", "Images", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("Banner")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("Logo")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Images", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Socials", "Socials", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("FacebookUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("InstagramUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("LinkedInUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("RedditUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("TikTokUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("WebsiteUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("XUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("YoutubeUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Socials", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.Navigation("Colors")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Images")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Socials")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Initial : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.EnsureSchema(
|
||||
name: "Content");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Creators",
|
||||
schema: "Content",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
CreatedBy = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
Name = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
||||
Title = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Creators", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Colors",
|
||||
schema: "Content",
|
||||
columns: table => new
|
||||
{
|
||||
CreatorId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Primary = table.Column<string>(type: "character varying(9)", maxLength: 9, nullable: false),
|
||||
Secondary = table.Column<string>(type: "character varying(9)", maxLength: 9, nullable: false),
|
||||
Background = table.Column<string>(type: "character varying(9)", maxLength: 9, nullable: false),
|
||||
Surface = table.Column<string>(type: "character varying(9)", maxLength: 9, nullable: false),
|
||||
Error = table.Column<string>(type: "character varying(9)", maxLength: 9, nullable: false),
|
||||
OnPrimary = table.Column<string>(type: "character varying(9)", maxLength: 9, nullable: false),
|
||||
OnSecondary = table.Column<string>(type: "character varying(9)", maxLength: 9, nullable: false),
|
||||
OnBackground = table.Column<string>(type: "character varying(9)", maxLength: 9, nullable: false),
|
||||
OnSurface = table.Column<string>(type: "character varying(9)", maxLength: 9, nullable: false),
|
||||
OnError = table.Column<string>(type: "character varying(9)", maxLength: 9, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Colors", x => x.CreatorId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Colors_Creators_CreatorId",
|
||||
column: x => x.CreatorId,
|
||||
principalSchema: "Content",
|
||||
principalTable: "Creators",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Contents",
|
||||
schema: "Content",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
CreatedBy = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
|
||||
DeletedBy = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
DeletedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
||||
Title = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
||||
Description = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: false),
|
||||
HtmlFileUrl = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: true),
|
||||
Urls = table.Column<string[]>(type: "text[]", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Contents", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Contents_Creators_CreatedBy",
|
||||
column: x => x.CreatedBy,
|
||||
principalSchema: "Content",
|
||||
principalTable: "Creators",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Images",
|
||||
schema: "Content",
|
||||
columns: table => new
|
||||
{
|
||||
CreatorId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Banner = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
|
||||
Logo = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Images", x => x.CreatorId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Images_Creators_CreatorId",
|
||||
column: x => x.CreatorId,
|
||||
principalSchema: "Content",
|
||||
principalTable: "Creators",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Socials",
|
||||
schema: "Content",
|
||||
columns: table => new
|
||||
{
|
||||
CreatorId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
FacebookUrl = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
|
||||
InstagramUrl = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
|
||||
XUrl = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
|
||||
LinkedInUrl = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
|
||||
TikTokUrl = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
|
||||
YoutubeUrl = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
|
||||
RedditUrl = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
|
||||
WebsiteUrl = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Socials", x => x.CreatorId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Socials_Creators_CreatorId",
|
||||
column: x => x.CreatorId,
|
||||
principalSchema: "Content",
|
||||
principalTable: "Creators",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Reactions",
|
||||
schema: "Content",
|
||||
columns: table => new
|
||||
{
|
||||
ContentId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Reaction = table.Column<int>(type: "integer", nullable: false),
|
||||
UserId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
UserName = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Reactions", x => new { x.ContentId, x.Id });
|
||||
table.ForeignKey(
|
||||
name: "FK_Reactions_Contents_ContentId",
|
||||
column: x => x.ContentId,
|
||||
principalSchema: "Content",
|
||||
principalTable: "Contents",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Contents_CreatedBy",
|
||||
schema: "Content",
|
||||
table: "Contents",
|
||||
column: "CreatedBy");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Colors",
|
||||
schema: "Content");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Images",
|
||||
schema: "Content");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Reactions",
|
||||
schema: "Content");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Socials",
|
||||
schema: "Content");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Contents",
|
||||
schema: "Content");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Creators",
|
||||
schema: "Content");
|
||||
}
|
||||
}
|
||||
}
|
||||
289
backend/src/Web/Features/Contents/Data/Migrations/20241201173048_AddThumbnailUrl.Designer.cs
generated
Normal file
289
backend/src/Web/Features/Contents/Data/Migrations/20241201173048_AddThumbnailUrl.Designer.cs
generated
Normal file
@@ -0,0 +1,289 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ContentDbContext))]
|
||||
[Migration("20241201173048_AddThumbnailUrl")]
|
||||
partial class AddThumbnailUrl
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("Content")
|
||||
.HasAnnotation("ProductVersion", "8.0.10")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Content", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset?>("DeletedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid?>("DeletedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<string>("HtmlFileUrl")
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<string>("ThumbnailUrl")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("character varying(512)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b.Property<string[]>("Urls")
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreatedBy");
|
||||
|
||||
b.ToTable("Contents", "Content");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Creators", "Content");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Content", b =>
|
||||
{
|
||||
b.HasOne("Hutopy.Web.Features.Contents.Data.Creator", "Creator")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedBy")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.OwnsMany("Hutopy.Web.Features.Contents.Data.ContentReaction", "Reactions", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("ContentId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property<int>("Id"));
|
||||
|
||||
b1.Property<int>("Reaction")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b1.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("UserName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b1.HasKey("ContentId", "Id");
|
||||
|
||||
b1.ToTable("Reactions", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("ContentId");
|
||||
});
|
||||
|
||||
b.Navigation("Creator");
|
||||
|
||||
b.Navigation("Reactions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b =>
|
||||
{
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Colors", "Colors", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("Background")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Error")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnBackground")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnError")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnPrimary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnSecondary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnSurface")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Primary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Secondary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Surface")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Colors", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Images", "Images", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("Banner")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("Logo")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Images", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Socials", "Socials", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("FacebookUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("InstagramUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("LinkedInUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("RedditUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("TikTokUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("WebsiteUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("XUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("YoutubeUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Socials", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.Navigation("Colors")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Images")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Socials")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddThumbnailUrl : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "ThumbnailUrl",
|
||||
schema: "Content",
|
||||
table: "Contents",
|
||||
type: "character varying(512)",
|
||||
maxLength: 512,
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ThumbnailUrl",
|
||||
schema: "Content",
|
||||
table: "Contents");
|
||||
}
|
||||
}
|
||||
}
|
||||
390
backend/src/Web/Features/Contents/Data/Migrations/20241201182352_AddPresentationInfos.Designer.cs
generated
Normal file
390
backend/src/Web/Features/Contents/Data/Migrations/20241201182352_AddPresentationInfos.Designer.cs
generated
Normal file
@@ -0,0 +1,390 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ContentDbContext))]
|
||||
[Migration("20241201182352_AddPresentationInfos")]
|
||||
partial class AddPresentationInfos
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("Content")
|
||||
.HasAnnotation("ProductVersion", "8.0.10")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Content", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset?>("DeletedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid?>("DeletedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<string>("HtmlFileUrl")
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<string>("ThumbnailUrl")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("character varying(512)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b.Property<string[]>("Urls")
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreatedBy");
|
||||
|
||||
b.ToTable("Contents", "Content");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Creators", "Content");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Content", b =>
|
||||
{
|
||||
b.HasOne("Hutopy.Web.Features.Contents.Data.Creator", "Creator")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedBy")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.OwnsMany("Hutopy.Web.Features.Contents.Data.ContentReaction", "Reactions", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("ContentId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property<int>("Id"));
|
||||
|
||||
b1.Property<int>("Reaction")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b1.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("UserName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b1.HasKey("ContentId", "Id");
|
||||
|
||||
b1.ToTable("Reactions", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("ContentId");
|
||||
});
|
||||
|
||||
b.Navigation("Creator");
|
||||
|
||||
b.Navigation("Reactions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b =>
|
||||
{
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Colors", "Colors", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("Background")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Error")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnBackground")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnError")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnPrimary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnSecondary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnSurface")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Primary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Secondary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Surface")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Colors", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Images", "Images", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("Banner")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("Logo")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Images", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.PresentationInfos", "PresentationInfos", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("Image1Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("Image2Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("Image3Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("Image4Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("ImagesSubtitle")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("ImagesText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("MainImageText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("MainImageUrl")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("MainVideoText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("PhoneNumber")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("VideoSubtitle")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("VideoSubtitleMain")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("VideoText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("VideoUrl")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("VideoUrlMain")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("PresentationInfos", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Socials", "Socials", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("FacebookUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("InstagramUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("LinkedInUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("RedditUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("TikTokUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("WebsiteUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("XUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("YoutubeUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Socials", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.Navigation("Colors")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Images")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("PresentationInfos")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Socials")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddPresentationInfos : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "PresentationInfos",
|
||||
schema: "Content",
|
||||
columns: table => new
|
||||
{
|
||||
CreatorId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
PhoneNumber = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
||||
Email = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
||||
Title = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
||||
MainImageUrl = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
||||
MainImageText = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
||||
MainVideoText = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
||||
ImagesSubtitle = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
||||
Image1Url = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
||||
Image2Url = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
||||
Image3Url = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
||||
Image4Url = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
||||
ImagesText = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
||||
VideoSubtitle = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
||||
VideoSubtitleMain = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
||||
VideoUrlMain = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
||||
VideoUrl = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
|
||||
VideoText = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_PresentationInfos", x => x.CreatorId);
|
||||
table.ForeignKey(
|
||||
name: "FK_PresentationInfos_Creators_CreatorId",
|
||||
column: x => x.CreatorId,
|
||||
principalSchema: "Content",
|
||||
principalTable: "Creators",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "PresentationInfos",
|
||||
schema: "Content");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,390 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ContentDbContext))]
|
||||
[Migration("20241202131957_LongerStringPresentationInfos")]
|
||||
partial class LongerStringPresentationInfos
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("Content")
|
||||
.HasAnnotation("ProductVersion", "8.0.10")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Content", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset?>("DeletedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid?>("DeletedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<string>("HtmlFileUrl")
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<string>("ThumbnailUrl")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("character varying(512)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b.Property<string[]>("Urls")
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreatedBy");
|
||||
|
||||
b.ToTable("Contents", "Content");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Creators", "Content");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Content", b =>
|
||||
{
|
||||
b.HasOne("Hutopy.Web.Features.Contents.Data.Creator", "Creator")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedBy")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.OwnsMany("Hutopy.Web.Features.Contents.Data.ContentReaction", "Reactions", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("ContentId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property<int>("Id"));
|
||||
|
||||
b1.Property<int>("Reaction")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b1.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("UserName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b1.HasKey("ContentId", "Id");
|
||||
|
||||
b1.ToTable("Reactions", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("ContentId");
|
||||
});
|
||||
|
||||
b.Navigation("Creator");
|
||||
|
||||
b.Navigation("Reactions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b =>
|
||||
{
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Colors", "Colors", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("Background")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Error")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnBackground")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnError")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnPrimary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnSecondary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnSurface")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Primary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Secondary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Surface")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Colors", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Images", "Images", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("Banner")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("Logo")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Images", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.PresentationInfos", "PresentationInfos", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("Image1Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("Image2Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("Image3Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("Image4Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("ImagesSubtitle")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("ImagesText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10000)
|
||||
.HasColumnType("character varying(10000)");
|
||||
|
||||
b1.Property<string>("MainImageText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10000)
|
||||
.HasColumnType("character varying(10000)");
|
||||
|
||||
b1.Property<string>("MainImageUrl")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("MainVideoText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10000)
|
||||
.HasColumnType("character varying(10000)");
|
||||
|
||||
b1.Property<string>("PhoneNumber")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("VideoSubtitle")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("VideoSubtitleMain")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("VideoText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10000)
|
||||
.HasColumnType("character varying(10000)");
|
||||
|
||||
b1.Property<string>("VideoUrl")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("VideoUrlMain")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("PresentationInfos", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Socials", "Socials", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("FacebookUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("InstagramUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("LinkedInUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("RedditUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("TikTokUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("WebsiteUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("XUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("YoutubeUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Socials", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.Navigation("Colors")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Images")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("PresentationInfos")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Socials")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,348 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class LongerStringPresentationInfos : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "VideoUrlMain",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(2000)",
|
||||
maxLength: 2000,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(255)",
|
||||
oldMaxLength: 255);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "VideoUrl",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(2000)",
|
||||
maxLength: 2000,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(255)",
|
||||
oldMaxLength: 255);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "VideoText",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(10000)",
|
||||
maxLength: 10000,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(255)",
|
||||
oldMaxLength: 255);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "VideoSubtitleMain",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(2000)",
|
||||
maxLength: 2000,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(255)",
|
||||
oldMaxLength: 255);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "VideoSubtitle",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(2000)",
|
||||
maxLength: 2000,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(255)",
|
||||
oldMaxLength: 255);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Title",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(2000)",
|
||||
maxLength: 2000,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(255)",
|
||||
oldMaxLength: 255);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "MainVideoText",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(10000)",
|
||||
maxLength: 10000,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(255)",
|
||||
oldMaxLength: 255);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "MainImageUrl",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(2000)",
|
||||
maxLength: 2000,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(255)",
|
||||
oldMaxLength: 255);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "MainImageText",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(10000)",
|
||||
maxLength: 10000,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(255)",
|
||||
oldMaxLength: 255);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "ImagesText",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(10000)",
|
||||
maxLength: 10000,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(255)",
|
||||
oldMaxLength: 255);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "ImagesSubtitle",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(2000)",
|
||||
maxLength: 2000,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(255)",
|
||||
oldMaxLength: 255);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Image4Url",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(2000)",
|
||||
maxLength: 2000,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(255)",
|
||||
oldMaxLength: 255);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Image3Url",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(2000)",
|
||||
maxLength: 2000,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(255)",
|
||||
oldMaxLength: 255);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Image2Url",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(2000)",
|
||||
maxLength: 2000,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(255)",
|
||||
oldMaxLength: 255);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Image1Url",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(2000)",
|
||||
maxLength: 2000,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(255)",
|
||||
oldMaxLength: 255);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "VideoUrlMain",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(255)",
|
||||
maxLength: 255,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(2000)",
|
||||
oldMaxLength: 2000);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "VideoUrl",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(255)",
|
||||
maxLength: 255,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(2000)",
|
||||
oldMaxLength: 2000);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "VideoText",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(255)",
|
||||
maxLength: 255,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(10000)",
|
||||
oldMaxLength: 10000);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "VideoSubtitleMain",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(255)",
|
||||
maxLength: 255,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(2000)",
|
||||
oldMaxLength: 2000);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "VideoSubtitle",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(255)",
|
||||
maxLength: 255,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(2000)",
|
||||
oldMaxLength: 2000);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Title",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(255)",
|
||||
maxLength: 255,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(2000)",
|
||||
oldMaxLength: 2000);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "MainVideoText",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(255)",
|
||||
maxLength: 255,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(10000)",
|
||||
oldMaxLength: 10000);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "MainImageUrl",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(255)",
|
||||
maxLength: 255,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(2000)",
|
||||
oldMaxLength: 2000);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "MainImageText",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(255)",
|
||||
maxLength: 255,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(10000)",
|
||||
oldMaxLength: 10000);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "ImagesText",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(255)",
|
||||
maxLength: 255,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(10000)",
|
||||
oldMaxLength: 10000);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "ImagesSubtitle",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(255)",
|
||||
maxLength: 255,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(2000)",
|
||||
oldMaxLength: 2000);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Image4Url",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(255)",
|
||||
maxLength: 255,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(2000)",
|
||||
oldMaxLength: 2000);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Image3Url",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(255)",
|
||||
maxLength: 255,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(2000)",
|
||||
oldMaxLength: 2000);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Image2Url",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(255)",
|
||||
maxLength: 255,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(2000)",
|
||||
oldMaxLength: 2000);
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Image1Url",
|
||||
schema: "Content",
|
||||
table: "PresentationInfos",
|
||||
type: "character varying(255)",
|
||||
maxLength: 255,
|
||||
nullable: false,
|
||||
oldClrType: typeof(string),
|
||||
oldType: "character varying(2000)",
|
||||
oldMaxLength: 2000);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,400 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ContentDbContext))]
|
||||
[Migration("20250108022601_AddComputedColumnAndIndex_CreatorName")]
|
||||
partial class AddComputedColumnAndIndex_CreatorName
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("Content")
|
||||
.HasAnnotation("ProductVersion", "8.0.10")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Content", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset?>("DeletedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid?>("DeletedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<string>("HtmlFileUrl")
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<string>("ThumbnailUrl")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("character varying(512)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b.Property<string[]>("Urls")
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreatedBy");
|
||||
|
||||
b.ToTable("Contents", "Content");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasComputedColumnSql("LOWER( \"Content\".\"Creators\".\"Name\")", true);
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Creators", "Content");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Content", b =>
|
||||
{
|
||||
b.HasOne("Hutopy.Web.Features.Contents.Data.Creator", "Creator")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedBy")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.OwnsMany("Hutopy.Web.Features.Contents.Data.ContentReaction", "Reactions", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("ContentId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property<int>("Id"));
|
||||
|
||||
b1.Property<int>("Reaction")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b1.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("UserName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b1.HasKey("ContentId", "Id");
|
||||
|
||||
b1.ToTable("Reactions", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("ContentId");
|
||||
});
|
||||
|
||||
b.Navigation("Creator");
|
||||
|
||||
b.Navigation("Reactions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b =>
|
||||
{
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Colors", "Colors", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("Background")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Error")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnBackground")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnError")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnPrimary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnSecondary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnSurface")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Primary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Secondary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Surface")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Colors", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Images", "Images", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("Banner")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("Logo")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Images", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.PresentationInfos", "PresentationInfos", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("Image1Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("Image2Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("Image3Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("Image4Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("ImagesSubtitle")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("ImagesText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10000)
|
||||
.HasColumnType("character varying(10000)");
|
||||
|
||||
b1.Property<string>("MainImageText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10000)
|
||||
.HasColumnType("character varying(10000)");
|
||||
|
||||
b1.Property<string>("MainImageUrl")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("MainVideoText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10000)
|
||||
.HasColumnType("character varying(10000)");
|
||||
|
||||
b1.Property<string>("PhoneNumber")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("VideoSubtitle")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("VideoSubtitleMain")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("VideoText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10000)
|
||||
.HasColumnType("character varying(10000)");
|
||||
|
||||
b1.Property<string>("VideoUrl")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("VideoUrlMain")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("PresentationInfos", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Socials", "Socials", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("FacebookUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("InstagramUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("LinkedInUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("RedditUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("TikTokUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("WebsiteUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("XUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("YoutubeUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Socials", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.Navigation("Colors")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Images")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("PresentationInfos")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Socials")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddComputedColumnAndIndex_CreatorName : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "NormalizedName",
|
||||
schema: "Content",
|
||||
table: "Creators",
|
||||
type: "character varying(255)",
|
||||
maxLength: 255,
|
||||
nullable: false,
|
||||
computedColumnSql: "LOWER( \"Content\".\"Creators\".\"Name\")",
|
||||
stored: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Creators_NormalizedName",
|
||||
schema: "Content",
|
||||
table: "Creators",
|
||||
column: "NormalizedName",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Creators_NormalizedName",
|
||||
schema: "Content",
|
||||
table: "Creators");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "NormalizedName",
|
||||
schema: "Content",
|
||||
table: "Creators");
|
||||
}
|
||||
}
|
||||
}
|
||||
403
backend/src/Web/Features/Contents/Data/Migrations/20250108210552_Add_Verified_Creator.Designer.cs
generated
Normal file
403
backend/src/Web/Features/Contents/Data/Migrations/20250108210552_Add_Verified_Creator.Designer.cs
generated
Normal file
@@ -0,0 +1,403 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ContentDbContext))]
|
||||
[Migration("20250108210552_Add_Verified_Creator")]
|
||||
partial class Add_Verified_Creator
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("Content")
|
||||
.HasAnnotation("ProductVersion", "8.0.10")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Content", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset?>("DeletedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid?>("DeletedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<string>("HtmlFileUrl")
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<string>("ThumbnailUrl")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("character varying(512)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b.Property<string[]>("Urls")
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreatedBy");
|
||||
|
||||
b.ToTable("Contents", "Content");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasComputedColumnSql("LOWER( \"Content\".\"Creators\".\"Name\")", true);
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b.Property<bool>("Verified")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Creators", "Content");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Content", b =>
|
||||
{
|
||||
b.HasOne("Hutopy.Web.Features.Contents.Data.Creator", "Creator")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedBy")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.OwnsMany("Hutopy.Web.Features.Contents.Data.ContentReaction", "Reactions", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("ContentId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property<int>("Id"));
|
||||
|
||||
b1.Property<int>("Reaction")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b1.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("UserName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b1.HasKey("ContentId", "Id");
|
||||
|
||||
b1.ToTable("Reactions", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("ContentId");
|
||||
});
|
||||
|
||||
b.Navigation("Creator");
|
||||
|
||||
b.Navigation("Reactions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b =>
|
||||
{
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Colors", "Colors", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("Background")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Error")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnBackground")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnError")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnPrimary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnSecondary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnSurface")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Primary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Secondary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Surface")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Colors", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Images", "Images", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("Banner")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("Logo")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Images", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.PresentationInfos", "PresentationInfos", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("Image1Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("Image2Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("Image3Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("Image4Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("ImagesSubtitle")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("ImagesText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10000)
|
||||
.HasColumnType("character varying(10000)");
|
||||
|
||||
b1.Property<string>("MainImageText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10000)
|
||||
.HasColumnType("character varying(10000)");
|
||||
|
||||
b1.Property<string>("MainImageUrl")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("MainVideoText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10000)
|
||||
.HasColumnType("character varying(10000)");
|
||||
|
||||
b1.Property<string>("PhoneNumber")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("VideoSubtitle")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("VideoSubtitleMain")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("VideoText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10000)
|
||||
.HasColumnType("character varying(10000)");
|
||||
|
||||
b1.Property<string>("VideoUrl")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("VideoUrlMain")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("PresentationInfos", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Socials", "Socials", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("FacebookUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("InstagramUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("LinkedInUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("RedditUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("TikTokUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("WebsiteUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("XUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("YoutubeUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Socials", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.Navigation("Colors")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Images")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("PresentationInfos")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Socials")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Add_Verified_Creator : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "Verified",
|
||||
schema: "Content",
|
||||
table: "Creators",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Verified",
|
||||
schema: "Content",
|
||||
table: "Creators");
|
||||
}
|
||||
}
|
||||
}
|
||||
406
backend/src/Web/Features/Contents/Data/Migrations/20250109015556_Adds_AcceptDonation_Creator.Designer.cs
generated
Normal file
406
backend/src/Web/Features/Contents/Data/Migrations/20250109015556_Adds_AcceptDonation_Creator.Designer.cs
generated
Normal file
@@ -0,0 +1,406 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ContentDbContext))]
|
||||
[Migration("20250109015556_Adds_AcceptDonation_Creator")]
|
||||
partial class Adds_AcceptDonation_Creator
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("Content")
|
||||
.HasAnnotation("ProductVersion", "8.0.10")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Content", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset?>("DeletedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid?>("DeletedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<string>("HtmlFileUrl")
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<string>("ThumbnailUrl")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("character varying(512)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b.Property<string[]>("Urls")
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreatedBy");
|
||||
|
||||
b.ToTable("Contents", "Content");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<bool>("AcceptDonation")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasComputedColumnSql("LOWER( \"Content\".\"Creators\".\"Name\")", true);
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b.Property<bool>("Verified")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Creators", "Content");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Content", b =>
|
||||
{
|
||||
b.HasOne("Hutopy.Web.Features.Contents.Data.Creator", "Creator")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedBy")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.OwnsMany("Hutopy.Web.Features.Contents.Data.ContentReaction", "Reactions", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("ContentId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property<int>("Id"));
|
||||
|
||||
b1.Property<int>("Reaction")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b1.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("UserName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b1.HasKey("ContentId", "Id");
|
||||
|
||||
b1.ToTable("Reactions", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("ContentId");
|
||||
});
|
||||
|
||||
b.Navigation("Creator");
|
||||
|
||||
b.Navigation("Reactions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b =>
|
||||
{
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Colors", "Colors", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("Background")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Error")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnBackground")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnError")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnPrimary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnSecondary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnSurface")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Primary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Secondary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Surface")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Colors", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Images", "Images", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("Banner")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("Logo")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Images", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.PresentationInfos", "PresentationInfos", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("Image1Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("Image2Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("Image3Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("Image4Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("ImagesSubtitle")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("ImagesText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10000)
|
||||
.HasColumnType("character varying(10000)");
|
||||
|
||||
b1.Property<string>("MainImageText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10000)
|
||||
.HasColumnType("character varying(10000)");
|
||||
|
||||
b1.Property<string>("MainImageUrl")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("MainVideoText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10000)
|
||||
.HasColumnType("character varying(10000)");
|
||||
|
||||
b1.Property<string>("PhoneNumber")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("VideoSubtitle")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("VideoSubtitleMain")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("VideoText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10000)
|
||||
.HasColumnType("character varying(10000)");
|
||||
|
||||
b1.Property<string>("VideoUrl")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("VideoUrlMain")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("PresentationInfos", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Socials", "Socials", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("FacebookUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("InstagramUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("LinkedInUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("RedditUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("TikTokUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("WebsiteUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("XUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("YoutubeUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Socials", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.Navigation("Colors")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Images")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("PresentationInfos")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Socials")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Adds_AcceptDonation_Creator : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<bool>(
|
||||
name: "AcceptDonation",
|
||||
schema: "Content",
|
||||
table: "Creators",
|
||||
type: "boolean",
|
||||
nullable: false,
|
||||
defaultValue: false);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AcceptDonation",
|
||||
schema: "Content",
|
||||
table: "Creators");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,403 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Data.Migrations
|
||||
{
|
||||
[DbContext(typeof(ContentDbContext))]
|
||||
partial class ContentDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("Content")
|
||||
.HasAnnotation("ProductVersion", "8.0.10")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Content", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset?>("DeletedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid?>("DeletedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<string>("HtmlFileUrl")
|
||||
.HasMaxLength(2048)
|
||||
.HasColumnType("character varying(2048)");
|
||||
|
||||
b.Property<string>("ThumbnailUrl")
|
||||
.HasMaxLength(512)
|
||||
.HasColumnType("character varying(512)");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b.Property<string[]>("Urls")
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreatedBy");
|
||||
|
||||
b.ToTable("Contents", "Content");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<bool>("AcceptDonation")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid>("CreatedBy")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b.Property<string>("NormalizedName")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAddOrUpdate()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)")
|
||||
.HasComputedColumnSql("LOWER( \"Content\".\"Creators\".\"Name\")", true);
|
||||
|
||||
b.Property<string>("Title")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b.Property<bool>("Verified")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("NormalizedName")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Creators", "Content");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Content", b =>
|
||||
{
|
||||
b.HasOne("Hutopy.Web.Features.Contents.Data.Creator", "Creator")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedBy")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.OwnsMany("Hutopy.Web.Features.Contents.Data.ContentReaction", "Reactions", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("ContentId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b1.Property<int>("Id"));
|
||||
|
||||
b1.Property<int>("Reaction")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b1.Property<Guid>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("UserName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)");
|
||||
|
||||
b1.HasKey("ContentId", "Id");
|
||||
|
||||
b1.ToTable("Reactions", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("ContentId");
|
||||
});
|
||||
|
||||
b.Navigation("Creator");
|
||||
|
||||
b.Navigation("Reactions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b =>
|
||||
{
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Colors", "Colors", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("Background")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Error")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnBackground")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnError")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnPrimary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnSecondary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("OnSurface")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Primary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Secondary")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.Property<string>("Surface")
|
||||
.IsRequired()
|
||||
.HasMaxLength(9)
|
||||
.HasColumnType("character varying(9)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Colors", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Images", "Images", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("Banner")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("Logo")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Images", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.PresentationInfos", "PresentationInfos", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("Image1Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("Image2Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("Image3Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("Image4Url")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("ImagesSubtitle")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("ImagesText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10000)
|
||||
.HasColumnType("character varying(10000)");
|
||||
|
||||
b1.Property<string>("MainImageText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10000)
|
||||
.HasColumnType("character varying(10000)");
|
||||
|
||||
b1.Property<string>("MainImageUrl")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("MainVideoText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10000)
|
||||
.HasColumnType("character varying(10000)");
|
||||
|
||||
b1.Property<string>("PhoneNumber")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("VideoSubtitle")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("VideoSubtitleMain")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("VideoText")
|
||||
.IsRequired()
|
||||
.HasMaxLength(10000)
|
||||
.HasColumnType("character varying(10000)");
|
||||
|
||||
b1.Property<string>("VideoUrl")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.Property<string>("VideoUrlMain")
|
||||
.IsRequired()
|
||||
.HasMaxLength(2000)
|
||||
.HasColumnType("character varying(2000)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("PresentationInfos", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Socials", "Socials", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b1.Property<string>("FacebookUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("InstagramUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("LinkedInUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("RedditUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("TikTokUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("WebsiteUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("XUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.Property<string>("YoutubeUrl")
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("character varying(255)");
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("Socials", "Content");
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("CreatorId");
|
||||
});
|
||||
|
||||
b.Navigation("Colors")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Images")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("PresentationInfos")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Socials")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
16
backend/src/Web/Features/Contents/DependencyInjection.cs
Normal file
16
backend/src/Web/Features/Contents/DependencyInjection.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents;
|
||||
|
||||
public static class DependencyInjection
|
||||
{
|
||||
public static WebApplicationBuilder AddContentModule(
|
||||
this WebApplicationBuilder builder,
|
||||
Action<DbContextOptionsBuilder>? configureAction = null)
|
||||
{
|
||||
builder.Services.AddDbContext<ContentDbContext>(configureAction);
|
||||
builder.Services.AddScoped<ContentDbContextInitializer>();
|
||||
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
using Hutopy.Web.Features.Memberships.Events;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.EventHandlers;
|
||||
|
||||
[UsedImplicitly]
|
||||
public class StripeAccountConfiguredHandler(
|
||||
ILogger<StripeAccountConfiguredHandler> logger,
|
||||
IServiceScopeFactory scopeFactory)
|
||||
: IEventHandler<StripeAccountConfigured>
|
||||
{
|
||||
public async Task HandleAsync(
|
||||
StripeAccountConfigured eventModel,
|
||||
CancellationToken ct)
|
||||
{
|
||||
using var scope = scopeFactory.CreateScope();
|
||||
await using var dbContext = scope.ServiceProvider.GetRequiredService<ContentDbContext>();
|
||||
|
||||
var creator = await dbContext.FindAsync<Creator>(
|
||||
[eventModel.CreatorId],
|
||||
cancellationToken: ct);
|
||||
|
||||
if (creator is null)
|
||||
{
|
||||
logger.LogError(
|
||||
"Creator with id {CreatorId} was not found.",
|
||||
eventModel.CreatorId);
|
||||
return;
|
||||
}
|
||||
|
||||
creator.AcceptDonation = true;
|
||||
|
||||
var rows = await dbContext.SaveChangesAsync(ct);
|
||||
|
||||
if (rows is 0 or > 1)
|
||||
{
|
||||
logger.LogError(
|
||||
"An error occured while updating Creator with id {CreatorId}: rows:{Rows}",
|
||||
eventModel.CreatorId,
|
||||
rows);
|
||||
}
|
||||
}
|
||||
}
|
||||
83
backend/src/Web/Features/Contents/Handlers/AddReaction.cs
Normal file
83
backend/src/Web/Features/Contents/Handlers/AddReaction.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
using Hutopy.Web.Extensions;
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
using Hutopy.Web.Features.Contents.Data.Enums;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Handlers;
|
||||
|
||||
[PublicAPI]
|
||||
public sealed class AddReactionRequest
|
||||
{
|
||||
public required Guid ContentId { get; set; }
|
||||
public required string Reaction { get; set; }
|
||||
public required Guid UserId { get; set; }
|
||||
public required string UserName { get; set; }
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
internal sealed class AddReactionRequestValidator
|
||||
: Validator<AddReactionRequest>
|
||||
{
|
||||
public AddReactionRequestValidator()
|
||||
{
|
||||
RuleFor(r => r.Reaction)
|
||||
.NotNull()
|
||||
.Must(BeAValidReaction)
|
||||
.WithMessage("'{PropertyValue}' is not a valid reaction.");
|
||||
}
|
||||
|
||||
private bool BeAValidReaction(string reaction)
|
||||
{
|
||||
return Enum.TryParse(typeof(Reaction), reaction, true, out _);
|
||||
}
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
public class AddReaction(
|
||||
ContentDbContext context)
|
||||
: Endpoint<AddReactionRequest>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Post("/api/content/reaction");
|
||||
Options(o => o.WithTags("Contents"));
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(
|
||||
AddReactionRequest req,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var content = await context.Contents.SingleAsync(x => x.Id == req.ContentId, ct);
|
||||
var reactionEnum = req.Reaction.ToEnum<Reaction>();
|
||||
var currentReaction = content.Reactions.SingleOrDefault(x => x.UserId == req.UserId);
|
||||
|
||||
// Already reacted or reaction didn't change, do nothing
|
||||
if (currentReaction != null && currentReaction.Reaction == reactionEnum)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// User has already reacted, remove the existing reaction
|
||||
if (currentReaction != null)
|
||||
{
|
||||
content.Reactions.Remove(currentReaction);
|
||||
}
|
||||
|
||||
// If the new reaction is valid, add or update the reaction
|
||||
if (reactionEnum.HasValue)
|
||||
{
|
||||
var reaction = new ContentReaction
|
||||
{
|
||||
Reaction = reactionEnum.Value,
|
||||
UserId = req.UserId,
|
||||
UserName = req.UserName
|
||||
};
|
||||
|
||||
content.Reactions.Add(reaction);
|
||||
}
|
||||
|
||||
await context.SaveChangesAsync(ct);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
60
backend/src/Web/Features/Contents/Handlers/ChangeBanner.cs
Normal file
60
backend/src/Web/Features/Contents/Handlers/ChangeBanner.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using Hutopy.Web.Common.BlobStorage;
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Handlers;
|
||||
|
||||
[PublicAPI]
|
||||
public record ChangeBannerRequest(
|
||||
Guid CreatorId,
|
||||
IFormFile File);
|
||||
|
||||
[PublicAPI]
|
||||
public record ChangeBannerResponse(
|
||||
string BlobUrl);
|
||||
|
||||
[PublicAPI]
|
||||
public class ChangeBannerHandler(
|
||||
ContentDbContext context,
|
||||
AzureBlobStorage blobStorage)
|
||||
: Endpoint<ChangeBannerRequest, ChangeBannerResponse>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Post("/api/creators/{CreatorId}/banner");
|
||||
Options(o => o.WithTags("Creators"));
|
||||
AllowFileUploads();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(
|
||||
ChangeBannerRequest request,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var creator = await context
|
||||
.Creators
|
||||
.Include(c => c.Images)
|
||||
.SingleOrDefaultAsync(
|
||||
c => c.Id == request.CreatorId,
|
||||
cancellationToken: ct);
|
||||
|
||||
if (creator is null)
|
||||
{
|
||||
await SendNotFoundAsync(ct);
|
||||
return;
|
||||
}
|
||||
|
||||
var blobUrl = await blobStorage.UploadFileAsync(
|
||||
ContainerNames.Creators,
|
||||
$"{request.CreatorId}/{SubDirectoryNames.Profile}/{CommonFileNames.BannerPicture}",
|
||||
request.File.OpenReadStream(),
|
||||
request.File.ContentType,
|
||||
ct);
|
||||
|
||||
creator.Images.Banner = blobUrl;
|
||||
|
||||
await context.SaveChangesAsync(ct);
|
||||
|
||||
await SendOkAsync(
|
||||
new ChangeBannerResponse(blobUrl),
|
||||
ct);
|
||||
}
|
||||
}
|
||||
113
backend/src/Web/Features/Contents/Handlers/ChangeColors.cs
Normal file
113
backend/src/Web/Features/Contents/Handlers/ChangeColors.cs
Normal file
@@ -0,0 +1,113 @@
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Handlers;
|
||||
|
||||
[PublicAPI]
|
||||
public record ChangeColorsRequest(
|
||||
Guid CreatorId,
|
||||
string Primary,
|
||||
string Secondary,
|
||||
string Background,
|
||||
string Surface,
|
||||
string Error,
|
||||
string OnPrimary,
|
||||
string OnSecondary,
|
||||
string OnBackground,
|
||||
string OnSurface,
|
||||
string OnError);
|
||||
|
||||
[PublicAPI]
|
||||
public sealed class ChangeColorsRequestValidator
|
||||
: Validator<ChangeColorsRequest>
|
||||
{
|
||||
public ChangeColorsRequestValidator()
|
||||
{
|
||||
RuleFor(x => x.Primary)
|
||||
.MinimumLength(4).WithMessage("The minimum value should be in the format #444")
|
||||
.MaximumLength(9).WithMessage("The maximum value should be in the format #11223344")
|
||||
.Must(x => x.StartsWith('#')).WithMessage("The format should be a valid html color and start with #");
|
||||
|
||||
RuleFor(x => x.Secondary)
|
||||
.MinimumLength(4).WithMessage("The minimum value should be in the format #444")
|
||||
.MaximumLength(9).WithMessage("The maximum value should be in the format #11223344")
|
||||
.Must(x => x.StartsWith('#')).WithMessage("The format should be a valid html color and start with #");
|
||||
|
||||
RuleFor(x => x.Background)
|
||||
.MinimumLength(4).WithMessage("The minimum value should be in the format #444")
|
||||
.MaximumLength(9).WithMessage("The maximum value should be in the format #11223344")
|
||||
.Must(x => x.StartsWith('#')).WithMessage("The format should be a valid html color and start with #");
|
||||
|
||||
RuleFor(x => x.Surface)
|
||||
.MinimumLength(4).WithMessage("The minimum value should be in the format #444")
|
||||
.MaximumLength(9).WithMessage("The maximum value should be in the format #11223344")
|
||||
.Must(x => x.StartsWith('#')).WithMessage("The format should be a valid html color and start with #");
|
||||
|
||||
RuleFor(x => x.Error)
|
||||
.MinimumLength(4).WithMessage("The minimum value should be in the format #444")
|
||||
.MaximumLength(9).WithMessage("The maximum value should be in the format #11223344")
|
||||
.Must(x => x.StartsWith('#')).WithMessage("The format should be a valid html color and start with #");
|
||||
|
||||
RuleFor(x => x.OnPrimary)
|
||||
.MinimumLength(4).WithMessage("The minimum value should be in the format #444")
|
||||
.MaximumLength(9).WithMessage("The maximum value should be in the format #11223344")
|
||||
.Must(x => x.StartsWith('#')).WithMessage("The format should be a valid html color and start with #");
|
||||
|
||||
RuleFor(x => x.OnSecondary)
|
||||
.MinimumLength(4).WithMessage("The minimum value should be in the format #444")
|
||||
.MaximumLength(9).WithMessage("The maximum value should be in the format #11223344")
|
||||
.Must(x => x.StartsWith('#')).WithMessage("The format should be a valid html color and start with #");
|
||||
|
||||
RuleFor(x => x.OnBackground)
|
||||
.MinimumLength(4).WithMessage("The minimum value should be in the format #444")
|
||||
.MaximumLength(9).WithMessage("The maximum value should be in the format #11223344")
|
||||
.Must(x => x.StartsWith('#')).WithMessage("The format should be a valid html color and start with #");
|
||||
|
||||
RuleFor(x => x.OnSurface)
|
||||
.MinimumLength(4).WithMessage("The minimum value should be in the format #444")
|
||||
.MaximumLength(9).WithMessage("The maximum value should be in the format #11223344")
|
||||
.Must(x => x.StartsWith('#')).WithMessage("The format should be a valid html color and start with #");
|
||||
|
||||
RuleFor(x => x.OnError)
|
||||
.MinimumLength(4).WithMessage("The minimum value should be in the format #444")
|
||||
.MaximumLength(9).WithMessage("The maximum value should be in the format #11223344")
|
||||
.Must(x => x.StartsWith('#')).WithMessage("The format should be a valid html color and start with #");
|
||||
}
|
||||
}
|
||||
|
||||
public class ChangeColorsHandler(
|
||||
ContentDbContext context)
|
||||
: Endpoint<ChangeColorsRequest>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Post("/api/creators/{CreatorId}/colors");
|
||||
Options(o => o.WithTags("Creators"));
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(
|
||||
ChangeColorsRequest request,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var creator = await context
|
||||
.Creators
|
||||
.Include(c => c.Colors)
|
||||
.SingleAsync(
|
||||
c => c.Id == request.CreatorId,
|
||||
cancellationToken: ct);
|
||||
|
||||
creator.Colors.Primary = request.Primary;
|
||||
creator.Colors.Secondary = request.Secondary;
|
||||
creator.Colors.Background = request.Background;
|
||||
creator.Colors.Surface = request.Surface;
|
||||
creator.Colors.Error = request.Error;
|
||||
creator.Colors.OnPrimary = request.OnPrimary;
|
||||
creator.Colors.OnSecondary = request.OnSecondary;
|
||||
creator.Colors.OnBackground = request.OnBackground;
|
||||
creator.Colors.OnSurface = request.OnSurface;
|
||||
creator.Colors.OnError = request.OnError;
|
||||
|
||||
await context.SaveChangesAsync(ct);
|
||||
|
||||
await SendOkAsync(ct);
|
||||
}
|
||||
}
|
||||
70
backend/src/Web/Features/Contents/Handlers/ChangeLogo.cs
Normal file
70
backend/src/Web/Features/Contents/Handlers/ChangeLogo.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using Hutopy.Web.Common.BlobStorage;
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Handlers;
|
||||
|
||||
[PublicAPI]
|
||||
public record ChangeLogoRequest(
|
||||
Guid CreatorId,
|
||||
IFormFile File);
|
||||
|
||||
[PublicAPI]
|
||||
public sealed class ChangeLogoRequestValidator : Validator<ChangeLogoRequest>
|
||||
{
|
||||
public ChangeLogoRequestValidator()
|
||||
{
|
||||
RuleFor(x => x.CreatorId)
|
||||
.NotNull()
|
||||
.NotEmpty();
|
||||
|
||||
RuleFor(x => x.File)
|
||||
.NotNull()
|
||||
.NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
public class ChangeLogoHandler(
|
||||
ContentDbContext context,
|
||||
AzureBlobStorage blobStorage)
|
||||
: Endpoint<ChangeLogoRequest>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Post("/api/creators/{CreatorId}/logo");
|
||||
Options(o => o.WithTags("Creators"));
|
||||
AllowFileUploads();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(
|
||||
ChangeLogoRequest request,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var creator = await context
|
||||
.Creators
|
||||
.Include(c => c.Images)
|
||||
.SingleOrDefaultAsync(
|
||||
c => c.Id == request.CreatorId,
|
||||
cancellationToken: ct);
|
||||
|
||||
if (creator is null)
|
||||
{
|
||||
await SendNotFoundAsync(ct);
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: this upload should be done to the Creators container
|
||||
var blobUrl = await blobStorage.UploadFileAsync(
|
||||
ContainerNames.Creators,
|
||||
$"{request.CreatorId}/{SubDirectoryNames.Profile}/{CommonFileNames.ProfilePicture}",
|
||||
request.File.OpenReadStream(),
|
||||
request.File.ContentType,
|
||||
ct);
|
||||
|
||||
creator.Images.Logo = blobUrl;
|
||||
|
||||
await context.SaveChangesAsync(ct);
|
||||
|
||||
await SendOkAsync(blobUrl, ct);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
using Hutopy.Web.Common.BlobStorage;
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Handlers;
|
||||
|
||||
[PublicAPI]
|
||||
public record ChangePresentationInfosRequest(
|
||||
Guid CreatorId,
|
||||
string? PhoneNumber,
|
||||
string? Email,
|
||||
string? Title,
|
||||
string? MainImageText,
|
||||
string? MainVideoText,
|
||||
string? ImagesSubtitle,
|
||||
string? ImagesText,
|
||||
string? VideoSubtitle,
|
||||
string? VideoSubtitleMain,
|
||||
string? VideoUrlMain,
|
||||
string? VideoUrl,
|
||||
string? VideoText,
|
||||
string? MainImageUrl,
|
||||
string? Image1Url,
|
||||
string? Image2Url,
|
||||
string? Image3Url,
|
||||
string? Image4Url,
|
||||
IFormFile? MainImage,
|
||||
IFormFile? Image1,
|
||||
IFormFile? Image2,
|
||||
IFormFile? Image3,
|
||||
IFormFile? Image4);
|
||||
|
||||
[PublicAPI]
|
||||
public class ChangePresentationInfosHandler(
|
||||
ContentDbContext context,
|
||||
AzureBlobStorage blobStorage)
|
||||
: Endpoint<ChangePresentationInfosRequest>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Post("/api/creators/{CreatorId}/presentation-infos");
|
||||
Options(o => o.WithTags("Creators"));
|
||||
AllowFileUploads();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(
|
||||
ChangePresentationInfosRequest request,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var creator = await context
|
||||
.Creators
|
||||
.Include(c => c.PresentationInfos)
|
||||
.SingleOrDefaultAsync(
|
||||
c => c.Id == request.CreatorId,
|
||||
cancellationToken: ct);
|
||||
|
||||
if (creator is null)
|
||||
{
|
||||
await SendNotFoundAsync(ct);
|
||||
return;
|
||||
}
|
||||
|
||||
async Task<string> UploadFileOrDefaultAsync(
|
||||
IFormFile? file,
|
||||
string subDirectory,
|
||||
string fileName,
|
||||
string? newUrl)
|
||||
{
|
||||
if (newUrl == "")
|
||||
return "";
|
||||
|
||||
if (file != null)
|
||||
{
|
||||
return await blobStorage.UploadFileAsync(
|
||||
ContainerNames.Creators,
|
||||
$"{request.CreatorId}/{subDirectory}/{fileName}",
|
||||
file.OpenReadStream(),
|
||||
file.ContentType,
|
||||
ct);
|
||||
}
|
||||
|
||||
return newUrl?.Trim() ?? "";
|
||||
}
|
||||
|
||||
creator.PresentationInfos.MainImageUrl = await UploadFileOrDefaultAsync(
|
||||
request.MainImage, "Profile", "MainImage", request.MainImageUrl);
|
||||
|
||||
creator.PresentationInfos.Image1Url = await UploadFileOrDefaultAsync(
|
||||
request.Image1, "Profile", "Image1", request.Image1Url);
|
||||
|
||||
creator.PresentationInfos.Image2Url = await UploadFileOrDefaultAsync(
|
||||
request.Image2, "Profile", "Image2", request.Image2Url);
|
||||
|
||||
creator.PresentationInfos.Image3Url = await UploadFileOrDefaultAsync(
|
||||
request.Image3, "Profile", "Image3", request.Image3Url);
|
||||
|
||||
creator.PresentationInfos.Image4Url = await UploadFileOrDefaultAsync(
|
||||
request.Image4, "Profile", "Image4", request.Image4Url);
|
||||
|
||||
creator.PresentationInfos.PhoneNumber = request.PhoneNumber?.Trim() ?? "";
|
||||
creator.PresentationInfos.Email = request.Email?.Trim() ?? "";
|
||||
creator.PresentationInfos.Title = request.Title?.Trim() ?? "";
|
||||
creator.PresentationInfos.MainImageText = request.MainImageText?.Trim() ?? "";
|
||||
creator.PresentationInfos.MainVideoText = request.MainVideoText?.Trim() ?? "";
|
||||
creator.PresentationInfos.ImagesSubtitle = request.ImagesSubtitle?.Trim() ?? "";
|
||||
creator.PresentationInfos.ImagesText = request.ImagesText?.Trim() ?? "";
|
||||
creator.PresentationInfos.VideoSubtitle = request.VideoSubtitle?.Trim() ?? "";
|
||||
creator.PresentationInfos.VideoSubtitleMain = request.VideoSubtitleMain?.Trim() ?? "";
|
||||
creator.PresentationInfos.VideoUrlMain = request.VideoUrlMain?.Trim() ?? "";
|
||||
creator.PresentationInfos.VideoUrl = request.VideoUrl?.Trim() ?? "";
|
||||
creator.PresentationInfos.VideoText = request.VideoText?.Trim() ?? "";
|
||||
|
||||
await context.SaveChangesAsync(ct);
|
||||
await SendOkAsync(ct);
|
||||
}
|
||||
}
|
||||
50
backend/src/Web/Features/Contents/Handlers/ChangeSocials.cs
Normal file
50
backend/src/Web/Features/Contents/Handlers/ChangeSocials.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Handlers;
|
||||
|
||||
[PublicAPI]
|
||||
public record ChangeSocialsRequest(
|
||||
Guid CreatorId,
|
||||
string? FacebookUrl,
|
||||
string? InstagramUrl,
|
||||
string? XUrl,
|
||||
string? LinkedInUrl,
|
||||
string? TikTokUrl,
|
||||
string? YoutubeUrl,
|
||||
string? RedditUrl,
|
||||
string? WebsiteUrl);
|
||||
|
||||
[PublicAPI]
|
||||
public class ChangeSocialsHandler(
|
||||
ContentDbContext context)
|
||||
: Endpoint<ChangeSocialsRequest>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Post("/api/creators/{CreatorId}/socials");
|
||||
Options(o => o.WithTags("Creators"));
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(ChangeSocialsRequest request, CancellationToken ct)
|
||||
{
|
||||
var creator = await context
|
||||
.Creators
|
||||
.Include(c => c.Socials)
|
||||
.SingleAsync(
|
||||
c => c.Id == request.CreatorId,
|
||||
cancellationToken: ct);
|
||||
|
||||
creator.Socials.FacebookUrl = request.FacebookUrl;
|
||||
creator.Socials.InstagramUrl = request.InstagramUrl;
|
||||
creator.Socials.XUrl = request.XUrl;
|
||||
creator.Socials.LinkedInUrl = request.LinkedInUrl;
|
||||
creator.Socials.TikTokUrl = request.TikTokUrl;
|
||||
creator.Socials.YoutubeUrl = request.YoutubeUrl;
|
||||
creator.Socials.RedditUrl = request.RedditUrl;
|
||||
creator.Socials.WebsiteUrl = request.WebsiteUrl;
|
||||
|
||||
await context.SaveChangesAsync(ct);
|
||||
|
||||
await SendOkAsync(ct);
|
||||
}
|
||||
}
|
||||
37
backend/src/Web/Features/Contents/Handlers/ChangeTitle.cs
Normal file
37
backend/src/Web/Features/Contents/Handlers/ChangeTitle.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Handlers;
|
||||
|
||||
[PublicAPI]
|
||||
public record ChangeTitleRequest(
|
||||
Guid CreatorId,
|
||||
string? Title);
|
||||
|
||||
[PublicAPI]
|
||||
public class ChangeTitleHandler(
|
||||
ContentDbContext context)
|
||||
: Endpoint<ChangeTitleRequest>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Post("/api/creators/{CreatorId}/title");
|
||||
Options(o => o.WithTags("Creators"));
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(
|
||||
ChangeTitleRequest request,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var creator = await context
|
||||
.Creators
|
||||
.SingleAsync(
|
||||
c => c.Id == request.CreatorId,
|
||||
cancellationToken: ct);
|
||||
|
||||
creator.Title = request.Title;
|
||||
|
||||
await context.SaveChangesAsync(ct);
|
||||
|
||||
await SendOkAsync(ct);
|
||||
}
|
||||
}
|
||||
156
backend/src/Web/Features/Contents/Handlers/CreateContent.cs
Normal file
156
backend/src/Web/Features/Contents/Handlers/CreateContent.cs
Normal file
@@ -0,0 +1,156 @@
|
||||
using System.Collections.Concurrent;
|
||||
using Hutopy.Web.Common.BlobStorage;
|
||||
using Hutopy.Web.Common.Security;
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Handlers;
|
||||
|
||||
[PublicAPI]
|
||||
public record PostContentRequest(
|
||||
Guid Id,
|
||||
Guid CreatorId,
|
||||
string Title,
|
||||
string Description,
|
||||
IFormFileCollection? Files,
|
||||
IFormFile? Thumbnail,
|
||||
string[]? ExternalUrls);
|
||||
|
||||
[PublicAPI]
|
||||
public sealed class PostContentRequestValidator : Validator<PostContentRequest>
|
||||
{
|
||||
public PostContentRequestValidator()
|
||||
{
|
||||
RuleFor(r => r.Id)
|
||||
.NotNull().WithMessage("You should specify the Id")
|
||||
.NotEmpty().WithMessage("You should specify a valid/not empty Id");
|
||||
|
||||
RuleFor(r => r.CreatorId)
|
||||
.NotNull().WithMessage("You should specify the CreatorId")
|
||||
.NotEmpty().WithMessage("You should specify a valid/not empty CreatorId");
|
||||
|
||||
RuleFor(r => r.Title)
|
||||
.NotNull().WithMessage("You should specify the Title")
|
||||
.NotEmpty().WithMessage("You should specify a valid/not empty Title");
|
||||
|
||||
RuleFor(r => r.Description)
|
||||
.NotNull().WithMessage("You should specify the Description")
|
||||
.NotEmpty().WithMessage("You should specify a valid/not empty Description");
|
||||
|
||||
RuleForEach(r => r.ExternalUrls)
|
||||
.Must(url => Uri.IsWellFormedUriString(url, UriKind.Absolute) &&
|
||||
(url.StartsWith("http://") || url.StartsWith("https://")))
|
||||
.WithMessage("External URL must be a valid HTTP/HTTPS URL");
|
||||
|
||||
RuleFor(r => r.Thumbnail)
|
||||
.Must(file => file == null || file.ContentType.StartsWith("image/"))
|
||||
.WithMessage("Thumbnail must be an image");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class PostContent(
|
||||
AzureBlobStorage blobStorage,
|
||||
ContentDbContext context)
|
||||
: Endpoint<PostContentRequest>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Post("/api/contents");
|
||||
Options(o => o.WithTags("Contents"));
|
||||
AllowFileUploads();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(PostContentRequest req, CancellationToken ct)
|
||||
{
|
||||
var urls = new ConcurrentBag<string>();
|
||||
string? thumbnailUrl = null;
|
||||
|
||||
await using var transaction = await context.Database.BeginTransactionAsync(ct);
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
if (req.Files is not null)
|
||||
{
|
||||
await Parallel.ForEachAsync(req.Files, ct, async (file, ict) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var contentUrl = await SaveFileAsync(req.CreatorId, req.Id, file, ict);
|
||||
urls.Add(contentUrl);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("Failed to upload file {FileName}: {Message}", file.FileName, ex.Message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (req.ExternalUrls is not null)
|
||||
{
|
||||
foreach (var externalUrl in req.ExternalUrls.Where(url => !string.IsNullOrWhiteSpace(url)))
|
||||
{
|
||||
urls.Add(externalUrl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (req.Thumbnail is not null)
|
||||
{
|
||||
try
|
||||
{
|
||||
thumbnailUrl = await SaveFileAsync(req.CreatorId, req.Id, req.Thumbnail, ct, isThumbnail: true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("Error uploading thumbnail: {Message}", ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
await context.Contents.AddAsync(new Content
|
||||
{
|
||||
Id = req.Id,
|
||||
CreatedBy = User.GetUserId(),
|
||||
Title = req.Title,
|
||||
Description = req.Description,
|
||||
Urls = urls.IsEmpty ? null : urls.ToArray(),
|
||||
ThumbnailUrl = thumbnailUrl,
|
||||
}, ct);
|
||||
|
||||
await context.SaveChangesAsync(ct);
|
||||
await transaction.CommitAsync(ct);
|
||||
|
||||
await SendOkAsync(new { Message = "Content published successfully!" }, ct);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await transaction.RollbackAsync(ct);
|
||||
Logger.LogError("Transaction failed: {Message}", ex.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<string> SaveFileAsync(
|
||||
Guid creatorId,
|
||||
Guid contentId,
|
||||
IFormFile file,
|
||||
CancellationToken ct = default,
|
||||
bool isThumbnail = false)
|
||||
{
|
||||
|
||||
var blobName = isThumbnail
|
||||
? $"{creatorId}/{SubDirectoryNames.Contents}/{contentId}/thumbnail-{file.FileName}"
|
||||
: $"{creatorId}/{SubDirectoryNames.Contents}/{contentId}/{file.FileName}";
|
||||
|
||||
|
||||
return await blobStorage.UploadFileAsync(
|
||||
ContainerNames.Creators,
|
||||
blobName,
|
||||
file.OpenReadStream(),
|
||||
file.ContentType,
|
||||
ct: ct);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
using System.Text;
|
||||
using Hutopy.Web.Common.BlobStorage;
|
||||
using Hutopy.Web.Common.Security;
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
using Hutopy.Web.Features.Contents.Handlers.Models;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Handlers;
|
||||
|
||||
[PublicAPI]
|
||||
public record PostContentFromHtmlRequest(
|
||||
Guid Id,
|
||||
Guid CreatorId,
|
||||
string Title,
|
||||
string HtmlContent
|
||||
);
|
||||
|
||||
[PublicAPI]
|
||||
public sealed class PostContentFromHtmlRequestValidator : Validator<PostContentFromHtmlRequest>
|
||||
{
|
||||
public PostContentFromHtmlRequestValidator()
|
||||
{
|
||||
RuleFor(r => r.Id)
|
||||
.NotNull().WithMessage("You should specify the Id")
|
||||
.NotEmpty().WithMessage("You should specify a valid/not empty Id");
|
||||
|
||||
RuleFor(r => r.CreatorId)
|
||||
.NotNull().WithMessage("You should specify the CreatorId")
|
||||
.NotEmpty().WithMessage("You should specify a valid/not empty CreatorId");
|
||||
|
||||
RuleFor(r => r.Title)
|
||||
.NotNull().WithMessage("You should specify the Title")
|
||||
.NotEmpty().WithMessage("You should specify a valid/not empty Title");
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class PostContentHtml(
|
||||
AzureBlobStorage blobStorage,
|
||||
ContentDbContext context)
|
||||
: Endpoint<PostContentFromHtmlRequest>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Post("/api/contents/html");
|
||||
Options(o => o.WithTags("Contents"));
|
||||
AllowFileUploads();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(
|
||||
PostContentFromHtmlRequest req,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var htmlFileUrl = await SaveHtmlContentAsHtmlFileAsync(
|
||||
req.CreatorId,
|
||||
req.Id,
|
||||
req.HtmlContent,
|
||||
ct);
|
||||
|
||||
await context.Contents.AddAsync(
|
||||
new Content { Id = req.Id, CreatedBy = User.GetUserId(), Title = req.Title, HtmlFileUrl = htmlFileUrl },
|
||||
ct);
|
||||
|
||||
await context.SaveChangesAsync(ct);
|
||||
|
||||
var content = await context
|
||||
.Contents
|
||||
.Select(c => new ContentModel
|
||||
{
|
||||
Id = c.Id,
|
||||
CreatedBy = c.CreatedBy,
|
||||
CreatedByName = c.Creator!.Name,
|
||||
CreatedByPortraitUrl = c.Creator.Images.Logo,
|
||||
CreatedAt = c.CreatedAt,
|
||||
DeletedBy = c.DeletedBy,
|
||||
DeletedAt = c.DeletedAt,
|
||||
Title = c.Title,
|
||||
Description = c.Description,
|
||||
Urls = c.Urls,
|
||||
ThumbnailUrl = c.ThumbnailUrl,
|
||||
HtmlFileUrl = htmlFileUrl
|
||||
})
|
||||
.SingleOrDefaultAsync(
|
||||
c => c.Id == req.Id,
|
||||
cancellationToken: ct);
|
||||
|
||||
await SendOkAsync(content, ct);
|
||||
}
|
||||
|
||||
private async Task<string> SaveHtmlContentAsHtmlFileAsync(
|
||||
Guid creatorId,
|
||||
Guid contentId,
|
||||
string htmlContent,
|
||||
CancellationToken ct = default)
|
||||
{
|
||||
var fileName = $"{contentId}.html";
|
||||
var filePath = $"{creatorId}/{SubDirectoryNames.Contents}/{fileName}";
|
||||
|
||||
// Convert the HTML string into a stream
|
||||
using var stream = new MemoryStream(Encoding.UTF8.GetBytes(htmlContent));
|
||||
|
||||
// Upload the stream as an HTML file
|
||||
var url = await blobStorage.UploadFileAsync(
|
||||
ContainerNames.Creators,
|
||||
filePath,
|
||||
stream,
|
||||
"text/html",
|
||||
ct: ct);
|
||||
|
||||
return url;
|
||||
}
|
||||
}
|
||||
91
backend/src/Web/Features/Contents/Handlers/CreateCreator.cs
Normal file
91
backend/src/Web/Features/Contents/Handlers/CreateCreator.cs
Normal file
@@ -0,0 +1,91 @@
|
||||
using System.Net;
|
||||
using FluentValidation.Results;
|
||||
using Hutopy.Web.Common.Security;
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
using Npgsql;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Handlers;
|
||||
|
||||
[PublicAPI]
|
||||
public record CreateCreatorRequest(
|
||||
Guid CreatorId,
|
||||
string Name);
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class CreateCreatorRequestValidator : Validator<CreateCreatorRequest>
|
||||
{
|
||||
public CreateCreatorRequestValidator()
|
||||
{
|
||||
RuleFor(r => r.CreatorId)
|
||||
.NotNull().WithMessage("You should specify the CreatorId")
|
||||
.NotEmpty().WithMessage("You should specify a valid/not empty CreatorId");
|
||||
|
||||
RuleFor(r => r.Name)
|
||||
.NotNull().WithMessage("You should specify the Name")
|
||||
.NotEmpty().WithMessage("You should specify a valid/not empty Name");
|
||||
}
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
public sealed class CreateCreatorHandler(
|
||||
ContentDbContext context)
|
||||
: Endpoint<CreateCreatorRequest>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Post("/api/creators");
|
||||
Options(o => o.WithTags("Creators"));
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(
|
||||
CreateCreatorRequest req,
|
||||
CancellationToken ct)
|
||||
{
|
||||
try
|
||||
{
|
||||
await context.Creators.AddAsync(
|
||||
new Creator
|
||||
{
|
||||
Id = req.CreatorId,
|
||||
CreatedBy = User.GetUserId(),
|
||||
Name = req.Name,
|
||||
Colors =
|
||||
{
|
||||
Primary = "#6200EE",
|
||||
OnPrimary = "#FFFFFF",
|
||||
Secondary = "#03DAC6",
|
||||
OnSecondary = "#000000",
|
||||
Surface = "#FFFFFF",
|
||||
OnSurface = "#000000",
|
||||
Error = "#B00020",
|
||||
OnError = "#FFFFFF",
|
||||
Background = "#FFFFFF",
|
||||
OnBackground = "#000000",
|
||||
}
|
||||
},
|
||||
ct);
|
||||
|
||||
await context.SaveChangesAsync(ct);
|
||||
|
||||
await SendOkAsync(ct);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (e.InnerException is PostgresException innerException)
|
||||
{
|
||||
if (innerException.ConstraintName == "IX_Creators_NormalizedName")
|
||||
{
|
||||
await SendResultAsync(new ProblemDetails(
|
||||
[new ValidationFailure(nameof(Creator.Name), "The name is already taken.")],
|
||||
(int)HttpStatusCode.Conflict));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
await SendResultAsync(new ProblemDetails(
|
||||
[new ValidationFailure(nameof(Creator.Name), e.Message)],
|
||||
(int)HttpStatusCode.Conflict));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
60
backend/src/Web/Features/Contents/Handlers/DeleteContent.cs
Normal file
60
backend/src/Web/Features/Contents/Handlers/DeleteContent.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using Hutopy.Web.Common;
|
||||
using Hutopy.Web.Common.Security;
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Handlers;
|
||||
|
||||
[PublicAPI]
|
||||
public record DeleteContentRequest(
|
||||
Guid ContentId);
|
||||
|
||||
[PublicAPI]
|
||||
public sealed class DeleteContentRequestValidator : Validator<DeleteContentRequest>
|
||||
{
|
||||
public DeleteContentRequestValidator()
|
||||
{
|
||||
RuleFor(r => r.ContentId)
|
||||
.NotNull().WithMessage("You should specify the ContentId")
|
||||
.NotEmpty().WithMessage("You should specify a valid/not empty ContentId");
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class DeleteContent(
|
||||
ContentDbContext context)
|
||||
: Endpoint<DeleteContentRequest>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Delete("/api/contents/{ContentId}");
|
||||
Options(o => o.WithTags("Contents"));
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(
|
||||
DeleteContentRequest req,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var content = await context.Contents.FindAsync(
|
||||
[req.ContentId],
|
||||
ct);
|
||||
|
||||
if (content is null)
|
||||
{
|
||||
await SendNotFoundAsync(ct);
|
||||
return;
|
||||
}
|
||||
|
||||
var userId = HttpContext.User.GetUserId();
|
||||
if (content.CreatedBy != userId)
|
||||
{
|
||||
await SendForbiddenAsync(ct);
|
||||
return;
|
||||
}
|
||||
|
||||
content.DeletedAt = DateTimeOffset.UtcNow;
|
||||
content.DeletedBy = userId;
|
||||
|
||||
await context.SaveChangesAsync(ct);
|
||||
|
||||
await SendOkAsync(ct);
|
||||
}
|
||||
}
|
||||
59
backend/src/Web/Features/Contents/Handlers/GetContent.cs
Normal file
59
backend/src/Web/Features/Contents/Handlers/GetContent.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using Hutopy.Web.Extensions;
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
using Hutopy.Web.Features.Contents.Handlers.Models;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Handlers;
|
||||
|
||||
[PublicAPI]
|
||||
public sealed class GetContentRequest
|
||||
{
|
||||
public Guid ContentId { get; set; }
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
public class GetContent(
|
||||
ContentDbContext context)
|
||||
: Endpoint<GetContentRequest, ContentModel>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Get("/api/contents/{ContentId:guid}");
|
||||
Options(o => o.WithTags("Contents"));
|
||||
AllowAnonymous();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(
|
||||
GetContentRequest req,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var content = await context
|
||||
.Contents
|
||||
.Select(c => new ContentModel
|
||||
{
|
||||
Id = c.Id,
|
||||
CreatedBy = c.CreatedBy,
|
||||
CreatedByName = c.Creator!.Name,
|
||||
CreatedByPortraitUrl = c.Creator.Images.Logo,
|
||||
CreatedAt = c.CreatedAt,
|
||||
DeletedBy = c.DeletedBy,
|
||||
DeletedAt = c.DeletedAt,
|
||||
Title = c.Title,
|
||||
Description = c.Description,
|
||||
Urls = c.Urls,
|
||||
ThumbnailUrl = c.ThumbnailUrl,
|
||||
HtmlFileUrl = c.HtmlFileUrl ?? "",
|
||||
Reactions = c.Reactions.Select(x => new ReactionModel
|
||||
{
|
||||
Reaction = x.Reaction.FromEnum(), UserId = x.UserId, UserName = x.UserName
|
||||
}).ToList()
|
||||
})
|
||||
.SingleOrDefaultAsync(
|
||||
c => c.Id == req.ContentId,
|
||||
cancellationToken: ct);
|
||||
|
||||
if (content is null)
|
||||
await SendNotFoundAsync(cancellation: ct);
|
||||
else
|
||||
await SendAsync(content, cancellation: ct);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
using Hutopy.Web.Extensions;
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
using Hutopy.Web.Features.Contents.Handlers.Models;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Handlers;
|
||||
|
||||
[PublicAPI]
|
||||
public sealed class GetContentsByCreatorRequest
|
||||
{
|
||||
public Guid CreatorId { get; set; }
|
||||
[BindFrom("page_size")] public int PageSize { get; set; } = 10;
|
||||
[BindFrom("last_id")] public Guid? LastId { get; set; }
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
public class GetContentsByCreatorHandler(
|
||||
ContentDbContext context)
|
||||
: Endpoint<GetContentsByCreatorRequest, List<ContentModel>>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Get("/api/contents/creator/{CreatorId:guid}");
|
||||
Options(o => o.WithTags("Contents"));
|
||||
AllowAnonymous();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(
|
||||
GetContentsByCreatorRequest req,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var query = context.Contents
|
||||
.Where(c => c.CreatedBy == req.CreatorId && c.DeletedAt == null)
|
||||
.OrderByDescending(c => c.CreatedAt);
|
||||
|
||||
if (req.LastId.HasValue)
|
||||
{
|
||||
query = query.Where(c => c.Id > req.LastId.Value)
|
||||
.OrderByDescending(c => c.CreatedAt);
|
||||
}
|
||||
|
||||
var content = await query
|
||||
.Select(c => new ContentModel
|
||||
{
|
||||
Id = c.Id,
|
||||
CreatedBy = c.CreatedBy,
|
||||
CreatedByName = c.Creator!.Name,
|
||||
CreatedByPortraitUrl = c.Creator.Images.Logo,
|
||||
CreatedAt = c.CreatedAt,
|
||||
DeletedBy = c.DeletedBy,
|
||||
DeletedAt = c.DeletedAt,
|
||||
Title = c.Title,
|
||||
Description = c.Description,
|
||||
Urls = c.Urls,
|
||||
ThumbnailUrl = c.ThumbnailUrl,
|
||||
HtmlFileUrl = c.HtmlFileUrl ?? "",
|
||||
Reactions = c.Reactions.Select(x => new ReactionModel
|
||||
{
|
||||
Reaction = x.Reaction.FromEnum(),
|
||||
UserId = x.UserId,
|
||||
UserName = x.UserName
|
||||
}).ToList()
|
||||
})
|
||||
.Take(req.PageSize)
|
||||
.ToListAsync(ct);
|
||||
|
||||
await SendAsync(content, cancellation: ct);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
using Hutopy.Web.Features.Contents.Handlers.Models;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Handlers;
|
||||
|
||||
[PublicAPI]
|
||||
public sealed class GetCreatorByAliasRequest
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
public record struct GetCreatorByAliasResponse(
|
||||
Guid Id,
|
||||
Guid CreatedBy,
|
||||
DateTimeOffset CreatedAt,
|
||||
bool Verified,
|
||||
bool AcceptDonation,
|
||||
string Name,
|
||||
string? Title,
|
||||
Socials Socials,
|
||||
Colors Colors,
|
||||
PresentationInfos PresentationInfos,
|
||||
Images Images);
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class GetCreatorByAliasRequestValidator
|
||||
: Validator<GetCreatorByAliasRequest>
|
||||
{
|
||||
public GetCreatorByAliasRequestValidator()
|
||||
{
|
||||
RuleFor(r => r.Name)
|
||||
.NotNull().WithMessage("You should specify the Name")
|
||||
.NotEmpty().WithMessage("You should specify a valid/not empty Name");
|
||||
}
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
public class GetCreatorByAliasHandler(
|
||||
ContentDbContext context)
|
||||
: Endpoint<GetCreatorByAliasRequest, GetCreatorByAliasResponse>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Get("/api/creators/@{Name}");
|
||||
Options((o => o.WithTags("Creators")));
|
||||
AllowAnonymous();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(
|
||||
GetCreatorByAliasRequest req,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var creatorName = req.Name.ToLower();
|
||||
|
||||
var creator = await context
|
||||
.Creators
|
||||
.Where(c => EF.Functions.ILike(c.Name, creatorName))
|
||||
.FirstOrDefaultAsync(ct);
|
||||
|
||||
if (creator is null)
|
||||
{
|
||||
await SendNotFoundAsync(ct);
|
||||
}
|
||||
else
|
||||
{
|
||||
var model = new GetCreatorByAliasResponse(
|
||||
creator.Id,
|
||||
creator.CreatedBy,
|
||||
creator.CreatedAt,
|
||||
creator.Verified,
|
||||
creator.AcceptDonation,
|
||||
creator.Name,
|
||||
creator.Title,
|
||||
creator.Socials,
|
||||
creator.Colors,
|
||||
creator.PresentationInfos,
|
||||
creator.Images);
|
||||
|
||||
await SendAsync(model, cancellation: ct);
|
||||
}
|
||||
}
|
||||
}
|
||||
48
backend/src/Web/Features/Contents/Handlers/GetCreatorById.cs
Normal file
48
backend/src/Web/Features/Contents/Handlers/GetCreatorById.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Handlers;
|
||||
|
||||
[PublicAPI]
|
||||
public sealed class GetCreatorByIdRequest
|
||||
{
|
||||
public required Guid CreatorId { get; set; }
|
||||
}
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class GetCreatorByIdRequestValidator
|
||||
: Validator<GetCreatorByIdRequest>
|
||||
{
|
||||
public GetCreatorByIdRequestValidator()
|
||||
{
|
||||
RuleFor(r => r.CreatorId)
|
||||
.NotNull().WithMessage("You should specify the CreatorId")
|
||||
.NotEmpty().WithMessage("You should specify a valid/not empty CreatorId");
|
||||
}
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
public class GetCreatorByIdHandler(
|
||||
ContentDbContext context)
|
||||
: Endpoint<GetCreatorByIdRequest, Creator>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Get("/api/creators/{CreatorId}");
|
||||
Options((o => o.WithTags("Creators")));
|
||||
AllowAnonymous();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(
|
||||
GetCreatorByIdRequest req,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var creator = await context
|
||||
.Creators
|
||||
.FindAsync(
|
||||
[req.CreatorId],
|
||||
cancellationToken: ct);
|
||||
|
||||
if (creator is null) await SendNotFoundAsync(ct);
|
||||
else await SendAsync(creator, cancellation: ct);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using Hutopy.Web.Common;
|
||||
using Hutopy.Web.Common.Security;
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Handlers;
|
||||
|
||||
[PublicAPI]
|
||||
public class GetCreatorProfileHandler(
|
||||
ContentDbContext context)
|
||||
: EndpointWithoutRequest<Creator>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Get("/api/creators/profile");
|
||||
Options((o => o.WithTags("Creators")));
|
||||
AllowAnonymous();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(
|
||||
CancellationToken ct)
|
||||
{
|
||||
var creator = await context
|
||||
.Creators
|
||||
.FindAsync(
|
||||
[HttpContext.User.GetUserId()],
|
||||
cancellationToken: ct);
|
||||
|
||||
if (creator is null) await SendNotFoundAsync(ct);
|
||||
else await SendAsync(creator, cancellation: ct);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using Hutopy.Web.Extensions;
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
using Hutopy.Web.Features.Contents.Handlers.Models;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Handlers;
|
||||
|
||||
[PublicAPI]
|
||||
public sealed class GetFeaturedContentsRequest
|
||||
{
|
||||
[BindFrom("page_size")] public int PageSize { get; set; } = 10;
|
||||
[BindFrom("last_id")] public Guid? LastId { get; set; }
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
public class GetFeaturedContentsHandler(
|
||||
ContentDbContext context)
|
||||
: Endpoint<GetFeaturedContentsRequest, List<ContentModel>>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Get("/api/contents/featured");
|
||||
Options(o => o.WithTags("Contents"));
|
||||
AllowAnonymous();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(
|
||||
GetFeaturedContentsRequest req,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var query = context.Contents
|
||||
.Where(c => c.DeletedAt == null);
|
||||
|
||||
if (req.LastId.HasValue)
|
||||
{
|
||||
query = query.Where(c => c.Id > req.LastId.Value);
|
||||
}
|
||||
|
||||
query = query.OrderByDescending(x => x.Reactions.Count);
|
||||
|
||||
var content = await query
|
||||
.Select(c => new ContentModel
|
||||
{
|
||||
Id = c.Id,
|
||||
CreatedBy = c.CreatedBy,
|
||||
CreatedByName = c.Creator!.Name,
|
||||
CreatedByPortraitUrl = c.Creator.Images.Logo,
|
||||
CreatedAt = c.CreatedAt,
|
||||
DeletedBy = c.DeletedBy,
|
||||
DeletedAt = c.DeletedAt,
|
||||
Title = c.Title,
|
||||
Description = c.Description,
|
||||
Urls = c.Urls,
|
||||
ThumbnailUrl = c.ThumbnailUrl,
|
||||
Reactions = c.Reactions.Select(x => new ReactionModel
|
||||
{
|
||||
Reaction = x.Reaction.FromEnum(),
|
||||
UserId = x.UserId,
|
||||
UserName = x.UserName
|
||||
}).ToList()
|
||||
})
|
||||
.Take(req.PageSize)
|
||||
.ToListAsync(ct);
|
||||
|
||||
await SendAsync(content, cancellation: ct);
|
||||
}
|
||||
}
|
||||
86
backend/src/Web/Features/Contents/Handlers/InsertImage.cs
Normal file
86
backend/src/Web/Features/Contents/Handlers/InsertImage.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using Hutopy.Web.Common.BlobStorage;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Handlers;
|
||||
|
||||
[PublicAPI]
|
||||
public record InsertImagesRequest(
|
||||
Guid Id,
|
||||
Guid CreatorId,
|
||||
IFormFileCollection? Files
|
||||
);
|
||||
|
||||
[PublicAPI]
|
||||
public sealed class InsertImagesRequestValidator : Validator<InsertImagesRequest>
|
||||
{
|
||||
public InsertImagesRequestValidator()
|
||||
{
|
||||
RuleFor(r => r.Id)
|
||||
.NotNull().WithMessage("You should specify the Id")
|
||||
.NotEmpty().WithMessage("You should specify a valid/not empty Id");
|
||||
|
||||
RuleFor(r => r.CreatorId)
|
||||
.NotNull().WithMessage("You should specify the CreatorId")
|
||||
.NotEmpty().WithMessage("You should specify a valid/not empty CreatorId");
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class InsertImages(
|
||||
AzureBlobStorage blobStorage)
|
||||
: Endpoint<InsertImagesRequest>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Post("/api/content/insert-image/");
|
||||
Options(o => o.WithTags("Contents"));
|
||||
AllowFileUploads();
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(
|
||||
InsertImagesRequest req,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var urls = new List<string>();
|
||||
if (req.Files is not null)
|
||||
{
|
||||
await Parallel.ForEachAsync(
|
||||
req.Files,
|
||||
ct,
|
||||
async (
|
||||
file,
|
||||
ict) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var contentUrl = await SaveFileAsync(
|
||||
req.CreatorId,
|
||||
req.Id,
|
||||
file,
|
||||
ict);
|
||||
urls.Add(contentUrl);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("{ErrorMessage}", ex.Message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
await SendOkAsync(urls, ct);
|
||||
}
|
||||
|
||||
private async Task<string> SaveFileAsync(
|
||||
Guid creatorId,
|
||||
Guid contentId,
|
||||
IFormFile file,
|
||||
CancellationToken ct = default)
|
||||
{
|
||||
var url = await blobStorage.UploadFileAsync(
|
||||
ContainerNames.Creators,
|
||||
$"{creatorId}/{SubDirectoryNames.Contents}/{contentId}/{file.FileName}",
|
||||
file.OpenReadStream(),
|
||||
file.ContentType,
|
||||
ct: ct);
|
||||
|
||||
return url;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace Hutopy.Web.Features.Contents.Handlers.Models;
|
||||
|
||||
[PublicAPI]
|
||||
public class ContentModel
|
||||
{
|
||||
public required Guid Id { get; init; }
|
||||
public required Guid CreatedBy { get; init; }
|
||||
public required string CreatedByName { get; init; }
|
||||
public required string? CreatedByPortraitUrl { get; init; }
|
||||
public required DateTimeOffset CreatedAt { get; init; }
|
||||
public Guid? DeletedBy { get; init; }
|
||||
public DateTimeOffset? DeletedAt { get; init; }
|
||||
public required string Title { get; init; }
|
||||
public required string Description { get; init; }
|
||||
public string HtmlFileUrl { get; init; } = "";
|
||||
public required string[]? Urls { get; init; }
|
||||
public string? ThumbnailUrl { get; init; }
|
||||
public IList<ReactionModel>? Reactions { get; set; } = new List<ReactionModel>();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Hutopy.Web.Features.Contents.Handlers.Models;
|
||||
|
||||
[PublicAPI]
|
||||
public record FollowModel(
|
||||
Guid CreatorId,
|
||||
string CreatorName,
|
||||
string? CreatorPortraitUrl);
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Hutopy.Web.Features.Contents.Handlers.Models;
|
||||
|
||||
public class ReactionModel
|
||||
{
|
||||
public required string Reaction { get; set; }
|
||||
public required Guid UserId { get; set; }
|
||||
public required string UserName { get; set; }
|
||||
}
|
||||
36
backend/src/Web/Features/Contents/Handlers/RemoveReaction.cs
Normal file
36
backend/src/Web/Features/Contents/Handlers/RemoveReaction.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Hutopy.Web.Features.Contents.Data;
|
||||
|
||||
namespace Hutopy.Web.Features.Contents.Handlers;
|
||||
|
||||
[PublicAPI]
|
||||
public sealed class RemoveReactionRequest
|
||||
{
|
||||
public required Guid ContentId { get; set; }
|
||||
public required Guid UserId { get; set; }
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
public class RemoveReaction(
|
||||
ContentDbContext context)
|
||||
: Endpoint<RemoveReactionRequest>
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Post("/api/content/reaction/remove");
|
||||
Options(o => o.WithTags("Contents"));
|
||||
}
|
||||
|
||||
public override async Task HandleAsync(
|
||||
RemoveReactionRequest req,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var content = await context.Contents
|
||||
.SingleAsync(x => x.Id == req.ContentId, ct);
|
||||
|
||||
var reaction = content.Reactions.Single(x => x.UserId == req.UserId);
|
||||
|
||||
content.Reactions.Remove(reaction);
|
||||
|
||||
await context.SaveChangesAsync(ct);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user