Remove creator's about, adds title.

Remove extra content properties.
Change creator's colors to materials palette.
This commit is contained in:
2024-09-22 03:10:00 -04:00
parent cc8cdbe0d6
commit e482a0726f
21 changed files with 1656 additions and 153 deletions

View File

@@ -43,10 +43,6 @@ public class ContentDbContext(
.Entity<Subscription>() .Entity<Subscription>()
.HasKey(s => new { s.CreatedBy, s.CreatorId }); .HasKey(s => new { s.CreatedBy, s.CreatorId });
modelBuilder
.Entity<Creator>()
.OwnsOne<About>(x => x.About);
modelBuilder modelBuilder
.Entity<Creator>() .Entity<Creator>()
.OwnsOne<Socials>(x => x.Socials) .OwnsOne<Socials>(x => x.Socials)

View File

@@ -9,24 +9,24 @@ public class Creator
public DateTimeOffset CreatedAt { get; init; } public DateTimeOffset CreatedAt { get; init; }
[MaxLength(255)] public string Name { get; set; } = null!; [MaxLength(255)] public string Name { get; set; } = null!;
public About About { get; set; } = new(); [MaxLength(255)] public string? Title { get; set; }
public Socials Socials { get; set; } = new(); public Socials Socials { get; set; } = new();
public Colors Colors { get; set; } = new(); public Colors Colors { get; set; } = new();
public Images Images { get; set; } = new(); public Images Images { get; set; } = new();
} }
public class About
{
[MaxLength(255)] public string? Title { get; set; }
[MaxLength(2048)] public string? Description { get; set; }
}
public class Colors public class Colors
{ {
[MaxLength(9)] public string? BannerTop { get; set; } [MaxLength(9)] public string Primary { get; set; } = null!;
[MaxLength(9)] public string? BannerBottom { get; set; } [MaxLength(9)] public string Secondary { get; set; } = null!;
[MaxLength(9)] public string? Accent { get; set; } [MaxLength(9)] public string Background { get; set; } = null!;
[MaxLength(9)] public string? Menu { get; set; } [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 public class Socials

View File

@@ -5,10 +5,16 @@ namespace Hutopy.Web.Features.Contents.Handlers;
[PublicAPI] [PublicAPI]
public record ChangeColorsRequest( public record ChangeColorsRequest(
Guid CreatorId, Guid CreatorId,
string? BannerTop, string Primary,
string? BannerBottom, string Secondary,
string? Accent, string Background,
string? Menu); string Surface,
string Error,
string OnPrimary,
string OnSecondary,
string OnBackground,
string OnSurface,
string OnError);
[PublicAPI] [PublicAPI]
public sealed class ChangeColorsRequestValidator public sealed class ChangeColorsRequestValidator
@@ -16,29 +22,55 @@ public sealed class ChangeColorsRequestValidator
{ {
public ChangeColorsRequestValidator() public ChangeColorsRequestValidator()
{ {
RuleFor(x => x.BannerTop) RuleFor(x => x.Primary)
.MinimumLength(4).WithMessage("The minimum value should be in the format #444") .MinimumLength(4).WithMessage("The minimum value should be in the format #444")
.MaximumLength(9).WithMessage("The maximum value should be in the format #11223344") .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 #") .Must(x => x.StartsWith('#')).WithMessage("The format should be a valid html color and start with #");
.When(x => x.BannerTop is not null);
RuleFor(x => x.BannerBottom) RuleFor(x => x.Secondary)
.MinimumLength(4).WithMessage("The minimum value should be in the format #444") .MinimumLength(4).WithMessage("The minimum value should be in the format #444")
.MaximumLength(9).WithMessage("The maximum value should be in the format #11223344") .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 #") .Must(x => x.StartsWith('#')).WithMessage("The format should be a valid html color and start with #");
.When(x => x.BannerBottom is not null);
RuleFor(x => x.Accent) RuleFor(x => x.Background)
.MinimumLength(4).WithMessage("The minimum value should be in the format #444") .MinimumLength(4).WithMessage("The minimum value should be in the format #444")
.MaximumLength(9).WithMessage("The maximum value should be in the format #11223344") .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 #") .Must(x => x.StartsWith('#')).WithMessage("The format should be a valid html color and start with #");
.When(x => x.Accent is not null);
RuleFor(x => x.Menu) RuleFor(x => x.Surface)
.MinimumLength(4).WithMessage("The minimum value should be in the format #444") .MinimumLength(4).WithMessage("The minimum value should be in the format #444")
.MaximumLength(9).WithMessage("The maximum value should be in the format #11223344") .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 #") .Must(x => x.StartsWith('#')).WithMessage("The format should be a valid html color and start with #");
.When(x => x.Menu is not null);
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 #");
} }
} }
@@ -63,10 +95,16 @@ public class ChangeColorsHandler(
c => c.Id == request.CreatorId, c => c.Id == request.CreatorId,
cancellationToken: ct); cancellationToken: ct);
creator.Colors.BannerTop = request.BannerTop; creator.Colors.Primary = request.Primary;
creator.Colors.BannerBottom = request.BannerBottom; creator.Colors.Secondary = request.Secondary;
creator.Colors.Accent = request.Accent; creator.Colors.Background = request.Background;
creator.Colors.Menu = request.Menu; 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 context.SaveChangesAsync(ct);

View File

@@ -3,35 +3,32 @@
namespace Hutopy.Web.Features.Contents.Handlers; namespace Hutopy.Web.Features.Contents.Handlers;
[PublicAPI] [PublicAPI]
public record ChangeAboutRequest( public record ChangeTitleRequest(
Guid CreatorId, Guid CreatorId,
string? Title, string? Title);
string? Description);
[PublicAPI] [PublicAPI]
public class ChangeAboutHandler( public class ChangeTitleHandler(
ContentDbContext context) ContentDbContext context)
: Endpoint<ChangeAboutRequest> : Endpoint<ChangeTitleRequest>
{ {
public override void Configure() public override void Configure()
{ {
Post("/api/creators/{CreatorId}/about"); Post("/api/creators/{CreatorId}/title");
Options(o => o.WithTags("Creators")); Options(o => o.WithTags("Creators"));
} }
public override async Task HandleAsync( public override async Task HandleAsync(
ChangeAboutRequest request, ChangeTitleRequest request,
CancellationToken ct) CancellationToken ct)
{ {
var creator = await context var creator = await context
.Creators .Creators
.Include(c => c.About)
.SingleAsync( .SingleAsync(
c => c.Id == request.CreatorId, c => c.Id == request.CreatorId,
cancellationToken: ct); cancellationToken: ct);
creator.About.Title = request.Title; creator.Title = request.Title;
creator.About.Description = request.Description;
await context.SaveChangesAsync(ct); await context.SaveChangesAsync(ct);

View File

@@ -117,8 +117,6 @@ public sealed class PostContent(
CreatedByName = c.Creator!.Name, CreatedByName = c.Creator!.Name,
CreatedByPortraitUrl = c.Creator.Images.Logo, CreatedByPortraitUrl = c.Creator.Images.Logo,
CreatedAt = c.CreatedAt, CreatedAt = c.CreatedAt,
ColorMenu = c.Creator.Colors.Menu,
ColorAccent = c.Creator.Colors.Accent,
DeletedBy = c.DeletedBy, DeletedBy = c.DeletedBy,
DeletedAt = c.DeletedAt, DeletedAt = c.DeletedAt,
Title = c.Title, Title = c.Title,

View File

@@ -35,8 +35,6 @@ public class GetContent(
CreatedByName = c.Creator!.Name, CreatedByName = c.Creator!.Name,
CreatedByPortraitUrl = c.Creator.Images.Logo, CreatedByPortraitUrl = c.Creator.Images.Logo,
CreatedAt = c.CreatedAt, CreatedAt = c.CreatedAt,
ColorMenu = c.Creator.Colors.Menu,
ColorAccent = c.Creator.Colors.Accent,
DeletedBy = c.DeletedBy, DeletedBy = c.DeletedBy,
DeletedAt = c.DeletedAt, DeletedAt = c.DeletedAt,
Title = c.Title, Title = c.Title,

View File

@@ -46,8 +46,6 @@ public class GetContentsByCreatorHandler(
CreatedByName = c.Creator!.Name, CreatedByName = c.Creator!.Name,
CreatedByPortraitUrl = c.Creator.Images.Logo, CreatedByPortraitUrl = c.Creator.Images.Logo,
CreatedAt = c.CreatedAt, CreatedAt = c.CreatedAt,
ColorMenu = c.Creator.Colors.Menu,
ColorAccent = c.Creator.Colors.Accent,
DeletedBy = c.DeletedBy, DeletedBy = c.DeletedBy,
DeletedAt = c.DeletedAt, DeletedAt = c.DeletedAt,
Title = c.Title, Title = c.Title,

View File

@@ -59,7 +59,7 @@ public class GetCreatorByAliasHandler(
creator.CreatedBy, creator.CreatedBy,
creator.CreatedAt, creator.CreatedAt,
creator.Name, creator.Name,
creator.About, creator.Title,
creator.Socials, creator.Socials,
creator.Colors, creator.Colors,
creator.Images, creator.Images,

View File

@@ -45,8 +45,6 @@ public class GetFeaturedContentsHandler(
CreatedByName = c.Creator!.Name, CreatedByName = c.Creator!.Name,
CreatedByPortraitUrl = c.Creator.Images.Logo, CreatedByPortraitUrl = c.Creator.Images.Logo,
CreatedAt = c.CreatedAt, CreatedAt = c.CreatedAt,
ColorMenu = c.Creator.Colors.Menu,
ColorAccent = c.Creator.Colors.Accent,
DeletedBy = c.DeletedBy, DeletedBy = c.DeletedBy,
DeletedAt = c.DeletedAt, DeletedAt = c.DeletedAt,
Title = c.Title, Title = c.Title,

View File

@@ -55,8 +55,6 @@ public class GetFollowedContentsHandler(
CreatedByName = c.Creator!.Name, CreatedByName = c.Creator!.Name,
CreatedByPortraitUrl = c.Creator.Images.Logo, CreatedByPortraitUrl = c.Creator.Images.Logo,
CreatedAt = c.CreatedAt, CreatedAt = c.CreatedAt,
ColorMenu = c.Creator.Colors.Menu,
ColorAccent = c.Creator.Colors.Accent,
DeletedBy = c.DeletedBy, DeletedBy = c.DeletedBy,
DeletedAt = c.DeletedAt, DeletedAt = c.DeletedAt,
Title = c.Title, Title = c.Title,

View File

@@ -7,8 +7,6 @@ public class ContentModel
public required Guid CreatedBy { get; init; } public required Guid CreatedBy { get; init; }
public required string CreatedByName { get; init; } public required string CreatedByName { get; init; }
public required string? CreatedByPortraitUrl { get; init; } public required string? CreatedByPortraitUrl { get; init; }
public required string? ColorMenu { get; init; }
public required string? ColorAccent { get; init; }
public required DateTimeOffset CreatedAt { get; init; } public required DateTimeOffset CreatedAt { get; init; }
public Guid? DeletedBy { get; init; } public Guid? DeletedBy { get; init; }
public DateTimeOffset? DeletedAt { get; init; } public DateTimeOffset? DeletedAt { get; init; }

View File

@@ -8,7 +8,7 @@ public record struct CreatorModel(
Guid CreatedBy, Guid CreatedBy,
DateTimeOffset CreatedAt, DateTimeOffset CreatedAt,
string Name, string Name,
About About, string? Title,
Socials Socials, Socials Socials,
Colors Colors, Colors Colors,
Images Images, Images Images,

View File

@@ -0,0 +1,320 @@
// <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.Migrations
{
[DbContext(typeof(ContentDbContext))]
[Migration("20240919045548_UseMeterialColorSchema")]
partial class UseMeterialColorSchema
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("Content")
.HasAnnotation("ProductVersion", "8.0.4")
.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>("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.HasKey("Id");
b.ToTable("Creators", "Content");
});
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Subscription", b =>
{
b.Property<Guid>("CreatedBy")
.HasColumnType("uuid");
b.Property<Guid>("CreatorId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("CreatedBy", "CreatorId");
b.HasIndex("CreatorId");
b.ToTable("Subscriptions", "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("ContentReactions", "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.About", "About", b1 =>
{
b1.Property<Guid>("CreatorId")
.HasColumnType("uuid");
b1.Property<string>("Description")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b1.Property<string>("Title")
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b1.HasKey("CreatorId");
b1.ToTable("Creators", "Content");
b1.WithOwner()
.HasForeignKey("CreatorId");
});
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Colors", "Colors", b1 =>
{
b1.Property<Guid>("CreatorId")
.HasColumnType("uuid");
b1.Property<string>("Background")
.HasMaxLength(9)
.HasColumnType("character varying(9)");
b1.Property<string>("Error")
.HasMaxLength(9)
.HasColumnType("character varying(9)");
b1.Property<string>("OnBackground")
.HasMaxLength(9)
.HasColumnType("character varying(9)");
b1.Property<string>("OnError")
.HasMaxLength(9)
.HasColumnType("character varying(9)");
b1.Property<string>("OnPrimary")
.HasMaxLength(9)
.HasColumnType("character varying(9)");
b1.Property<string>("OnSecondary")
.HasMaxLength(9)
.HasColumnType("character varying(9)");
b1.Property<string>("OnSurface")
.HasMaxLength(9)
.HasColumnType("character varying(9)");
b1.Property<string>("Primary")
.HasMaxLength(9)
.HasColumnType("character varying(9)");
b1.Property<string>("Secondary")
.HasMaxLength(9)
.HasColumnType("character varying(9)");
b1.Property<string>("Surface")
.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("About")
.IsRequired();
b.Navigation("Colors")
.IsRequired();
b.Navigation("Images")
.IsRequired();
b.Navigation("Socials")
.IsRequired();
});
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Subscription", b =>
{
b.HasOne("Hutopy.Web.Features.Contents.Data.Creator", "Creator")
.WithMany()
.HasForeignKey("CreatorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Creator");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,144 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Hutopy.Web.Features.Contents.Migrations
{
/// <inheritdoc />
public partial class UseMeterialColorSchema : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "Menu",
schema: "Content",
table: "Colors",
newName: "Surface");
migrationBuilder.RenameColumn(
name: "BannerTop",
schema: "Content",
table: "Colors",
newName: "Secondary");
migrationBuilder.RenameColumn(
name: "BannerBottom",
schema: "Content",
table: "Colors",
newName: "Primary");
migrationBuilder.RenameColumn(
name: "Accent",
schema: "Content",
table: "Colors",
newName: "OnSurface");
migrationBuilder.AddColumn<string>(
name: "Background",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Error",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "OnBackground",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "OnError",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "OnPrimary",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: true);
migrationBuilder.AddColumn<string>(
name: "OnSecondary",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Background",
schema: "Content",
table: "Colors");
migrationBuilder.DropColumn(
name: "Error",
schema: "Content",
table: "Colors");
migrationBuilder.DropColumn(
name: "OnBackground",
schema: "Content",
table: "Colors");
migrationBuilder.DropColumn(
name: "OnError",
schema: "Content",
table: "Colors");
migrationBuilder.DropColumn(
name: "OnPrimary",
schema: "Content",
table: "Colors");
migrationBuilder.DropColumn(
name: "OnSecondary",
schema: "Content",
table: "Colors");
migrationBuilder.RenameColumn(
name: "Surface",
schema: "Content",
table: "Colors",
newName: "Menu");
migrationBuilder.RenameColumn(
name: "Secondary",
schema: "Content",
table: "Colors",
newName: "BannerTop");
migrationBuilder.RenameColumn(
name: "Primary",
schema: "Content",
table: "Colors",
newName: "BannerBottom");
migrationBuilder.RenameColumn(
name: "OnSurface",
schema: "Content",
table: "Colors",
newName: "Accent");
}
}
}

View File

@@ -0,0 +1,330 @@
// <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.Migrations
{
[DbContext(typeof(ContentDbContext))]
[Migration("20240919051151_NoMoreOptionalColors")]
partial class NoMoreOptionalColors
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("Content")
.HasAnnotation("ProductVersion", "8.0.4")
.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>("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.HasKey("Id");
b.ToTable("Creators", "Content");
});
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Subscription", b =>
{
b.Property<Guid>("CreatedBy")
.HasColumnType("uuid");
b.Property<Guid>("CreatorId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("CreatedBy", "CreatorId");
b.HasIndex("CreatorId");
b.ToTable("Subscriptions", "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("ContentReactions", "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.About", "About", b1 =>
{
b1.Property<Guid>("CreatorId")
.HasColumnType("uuid");
b1.Property<string>("Description")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b1.Property<string>("Title")
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b1.HasKey("CreatorId");
b1.ToTable("Creators", "Content");
b1.WithOwner()
.HasForeignKey("CreatorId");
});
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("About")
.IsRequired();
b.Navigation("Colors")
.IsRequired();
b.Navigation("Images")
.IsRequired();
b.Navigation("Socials")
.IsRequired();
});
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Subscription", b =>
{
b.HasOne("Hutopy.Web.Features.Contents.Data.Creator", "Creator")
.WithMany()
.HasForeignKey("CreatorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Creator");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,258 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Hutopy.Web.Features.Contents.Migrations
{
/// <inheritdoc />
public partial class NoMoreOptionalColors : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Surface",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "character varying(9)",
oldMaxLength: 9,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Secondary",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "character varying(9)",
oldMaxLength: 9,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Primary",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "character varying(9)",
oldMaxLength: 9,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "OnSurface",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "character varying(9)",
oldMaxLength: 9,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "OnSecondary",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "character varying(9)",
oldMaxLength: 9,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "OnPrimary",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "character varying(9)",
oldMaxLength: 9,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "OnError",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "character varying(9)",
oldMaxLength: 9,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "OnBackground",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "character varying(9)",
oldMaxLength: 9,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Error",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "character varying(9)",
oldMaxLength: 9,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Background",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "character varying(9)",
oldMaxLength: 9,
oldNullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Surface",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(9)",
oldMaxLength: 9);
migrationBuilder.AlterColumn<string>(
name: "Secondary",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(9)",
oldMaxLength: 9);
migrationBuilder.AlterColumn<string>(
name: "Primary",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(9)",
oldMaxLength: 9);
migrationBuilder.AlterColumn<string>(
name: "OnSurface",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(9)",
oldMaxLength: 9);
migrationBuilder.AlterColumn<string>(
name: "OnSecondary",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(9)",
oldMaxLength: 9);
migrationBuilder.AlterColumn<string>(
name: "OnPrimary",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(9)",
oldMaxLength: 9);
migrationBuilder.AlterColumn<string>(
name: "OnError",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(9)",
oldMaxLength: 9);
migrationBuilder.AlterColumn<string>(
name: "OnBackground",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(9)",
oldMaxLength: 9);
migrationBuilder.AlterColumn<string>(
name: "Error",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(9)",
oldMaxLength: 9);
migrationBuilder.AlterColumn<string>(
name: "Background",
schema: "Content",
table: "Colors",
type: "character varying(9)",
maxLength: 9,
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(9)",
oldMaxLength: 9);
}
}
}

View File

@@ -0,0 +1,310 @@
// <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.Migrations
{
[DbContext(typeof(ContentDbContext))]
[Migration("20240922064815_RemovesAboutAddsTitle")]
partial class RemovesAboutAddsTitle
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("Content")
.HasAnnotation("ProductVersion", "8.0.4")
.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>("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.Subscription", b =>
{
b.Property<Guid>("CreatedBy")
.HasColumnType("uuid");
b.Property<Guid>("CreatorId")
.HasColumnType("uuid");
b.Property<DateTimeOffset>("CreatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("CreatedBy", "CreatorId");
b.HasIndex("CreatorId");
b.ToTable("Subscriptions", "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("ContentReactions", "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();
});
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Subscription", b =>
{
b.HasOne("Hutopy.Web.Features.Contents.Data.Creator", "Creator")
.WithMany()
.HasForeignKey("CreatorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Creator");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,43 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Hutopy.Web.Features.Contents.Migrations
{
/// <inheritdoc />
public partial class RemovesAboutAddsTitle : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "About_Description",
schema: "Content",
table: "Creators");
migrationBuilder.RenameColumn(
name: "About_Title",
schema: "Content",
table: "Creators",
newName: "Title");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "Title",
schema: "Content",
table: "Creators",
newName: "About_Title");
migrationBuilder.AddColumn<string>(
name: "About_Description",
schema: "Content",
table: "Creators",
type: "character varying(2048)",
maxLength: 2048,
nullable: true);
}
}
}

View File

@@ -80,6 +80,10 @@ namespace Hutopy.Web.Features.Contents.Migrations
.HasMaxLength(255) .HasMaxLength(255)
.HasColumnType("character varying(255)"); .HasColumnType("character varying(255)");
b.Property<string>("Title")
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b.HasKey("Id"); b.HasKey("Id");
b.ToTable("Creators", "Content"); b.ToTable("Creators", "Content");
@@ -148,45 +152,58 @@ namespace Hutopy.Web.Features.Contents.Migrations
modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b => modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b =>
{ {
b.OwnsOne("Hutopy.Web.Features.Contents.Data.About", "About", b1 =>
{
b1.Property<Guid>("CreatorId")
.HasColumnType("uuid");
b1.Property<string>("Description")
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b1.Property<string>("Title")
.HasMaxLength(255)
.HasColumnType("character varying(255)");
b1.HasKey("CreatorId");
b1.ToTable("Creators", "Content");
b1.WithOwner()
.HasForeignKey("CreatorId");
});
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Colors", "Colors", b1 => b.OwnsOne("Hutopy.Web.Features.Contents.Data.Colors", "Colors", b1 =>
{ {
b1.Property<Guid>("CreatorId") b1.Property<Guid>("CreatorId")
.HasColumnType("uuid"); .HasColumnType("uuid");
b1.Property<string>("Accent") b1.Property<string>("Background")
.IsRequired()
.HasMaxLength(9) .HasMaxLength(9)
.HasColumnType("character varying(9)"); .HasColumnType("character varying(9)");
b1.Property<string>("BannerBottom") b1.Property<string>("Error")
.IsRequired()
.HasMaxLength(9) .HasMaxLength(9)
.HasColumnType("character varying(9)"); .HasColumnType("character varying(9)");
b1.Property<string>("BannerTop") b1.Property<string>("OnBackground")
.IsRequired()
.HasMaxLength(9) .HasMaxLength(9)
.HasColumnType("character varying(9)"); .HasColumnType("character varying(9)");
b1.Property<string>("Menu") 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) .HasMaxLength(9)
.HasColumnType("character varying(9)"); .HasColumnType("character varying(9)");
@@ -264,9 +281,6 @@ namespace Hutopy.Web.Features.Contents.Migrations
.HasForeignKey("CreatorId"); .HasForeignKey("CreatorId");
}); });
b.Navigation("About")
.IsRequired();
b.Navigation("Colors") b.Navigation("Colors")
.IsRequired(); .IsRequired();

View File

@@ -49,7 +49,10 @@ internal class TestDataSeeder(
creator.Id = creatorUser.Id; creator.Id = creatorUser.Id;
creator.CreatedBy = creator.Id; creator.CreatedBy = creator.Id;
await contentContext.Subscriptions.AddAsync(new() { CreatedBy = userA.Id, CreatorId = creator.Id }); await contentContext.Subscriptions.AddAsync(new Subscription
{
CreatedBy = userA.Id, CreatorId = creator.Id
});
await contentContext.Creators.AddAsync(creator); await contentContext.Creators.AddAsync(creator);
var contents = GenerateContent(creator, 10); var contents = GenerateContent(creator, 10);
@@ -57,7 +60,9 @@ internal class TestDataSeeder(
{ {
var messages = GenerateMessages(content, 10); var messages = GenerateMessages(content, 10);
var parentMessages = messages.Where((_, index) => index % 2 == 0).ToList(); var parentMessages = messages.Where((
_,
index) => index % 2 == 0).ToList();
foreach (var parentMessage in parentMessages) foreach (var parentMessage in parentMessages)
{ {
_ = GenerateReplies(content, parentMessage, 10); _ = GenerateReplies(content, parentMessage, 10);
@@ -68,7 +73,9 @@ internal class TestDataSeeder(
} }
} }
private List<Content> GenerateContent(Creator creator, int contentCount) private List<Content> GenerateContent(
Creator creator,
int contentCount)
{ {
var currentDate = DateTimeOffset.UtcNow; var currentDate = DateTimeOffset.UtcNow;
@@ -97,7 +104,9 @@ internal class TestDataSeeder(
return contents; return contents;
} }
private List<Message> GenerateMessages(Content content, int messageCount) private List<Message> GenerateMessages(
Content content,
int messageCount)
{ {
var currentDate = content.CreatedAt; var currentDate = content.CreatedAt;
var messages = new List<Message>(); var messages = new List<Message>();
@@ -126,7 +135,10 @@ internal class TestDataSeeder(
return messages; return messages;
} }
private List<Message> GenerateReplies(Content content, Message parent, int replyCount) private List<Message> GenerateReplies(
Content content,
Message parent,
int replyCount)
{ {
var currentDate = parent.CreatedAt; var currentDate = parent.CreatedAt;
var replies = new List<Message>(); var replies = new List<Message>();
@@ -157,7 +169,10 @@ internal class TestDataSeeder(
return replies; return replies;
} }
private async Task<ApplicationUser> CreateUserAsync(string name, string? portraitUrl, params string[] roles) private async Task<ApplicationUser> CreateUserAsync(
string name,
string? portraitUrl,
params string[] roles)
{ {
var user = new ApplicationUser var user = new ApplicationUser
{ {
@@ -184,23 +199,28 @@ internal class TestDataSeeder(
private readonly static Creator HutopyCreator = new() private readonly static Creator HutopyCreator = new()
{ {
Name = "hutopy", Name = "hutopy",
About = new()
{
Title = "Page officielle", Title = "Page officielle",
Description = "Site officiel pour Hutopy. Venez-nous-y retrouver avec tous vos fans!", Colors = new Colors
},
Colors = new()
{ {
BannerTop = "#A30E79", BannerBottom = "#6B0065", Accent = "#23393B", Menu = "#53B93B", Primary = "#A30E79",
Secondary = "#6B0065",
Background = "#53B93B",
Surface = "#23393B",
Error = "#B00020",
OnPrimary = "#ffffff",
OnSecondary = "#000000",
OnBackground = "#000000",
OnSurface = "#000000",
OnError = "#ffffff",
}, },
Socials = Socials =
new() new Socials
{ {
XUrl = "https://twitter.com/Hutopyinc", XUrl = "https://twitter.com/Hutopyinc",
FacebookUrl = "https://www.facebook.com/Hutopy", FacebookUrl = "https://www.facebook.com/Hutopy",
InstagramUrl = "https://www.instagram.com/hutopy.inc/" InstagramUrl = "https://www.instagram.com/hutopy.inc/"
}, },
Images = new() Images = new Images
{ {
Banner = "/images/usersmedia/HutopyProfile/banners/banner01.png", Banner = "/images/usersmedia/HutopyProfile/banners/banner01.png",
Logo = "/images/usersmedia/HutopyProfile/profilepictures/profileHutopyProfile01.png" Logo = "/images/usersmedia/HutopyProfile/profilepictures/profileHutopyProfile01.png"
@@ -210,15 +230,21 @@ internal class TestDataSeeder(
private readonly static Creator ArpsCreator = new() private readonly static Creator ArpsCreator = new()
{ {
Name = "arps", Name = "arps",
About = Title = "Créateur de contenu",
new() Colors = new Colors
{ {
Title = "Page officielle", Primary = "#A30E79",
Description = "Site officiel pour Arps. Venez-nous-y retrouver avec tous vos fans!", Secondary = "#6B0065",
Background = "#53B93B",
Surface = "#23393B",
Error = "#B00020",
OnPrimary = "#ffffff",
OnSecondary = "#000000",
OnBackground = "#000000",
OnSurface = "#000000",
OnError = "#ffffff",
}, },
Colors = Socials = new Socials
new() { BannerTop = "#231F20", BannerBottom = "#231F20", Accent = "#272526", Menu = "#FFFFFF" },
Socials = new()
{ {
FacebookUrl = "https://www.facebook.com/arps.company", FacebookUrl = "https://www.facebook.com/arps.company",
InstagramUrl = "https://www.instagram.com/arps.co/", InstagramUrl = "https://www.instagram.com/arps.co/",
@@ -227,7 +253,7 @@ internal class TestDataSeeder(
LinkedInUrl = "https://www.linkedin.com/in/mickael-simard-96079a90/", LinkedInUrl = "https://www.linkedin.com/in/mickael-simard-96079a90/",
WebsiteUrl = "https://www.arps.ca/" WebsiteUrl = "https://www.arps.ca/"
}, },
Images = new() Images = new Images
{ {
Banner = "/images/usersmedia/ARPS/banners/bannerARPS01.png", Banner = "/images/usersmedia/ARPS/banners/bannerARPS01.png",
Logo = "/images/usersmedia/ARPS/profilepictures/profileARPS.png" Logo = "/images/usersmedia/ARPS/profilepictures/profileARPS.png"
@@ -237,22 +263,27 @@ internal class TestDataSeeder(
private readonly static Creator ChloeBeaugrandCreator = new() private readonly static Creator ChloeBeaugrandCreator = new()
{ {
Name = "chloebeaugrand", Name = "chloebeaugrand",
About = new()
{
Title = "Page officielle", Title = "Page officielle",
Description = "𝐿𝑎 𝑐𝑟𝑒́𝑎𝑡𝑖𝑣𝑖𝑡𝑒́ 𝑐𝑒𝑠𝑡 𝑙𝑖𝑛𝑡𝑒𝑙𝑙𝑖𝑔𝑒𝑛𝑐𝑒 𝑞𝑢𝑖 𝑠’𝑎𝑚𝑢𝑠𝑒!", Colors = new Colors
},
Colors = new()
{ {
BannerTop = "#231F20", BannerBottom = "#272526", Accent = "#231F20", Menu = "#231F20", Primary = "#A30E79",
Secondary = "#6B0065",
Background = "#53B93B",
Surface = "#23393B",
Error = "#B00020",
OnPrimary = "#ffffff",
OnSecondary = "#000000",
OnBackground = "#000000",
OnSurface = "#000000",
OnError = "#ffffff",
}, },
Socials = Socials =
new() new Socials
{ {
FacebookUrl = "https://www.facebook.com/chloegestionmedias", FacebookUrl = "https://www.facebook.com/chloegestionmedias",
InstagramUrl = "https://www.instagram.com/chloe.photo_gms", InstagramUrl = "https://www.instagram.com/chloe.photo_gms",
}, },
Images = new() Images = new Images
{ {
Banner = "/images/usersmedia/chloebeaugrand/banners/bannerChloeBeaugrand01.png", Banner = "/images/usersmedia/chloebeaugrand/banners/bannerChloeBeaugrand01.png",
Logo = "/images/usersmedia/chloebeaugrand/profilepictures/profileChloeBeaugrand01.png" Logo = "/images/usersmedia/chloebeaugrand/profilepictures/profileChloeBeaugrand01.png"
@@ -262,24 +293,28 @@ internal class TestDataSeeder(
private readonly static Creator GuillaumeMCreator = new() private readonly static Creator GuillaumeMCreator = new()
{ {
Name = "guillaumem", Name = "guillaumem",
About = new()
{
Title = "Page officielle", Title = "Page officielle",
Description = Colors = new Colors
"Mettre en lumière le côté humain des entrepreneurs. Chaque service, chaque produit est porteur dune histoire, dune passion, dune vision unique. Mon objectif est de faire rayonner cette unicité, de créer des connexions authentiques entre ces entrepreneurs et leurs clients potentiels. Parce que derrière chaque entreprise, il y a des personnes inspirantes qui méritent dêtre entendues et comprises. Et toi, quel est ton objectif pour cette année?",
},
Colors = new()
{ {
BannerTop = "#0BAAB2", BannerBottom = "#006D77", Accent = "#CC6F91", Menu = "#CC6F91", Primary = "#A30E79",
Secondary = "#6B0065",
Background = "#53B93B",
Surface = "#23393B",
Error = "#B00020",
OnPrimary = "#ffffff",
OnSecondary = "#000000",
OnBackground = "#000000",
OnSurface = "#000000",
OnError = "#ffffff",
}, },
Socials = Socials =
new() new Socials
{ {
FacebookUrl = "https://www.facebook.com/GuillaumeMousseau222", FacebookUrl = "https://www.facebook.com/GuillaumeMousseau222",
InstagramUrl = "https://www.instagram.com/guillaumeaime/", InstagramUrl = "https://www.instagram.com/guillaumeaime/",
TikTokUrl = "https://www.tiktok.com/@guillaumeaime" TikTokUrl = "https://www.tiktok.com/@guillaumeaime"
}, },
Images = new() Images = new Images
{ {
Banner = "/images/usersmedia/guillaumeMousseau/banners/bannerGuillaumeMousseau01.png", Banner = "/images/usersmedia/guillaumeMousseau/banners/bannerGuillaumeMousseau01.png",
Logo = Logo =
@@ -290,24 +325,28 @@ internal class TestDataSeeder(
private readonly static Creator LeffetCreator = new() private readonly static Creator LeffetCreator = new()
{ {
Name = "leffet", Name = "leffet",
About = new()
{
Title = "Page officielle", Title = "Page officielle",
Description = Colors = new Colors
"Mettre en lumière le côté humain des entrepreneurs. Chaque service, chaque produit est porteur dune histoire, dune passion, dune vision unique. Mon objectif est de faire rayonner cette unicité, de créer des connexions authentiques entre ces entrepreneurs et leurs clients potentiels. Parce que derrière chaque entreprise, il y a des personnes inspirantes qui méritent dêtre entendues et comprises. Et toi, quel est ton objectif pour cette année?",
},
Colors = new()
{ {
BannerTop = "#CC6F91", BannerBottom = "#FBC702", Accent = "#FBC702", Menu = "#FBC702", Primary = "#A30E79",
Secondary = "#6B0065",
Background = "#53B93B",
Surface = "#23393B",
Error = "#B00020",
OnPrimary = "#ffffff",
OnSecondary = "#000000",
OnBackground = "#000000",
OnSurface = "#000000",
OnError = "#ffffff",
}, },
Socials = Socials =
new() new Socials
{ {
FacebookUrl = "https://www.facebook.com/Hutopy", FacebookUrl = "https://www.facebook.com/Hutopy",
InstagramUrl = "https://www.instagram.com/guillaumeaime/", InstagramUrl = "https://www.instagram.com/guillaumeaime/",
WebsiteUrl = "https://fondationleffet.ca/" WebsiteUrl = "https://fondationleffet.ca/"
}, },
Images = new() Images = new Images
{ {
Banner = "/images/usersmedia/leffet/banners/banner02.png", Banner = "/images/usersmedia/leffet/banners/banner02.png",
Logo = "/images/usersmedia/leffet/profilepictures/leffetProfile01.png" Logo = "/images/usersmedia/leffet/profilepictures/leffetProfile01.png"
@@ -317,23 +356,27 @@ internal class TestDataSeeder(
private readonly static Creator MathieuCaron = new() private readonly static Creator MathieuCaron = new()
{ {
Name = "mathieucaron", Name = "mathieucaron",
About = new()
{
Title = "Page officielle", Title = "Page officielle",
Description = Colors = new Colors
"Mettre en lumière le côté humain des entrepreneurs. Chaque service, chaque produit est porteur dune histoire, dune passion, dune vision unique. Mon objectif est de faire rayonner cette unicité, de créer des connexions authentiques entre ces entrepreneurs et leurs clients potentiels. Parce que derrière chaque entreprise, il y a des personnes inspirantes qui méritent dêtre entendues et comprises. Et toi, quel est ton objectif pour cette année?",
},
Colors = new()
{ {
BannerTop = "#101B49", BannerBottom = "#698FE7", Accent = "#1D1D1B", Menu = "#1D1D1B", Primary = "#A30E79",
Secondary = "#6B0065",
Background = "#53B93B",
Surface = "#23393B",
Error = "#B00020",
OnPrimary = "#ffffff",
OnSecondary = "#000000",
OnBackground = "#000000",
OnSurface = "#000000",
OnError = "#ffffff",
}, },
Socials = Socials =
new() new Socials
{ {
FacebookUrl = "https://www.facebook.com/MathieuCaronPro/", FacebookUrl = "https://www.facebook.com/MathieuCaronPro/",
YoutubeUrl = "https://www.youtube.com/@lesinterviewsatypiquesdema4692", YoutubeUrl = "https://www.youtube.com/@lesinterviewsatypiquesdema4692",
}, },
Images = new() Images = new Images
{ {
Banner = "/images/usersmedia/mathieuCaron/banners/bannerMathieuCaron01.png", Banner = "/images/usersmedia/mathieuCaron/banners/bannerMathieuCaron01.png",
Logo = "/images/usersmedia/mathieuCaron/profilepictures/profileMathieuCaron01.png" Logo = "/images/usersmedia/mathieuCaron/profilepictures/profileMathieuCaron01.png"

View File

@@ -1,5 +1,5 @@
# For more info on HTTP files go to https://aka.ms/vs/httpfile # For more info on HTTP files go to https://aka.ms/vs/httpfile
@Email=userA@test @Email=hutopy@test
@Password=Test123# @Password=Test123#
@auth_token=<Your Token> @auth_token=<Your Token>
@@ -23,7 +23,9 @@ Content-Type: application/json
"password": "{{Password}}" "password": "{{Password}}"
} }
> {% client.global.set("auth_token", response.body.accessToken); %} > {%
client.global.set("auth_token", response.body.accessToken);
%}
### ###
@@ -64,3 +66,23 @@ Authorization: Bearer {{auth_token}}
### ###
# GET /api/contents/creator/{CreatorId} # GET /api/contents/creator/{CreatorId}
GET {{base_url}}/api/contents/creator/8590ba59-58a7-4466-bb50-08dcb5e47c6d/ GET {{base_url}}/api/contents/creator/8590ba59-58a7-4466-bb50-08dcb5e47c6d/
###
# GET /api/creators/{CreatorId}/colors
POST {{base_url}}/api/creators/8590ba59-58a7-4466-bb50-08dcb5e47c6d/colors/
Authorization: Bearer {{auth_token}}
Content-Type: application/json
{
"Primary" : "#fffff0",
"Secondary" : "#fffff0",
"Background" : "#fffff0",
"Surface" : "#fffff0",
"Error" : "#fffff0",
"OnPrimary" : "#fffff0",
"OnSecondary" : "#fffff0",
"OnBackground" : "#fffff0",
"OnSurface" : "#fffff0",
"OnError" : "#fffff0"
}