diff --git a/src/Web/Features/Contents/Data/ContentDbContext.cs b/src/Web/Features/Contents/Data/ContentDbContext.cs index e01321b..29860e4 100644 --- a/src/Web/Features/Contents/Data/ContentDbContext.cs +++ b/src/Web/Features/Contents/Data/ContentDbContext.cs @@ -21,13 +21,23 @@ public class ContentDbContext( .Property(c => c.CreatedAt) .ValueGeneratedOnAdd() .HasDefaultValueSql("CURRENT_TIMESTAMP"); - + modelBuilder .Entity() .HasOne(c => c.Creator) .WithMany() .HasForeignKey(c => c.CreatedBy); + modelBuilder + .Entity() + .HasOne(c => c.Creator) + .WithMany() + .HasForeignKey(c => c.CreatorId); + + modelBuilder + .Entity() + .HasKey(s => new { s.CreatedBy, s.CreatorId }); + modelBuilder .Entity() .OwnsOne(x => x.About); diff --git a/src/Web/Features/Contents/Data/Subscription.cs b/src/Web/Features/Contents/Data/Subscription.cs index d3a0cbd..4875fd9 100644 --- a/src/Web/Features/Contents/Data/Subscription.cs +++ b/src/Web/Features/Contents/Data/Subscription.cs @@ -2,8 +2,8 @@ public class Subscription { - public Guid Id { get; init; } - public Guid CreatorId { get; init; } public Guid CreatedBy { get; init; } public DateTimeOffset CreatedAt { get; init; } + public Guid CreatorId { get; init; } + public Creator? Creator { get; set; } } diff --git a/src/Web/Features/Contents/Handlers/GetSubscriptions.cs b/src/Web/Features/Contents/Handlers/GetSubscriptions.cs index d175102..1f5690c 100644 --- a/src/Web/Features/Contents/Handlers/GetSubscriptions.cs +++ b/src/Web/Features/Contents/Handlers/GetSubscriptions.cs @@ -1,13 +1,14 @@ using FastEndpoints; using Hutopy.Web.Common; using Hutopy.Web.Features.Contents.Data; +using Hutopy.Web.Features.Contents.Handlers.Models; using Microsoft.EntityFrameworkCore; namespace Hutopy.Web.Features.Contents.Handlers; public class GetSubscriptionsHandler( ContentDbContext context) - : EndpointWithoutRequest + : EndpointWithoutRequest> { public override void Configure() { @@ -20,12 +21,15 @@ public class GetSubscriptionsHandler( { var userId = HttpContext.User.GetUserId(); - await context + var subscriptions = await context .Subscriptions .Where(s => s.CreatedBy == userId) - .Include(s => s.Creator) + .Select(s => new SubscriptionModel( + s.CreatorId, + s.Creator!.Name, + s.Creator.StoredDataUrls.ProfilePictureUrl)) .ToListAsync(cancellationToken: ct); - await SendOkAsync(ct); + await SendOkAsync(subscriptions, ct); } } diff --git a/src/Web/Features/Contents/Handlers/Models/SubscriptionModel.cs b/src/Web/Features/Contents/Handlers/Models/SubscriptionModel.cs new file mode 100644 index 0000000..7c3df21 --- /dev/null +++ b/src/Web/Features/Contents/Handlers/Models/SubscriptionModel.cs @@ -0,0 +1,6 @@ +namespace Hutopy.Web.Features.Contents.Handlers.Models; + +public record SubscriptionModel( + Guid CreatorId, + string CreatorName, + string? CreatorPortraitUrl); diff --git a/src/Web/Features/Contents/Handlers/SubscribeToCreator.cs b/src/Web/Features/Contents/Handlers/SubscribeToCreator.cs new file mode 100644 index 0000000..eb20946 --- /dev/null +++ b/src/Web/Features/Contents/Handlers/SubscribeToCreator.cs @@ -0,0 +1,54 @@ +using FastEndpoints; +using Hutopy.Web.Common; +using Hutopy.Web.Features.Contents.Data; +using Hutopy.Web.Features.Contents.Handlers.Models; +using Microsoft.EntityFrameworkCore; + +namespace Hutopy.Web.Features.Contents.Handlers; + +public sealed class SubscribeToCreatorRequest +{ + public Guid CreatorId { get; set; } +} + +public sealed class SubscribeToCreatorHandler( + ContentDbContext context) + : Endpoint +{ + public override void Configure() + { + Post("/api/creators/{CreatorId}/subscribe"); + Options((o => o.WithTags("Creators"))); + Description(x => x.Accepts("*/*")); + } + + public override async Task HandleAsync( + SubscribeToCreatorRequest req, + CancellationToken ct) + { + await context.Subscriptions.AddAsync( + new() { CreatedBy = HttpContext.User.GetUserId(), CreatorId = req.CreatorId }, + ct); + + await context.SaveChangesAsync(ct); + + var creator = await context + .Creators + .Where(c => c.Id == req.CreatorId) + .Select(c => new SubscriptionModel( + req.CreatorId, + c.Name, + c.StoredDataUrls.ProfilePictureUrl + )) + .FirstOrDefaultAsync(cancellationToken: ct); + + if (creator is null) + { + await SendNotFoundAsync(ct); + } + else + { + await SendOkAsync(creator, ct); + } + } +} diff --git a/src/Web/Features/Contents/Handlers/SubscripbeFromCreator.cs b/src/Web/Features/Contents/Handlers/SubscripbeFromCreator.cs deleted file mode 100644 index 5c8787c..0000000 --- a/src/Web/Features/Contents/Handlers/SubscripbeFromCreator.cs +++ /dev/null @@ -1,21 +0,0 @@ -using FastEndpoints; - -namespace Hutopy.Web.Features.Contents.Handlers; - -public record UnsubscribeFromCreatorRequest( - Guid CreatorId); - -public class UnsubscribeFromCreatorHandler - : Endpoint -{ public override void Configure() - { - Post(""); - } - - public override async Task HandleAsync( - UnsubscribeFromCreatorRequest req, - CancellationToken ct) - { - return base.HandleAsync(req, ct); - } -} diff --git a/src/Web/Features/Contents/Handlers/SubscripbeToCreator.cs b/src/Web/Features/Contents/Handlers/SubscripbeToCreator.cs deleted file mode 100644 index 7b4ce45..0000000 --- a/src/Web/Features/Contents/Handlers/SubscripbeToCreator.cs +++ /dev/null @@ -1,30 +0,0 @@ -using FastEndpoints; -using Hutopy.Web.Common; -using Hutopy.Web.Features.Contents.Data; - -namespace Hutopy.Web.Features.Contents.Handlers; - -public record SubscribeToCreatorRequest( - Guid CreatorId); - -public sealed class SubscribeToCreatorHandler( - ContentDbContext context) - : Endpoint -{ - public override void Configure() - { - Post("/api/creators/{CreatorId}/subscribe"); - Options((o => o.WithTags("Creators"))); - } - - public override async Task HandleAsync( - UnsubscribeFromCreatorRequest req, - CancellationToken ct) - { - await context.Subscriptions.AddAsync( - new() { CreatedBy = HttpContext.User.GetUserId(), CreatorId = req.CreatorId }, - ct); - - await SendOkAsync(ct); - } -} diff --git a/src/Web/Features/Contents/Handlers/UnsubscribeFromCreator.cs b/src/Web/Features/Contents/Handlers/UnsubscribeFromCreator.cs new file mode 100644 index 0000000..87c4855 --- /dev/null +++ b/src/Web/Features/Contents/Handlers/UnsubscribeFromCreator.cs @@ -0,0 +1,42 @@ +using FastEndpoints; +using Hutopy.Web.Common; +using Hutopy.Web.Features.Contents.Data; + +namespace Hutopy.Web.Features.Contents.Handlers; + +public sealed class UnsubscribeFromCreatorRequest +{ + public Guid CreatorId { get; set; } +} + +public class UnsubscribeFromCreatorHandler( + ContentDbContext context) + : Endpoint +{ + public override void Configure() + { + Post("/api/creators/{CreatorId}/unsubscribe"); + Options((o => o.WithTags("Creators"))); + Description(x => x.Accepts("*/*")); + } + + public override async Task HandleAsync( + UnsubscribeFromCreatorRequest req, + CancellationToken ct) + { + var subscription = new Subscription { CreatorId = req.CreatorId, CreatedBy = HttpContext.User.GetUserId() }; + + context.Subscriptions.Attach(subscription); + context.Subscriptions.Remove(subscription); + + try + { + await context.SaveChangesAsync(ct); + await SendOkAsync(ct); + } + catch (Exception) + { + await SendNotFoundAsync(ct); + } + } +} diff --git a/src/Web/Features/Contents/Migrations/20240802044656_Initial.cs b/src/Web/Features/Contents/Migrations/20240802044656_Initial.cs deleted file mode 100644 index 465ecbb..0000000 --- a/src/Web/Features/Contents/Migrations/20240802044656_Initial.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Hutopy.Web.Features.Contents.Migrations -{ - /// - public partial class Initial : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.EnsureSchema( - name: "Content"); - - migrationBuilder.CreateTable( - name: "Contents", - schema: "Content", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - CreatedBy = table.Column(type: "uuid", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), - Title = table.Column(type: "text", nullable: false), - Description = table.Column(type: "text", nullable: false), - Urls = table.Column(type: "text[]", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Contents", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Creators", - schema: "Content", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - CreatedBy = table.Column(type: "uuid", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - Name = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), - About_Title = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), - About_Description = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), - SocialNetworks_FacebookUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), - SocialNetworks_InstagramUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), - SocialNetworks_XUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), - SocialNetworks_LinkedInUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), - SocialNetworks_TikTokUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), - SocialNetworks_YoutubeUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), - SocialNetworks_RedditUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), - SocialNetworks_WebsiteUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), - ProfileColors_BannerTop = table.Column(type: "character varying(9)", maxLength: 9, nullable: true), - ProfileColors_BannerBottom = table.Column(type: "character varying(9)", maxLength: 9, nullable: true), - ProfileColors_Accent = table.Column(type: "character varying(9)", maxLength: 9, nullable: true), - ProfileColors_Menu = table.Column(type: "character varying(9)", maxLength: 9, nullable: true), - StoredDataUrls_BannerPictureUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), - StoredDataUrls_ProfilePictureUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Creators", x => x.Id); - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Contents", - schema: "Content"); - - migrationBuilder.DropTable( - name: "Creators", - schema: "Content"); - } - } -} diff --git a/src/Web/Features/Contents/Migrations/20240802044656_Initial.Designer.cs b/src/Web/Features/Contents/Migrations/20240804071117_Initial.Designer.cs similarity index 79% rename from src/Web/Features/Contents/Migrations/20240802044656_Initial.Designer.cs rename to src/Web/Features/Contents/Migrations/20240804071117_Initial.Designer.cs index f14eda2..2239cb6 100644 --- a/src/Web/Features/Contents/Migrations/20240802044656_Initial.Designer.cs +++ b/src/Web/Features/Contents/Migrations/20240804071117_Initial.Designer.cs @@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace Hutopy.Web.Features.Contents.Migrations { [DbContext(typeof(ContentDbContext))] - [Migration("20240802044656_Initial")] + [Migration("20240804071117_Initial")] partial class Initial { /// @@ -42,17 +42,21 @@ namespace Hutopy.Web.Features.Contents.Migrations b.Property("Description") .IsRequired() - .HasColumnType("text"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b.Property("Title") .IsRequired() - .HasColumnType("text"); + .HasMaxLength(128) + .HasColumnType("character varying(128)"); b.Property("Urls") .HasColumnType("text[]"); b.HasKey("Id"); + b.HasIndex("CreatedBy"); + b.ToTable("Contents", "Content"); }); @@ -78,6 +82,35 @@ namespace Hutopy.Web.Features.Contents.Migrations b.ToTable("Creators", "Content"); }); + modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Subscription", b => + { + b.Property("CreatedBy") + .HasColumnType("uuid"); + + b.Property("CreatorId") + .HasColumnType("uuid"); + + b.Property("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.Navigation("Creator"); + }); + modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b => { b.OwnsOne("Hutopy.Web.Features.Contents.Data.About", "About", b1 => @@ -124,7 +157,7 @@ namespace Hutopy.Web.Features.Contents.Migrations b1.HasKey("CreatorId"); - b1.ToTable("Creators", "Content"); + b1.ToTable("ProfileColors", "Content"); b1.WithOwner() .HasForeignKey("CreatorId"); @@ -169,7 +202,7 @@ namespace Hutopy.Web.Features.Contents.Migrations b1.HasKey("CreatorId"); - b1.ToTable("Creators", "Content"); + b1.ToTable("SocialNetworks", "Content"); b1.WithOwner() .HasForeignKey("CreatorId"); @@ -190,7 +223,7 @@ namespace Hutopy.Web.Features.Contents.Migrations b1.HasKey("CreatorId"); - b1.ToTable("Creators", "Content"); + b1.ToTable("StoredDataUrls", "Content"); b1.WithOwner() .HasForeignKey("CreatorId"); @@ -208,6 +241,17 @@ namespace Hutopy.Web.Features.Contents.Migrations b.Navigation("StoredDataUrls") .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 } } diff --git a/src/Web/Features/Contents/Migrations/20240804071117_Initial.cs b/src/Web/Features/Contents/Migrations/20240804071117_Initial.cs new file mode 100644 index 0000000..f4db5f5 --- /dev/null +++ b/src/Web/Features/Contents/Migrations/20240804071117_Initial.cs @@ -0,0 +1,191 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Hutopy.Web.Features.Contents.Migrations +{ + /// + public partial class Initial : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.EnsureSchema( + name: "Content"); + + migrationBuilder.CreateTable( + name: "Creators", + schema: "Content", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + CreatedBy = table.Column(type: "uuid", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + Name = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), + About_Title = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), + About_Description = table.Column(type: "character varying(255)", maxLength: 255, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Creators", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Contents", + schema: "Content", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + CreatedBy = table.Column(type: "uuid", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), + Title = table.Column(type: "character varying(128)", maxLength: 128, nullable: false), + Description = table.Column(type: "character varying(2048)", maxLength: 2048, nullable: false), + Urls = table.Column(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: "ProfileColors", + schema: "Content", + columns: table => new + { + CreatorId = table.Column(type: "uuid", nullable: false), + BannerTop = table.Column(type: "character varying(9)", maxLength: 9, nullable: true), + BannerBottom = table.Column(type: "character varying(9)", maxLength: 9, nullable: true), + Accent = table.Column(type: "character varying(9)", maxLength: 9, nullable: true), + Menu = table.Column(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: "SocialNetworks", + schema: "Content", + columns: table => new + { + CreatorId = table.Column(type: "uuid", nullable: false), + FacebookUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), + InstagramUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), + XUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), + LinkedInUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), + TikTokUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), + YoutubeUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), + RedditUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), + WebsiteUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_SocialNetworks", x => x.CreatorId); + table.ForeignKey( + name: "FK_SocialNetworks_Creators_CreatorId", + column: x => x.CreatorId, + principalSchema: "Content", + principalTable: "Creators", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "StoredDataUrls", + schema: "Content", + columns: table => new + { + CreatorId = table.Column(type: "uuid", nullable: false), + BannerPictureUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), + ProfilePictureUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_StoredDataUrls", x => x.CreatorId); + table.ForeignKey( + name: "FK_StoredDataUrls_Creators_CreatorId", + column: x => x.CreatorId, + principalSchema: "Content", + principalTable: "Creators", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Subscriptions", + schema: "Content", + columns: table => new + { + CreatedBy = table.Column(type: "uuid", nullable: false), + CreatorId = table.Column(type: "uuid", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Subscriptions", x => new { x.CreatedBy, x.CreatorId }); + table.ForeignKey( + name: "FK_Subscriptions_Creators_CreatorId", + column: x => x.CreatorId, + principalSchema: "Content", + principalTable: "Creators", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Contents_CreatedBy", + schema: "Content", + table: "Contents", + column: "CreatedBy"); + + migrationBuilder.CreateIndex( + name: "IX_Subscriptions_CreatorId", + schema: "Content", + table: "Subscriptions", + column: "CreatorId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Contents", + schema: "Content"); + + migrationBuilder.DropTable( + name: "ProfileColors", + schema: "Content"); + + migrationBuilder.DropTable( + name: "SocialNetworks", + schema: "Content"); + + migrationBuilder.DropTable( + name: "StoredDataUrls", + schema: "Content"); + + migrationBuilder.DropTable( + name: "Subscriptions", + schema: "Content"); + + migrationBuilder.DropTable( + name: "Creators", + schema: "Content"); + } + } +} diff --git a/src/Web/Features/Contents/Migrations/ContentDbContextModelSnapshot.cs b/src/Web/Features/Contents/Migrations/ContentDbContextModelSnapshot.cs index 920ea8b..cd39fe1 100644 --- a/src/Web/Features/Contents/Migrations/ContentDbContextModelSnapshot.cs +++ b/src/Web/Features/Contents/Migrations/ContentDbContextModelSnapshot.cs @@ -39,17 +39,21 @@ namespace Hutopy.Web.Features.Contents.Migrations b.Property("Description") .IsRequired() - .HasColumnType("text"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b.Property("Title") .IsRequired() - .HasColumnType("text"); + .HasMaxLength(128) + .HasColumnType("character varying(128)"); b.Property("Urls") .HasColumnType("text[]"); b.HasKey("Id"); + b.HasIndex("CreatedBy"); + b.ToTable("Contents", "Content"); }); @@ -75,6 +79,35 @@ namespace Hutopy.Web.Features.Contents.Migrations b.ToTable("Creators", "Content"); }); + modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Subscription", b => + { + b.Property("CreatedBy") + .HasColumnType("uuid"); + + b.Property("CreatorId") + .HasColumnType("uuid"); + + b.Property("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.Navigation("Creator"); + }); + modelBuilder.Entity("Hutopy.Web.Features.Contents.Data.Creator", b => { b.OwnsOne("Hutopy.Web.Features.Contents.Data.About", "About", b1 => @@ -121,7 +154,7 @@ namespace Hutopy.Web.Features.Contents.Migrations b1.HasKey("CreatorId"); - b1.ToTable("Creators", "Content"); + b1.ToTable("ProfileColors", "Content"); b1.WithOwner() .HasForeignKey("CreatorId"); @@ -166,7 +199,7 @@ namespace Hutopy.Web.Features.Contents.Migrations b1.HasKey("CreatorId"); - b1.ToTable("Creators", "Content"); + b1.ToTable("SocialNetworks", "Content"); b1.WithOwner() .HasForeignKey("CreatorId"); @@ -187,7 +220,7 @@ namespace Hutopy.Web.Features.Contents.Migrations b1.HasKey("CreatorId"); - b1.ToTable("Creators", "Content"); + b1.ToTable("StoredDataUrls", "Content"); b1.WithOwner() .HasForeignKey("CreatorId"); @@ -205,6 +238,17 @@ namespace Hutopy.Web.Features.Contents.Migrations b.Navigation("StoredDataUrls") .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 } }