Renames ProfileColors to Colors
This commit is contained in:
@@ -49,8 +49,8 @@ public class ContentDbContext(
|
||||
|
||||
modelBuilder
|
||||
.Entity<Creator>()
|
||||
.OwnsOne<ProfileColors>(x => x.ProfileColors)
|
||||
.ToTable(nameof(ProfileColors));
|
||||
.OwnsOne<Colors>(x => x.Colors)
|
||||
.ToTable(nameof(Colors));
|
||||
|
||||
modelBuilder
|
||||
.Entity<Creator>()
|
||||
|
||||
@@ -11,7 +11,7 @@ public class Creator
|
||||
|
||||
public About About { get; set; } = new();
|
||||
public Socials Socials { get; set; } = new();
|
||||
public ProfileColors ProfileColors { get; set; } = new();
|
||||
public Colors Colors { get; set; } = new();
|
||||
public Images Images { get; set; } = new();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public class About
|
||||
[MaxLength(2048)] public string? Description { get; set; }
|
||||
}
|
||||
|
||||
public class ProfileColors
|
||||
public class Colors
|
||||
{
|
||||
[MaxLength(9)] public string? BannerTop { get; set; }
|
||||
[MaxLength(9)] public string? BannerBottom { get; set; }
|
||||
|
||||
@@ -53,15 +53,15 @@ public class ChangeColorsHandler(
|
||||
{
|
||||
var creator = await context
|
||||
.Creators
|
||||
.Include(c => c.ProfileColors)
|
||||
.Include(c => c.Colors)
|
||||
.SingleAsync(
|
||||
c => c.Id == request.CreatorId,
|
||||
cancellationToken: ct);
|
||||
|
||||
creator.ProfileColors.BannerTop = request.BannerTop;
|
||||
creator.ProfileColors.BannerBottom = request.BannerBottom;
|
||||
creator.ProfileColors.Accent = request.Accent;
|
||||
creator.ProfileColors.Menu = request.Menu;
|
||||
creator.Colors.BannerTop = request.BannerTop;
|
||||
creator.Colors.BannerBottom = request.BannerBottom;
|
||||
creator.Colors.Accent = request.Accent;
|
||||
creator.Colors.Menu = request.Menu;
|
||||
|
||||
await context.SaveChangesAsync(ct);
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ public class ChangeSocialsHandler(
|
||||
{
|
||||
var creator = await context
|
||||
.Creators
|
||||
.Include(c => c.ProfileColors)
|
||||
.Include(c => c.Socials)
|
||||
.SingleAsync(
|
||||
c => c.Id == request.CreatorId,
|
||||
cancellationToken: ct);
|
||||
|
||||
@@ -62,7 +62,7 @@ public class GetCreatorByAliasHandler(
|
||||
Name = creator.Name,
|
||||
About = creator.About,
|
||||
Socials = creator.Socials,
|
||||
ProfileColors = creator.ProfileColors,
|
||||
Colors = creator.Colors,
|
||||
Images = creator.Images,
|
||||
SubscriberCount = subscriberCount,
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ public class CreatorModel
|
||||
public string Name { get; set; }
|
||||
public About About { get; set; }
|
||||
public Socials Socials { get; set; }
|
||||
public ProfileColors ProfileColors { get; set; }
|
||||
public Colors Colors { get; set; }
|
||||
public Images Images { get; set; }
|
||||
public int SubscriberCount { get; set; }
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace Hutopy.Web.Features.Contents.Migrations
|
||||
{
|
||||
[DbContext(typeof(ContentDbContext))]
|
||||
[Migration("20240806050040_Initial")]
|
||||
[Migration("20240806065219_Initial")]
|
||||
partial class Initial
|
||||
{
|
||||
/// <inheritdoc />
|
||||
@@ -134,28 +134,7 @@ namespace Hutopy.Web.Features.Contents.Migrations
|
||||
.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.ProfileColors", "ProfileColors", b1 =>
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Colors", "Colors", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
@@ -178,7 +157,28 @@ namespace Hutopy.Web.Features.Contents.Migrations
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("ProfileColors", "Content");
|
||||
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");
|
||||
@@ -232,10 +232,10 @@ namespace Hutopy.Web.Features.Contents.Migrations
|
||||
b.Navigation("About")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Images")
|
||||
b.Navigation("Colors")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ProfileColors")
|
||||
b.Navigation("Images")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Socials")
|
||||
@@ -31,6 +31,29 @@ namespace Hutopy.Web.Features.Contents.Migrations
|
||||
table.PrimaryKey("PK_Creators", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Colors",
|
||||
schema: "Content",
|
||||
columns: table => new
|
||||
{
|
||||
CreatorId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
BannerTop = table.Column<string>(type: "character varying(9)", maxLength: 9, nullable: true),
|
||||
BannerBottom = table.Column<string>(type: "character varying(9)", maxLength: 9, nullable: true),
|
||||
Accent = table.Column<string>(type: "character varying(9)", maxLength: 9, nullable: true),
|
||||
Menu = table.Column<string>(type: "character varying(9)", maxLength: 9, nullable: true)
|
||||
},
|
||||
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",
|
||||
@@ -76,29 +99,6 @@ namespace Hutopy.Web.Features.Contents.Migrations
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ProfileColors",
|
||||
schema: "Content",
|
||||
columns: table => new
|
||||
{
|
||||
CreatorId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
BannerTop = table.Column<string>(type: "character varying(9)", maxLength: 9, nullable: true),
|
||||
BannerBottom = table.Column<string>(type: "character varying(9)", maxLength: 9, nullable: true),
|
||||
Accent = table.Column<string>(type: "character varying(9)", maxLength: 9, nullable: true),
|
||||
Menu = table.Column<string>(type: "character varying(9)", maxLength: 9, nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ProfileColors", x => x.CreatorId);
|
||||
table.ForeignKey(
|
||||
name: "FK_ProfileColors_Creators_CreatorId",
|
||||
column: x => x.CreatorId,
|
||||
principalSchema: "Content",
|
||||
principalTable: "Creators",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Socials",
|
||||
schema: "Content",
|
||||
@@ -163,6 +163,10 @@ namespace Hutopy.Web.Features.Contents.Migrations
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Colors",
|
||||
schema: "Content");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Contents",
|
||||
schema: "Content");
|
||||
@@ -171,10 +175,6 @@ namespace Hutopy.Web.Features.Contents.Migrations
|
||||
name: "Images",
|
||||
schema: "Content");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ProfileColors",
|
||||
schema: "Content");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Socials",
|
||||
schema: "Content");
|
||||
@@ -131,28 +131,7 @@ namespace Hutopy.Web.Features.Contents.Migrations
|
||||
.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.ProfileColors", "ProfileColors", b1 =>
|
||||
b.OwnsOne("Hutopy.Web.Features.Contents.Data.Colors", "Colors", b1 =>
|
||||
{
|
||||
b1.Property<Guid>("CreatorId")
|
||||
.HasColumnType("uuid");
|
||||
@@ -175,7 +154,28 @@ namespace Hutopy.Web.Features.Contents.Migrations
|
||||
|
||||
b1.HasKey("CreatorId");
|
||||
|
||||
b1.ToTable("ProfileColors", "Content");
|
||||
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");
|
||||
@@ -229,10 +229,10 @@ namespace Hutopy.Web.Features.Contents.Migrations
|
||||
b.Navigation("About")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Images")
|
||||
b.Navigation("Colors")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("ProfileColors")
|
||||
b.Navigation("Images")
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Socials")
|
||||
|
||||
Reference in New Issue
Block a user