feat: update database for page settings

This commit is contained in:
Damien Ostler 2024-02-18 07:11:19 -05:00
parent 0d63aae131
commit 8e2c3116c8
12 changed files with 1107 additions and 24 deletions

View File

@ -77,9 +77,48 @@ public class AdminSellerRequestsController : Controller
{
UserId = userId,
AgeRestricted = false,
Biography = string.Empty,
Description = string.Empty,
StripeAccountId = accountId,
SocialMediaLinks = new List<string>(){}
SocialMediaLink1 = "",
SocialMediaLink2 = "",
SocialMediaLink3 = "",
SocialMediaLink4 = "",
Name = "Default Shop",
SellerProfilePageSettings = new SellerProfilePageSettings(){
BackgroundColor = "rgb(126, 115, 115)",
HeaderColor = "rgb(194, 187, 187)",
HeaderTextSize = 5,
HeaderUseImage = false,
HeaderImageUrl = "",
DescriptionHeaderText = "",
DescriptionHeaderColor = "rgb(194, 187, 187)",
DescriptionHeaderSize = 3,
DescriptionHeaderUseImage = false,
DescriptionHeaderImageUrl = "",
DescriptionBackgroundColor = "rgb(103, 97, 97)",
DescriptionTextColor = "rgb(186, 186, 186)",
DescriptionTextSize = 1,
PortfolionHeaderText = "",
PortfolionHeaderColor = "rgb(194, 187, 187)",
PortfolionHeaderSize = 3,
PortfolionHeaderUseImage = false,
PortfolionHeaderImageUrl = "",
PortfolioBackgroundColor = "rgb(78, 73, 73)",
PortfolioMasonry = true,
PortfolioColumns = 3,
PortfolioEnabledScrolling = true,
PortfolioMaximumSize = 50,
RequestHeaderText = "",
RequestHeaderColor = "rgb(194, 187, 187)",
RequestHeaderSize = 3,
RequestHeaderUseImage = false,
RequestHeaderImageUrl = "",
RequestBackgroundColor = "rgb(103, 97, 97)",
RequestTermsColor = "rgb(194, 187, 187)",
RequestButtonBGColor = "rgb(101, 97, 97)",
RequestButtonTextColor = "rgb(194, 187, 187)",
RequestButtonHoverBGColor = "rgb(98, 98, 98)"
}
};
_dbContext.UserSellerProfiles.Add(newSellerProfile);
request = _dbContext.SellerProfileRequests.Update(request).Entity;

View File

@ -134,7 +134,7 @@ public class AdminSellersController:ControllerBase
if (!seller.Suspended)
return BadRequest();
seller.Biography = biography;
seller.Description = biography;
_dbContext.UserSellerProfiles.Update(seller);
await _dbContext.SaveChangesAsync();
return Ok();

View File

@ -0,0 +1,46 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace comissions.app.database.Entities;
public class SellerProfilePageSettings
{
public int Id { get; set; }
[ForeignKey("SellerProfile")]
public int SellerProfileId { get; set; }
public virtual UserSellerProfile SellerProfile { get; set; } = null!;
public string RequestButtonHoverBGColor { get; set; }
public string RequestButtonTextColor { get; set; }
public string RequestButtonBGColor { get; set; }
public string RequestTermsColor { get; set; }
public string RequestBackgroundColor { get; set; }
public string RequestHeaderImageUrl { get; set; }
public bool RequestHeaderUseImage { get; set; }
public int RequestHeaderSize { get; set; }
public string RequestHeaderColor { get; set; }
public string RequestHeaderText { get; set; }
public int PortfolioMaximumSize { get; set; }
public bool PortfolioEnabledScrolling { get; set; }
public int PortfolioColumns { get; set; }
public bool PortfolioMasonry { get; set; }
public string PortfolioBackgroundColor { get; set; }
public string PortfolionHeaderImageUrl { get; set; }
public bool PortfolionHeaderUseImage { get; set; }
public int PortfolionHeaderSize { get; set; }
public string PortfolionHeaderColor { get; set; }
public string PortfolionHeaderText { get; set; }
public int DescriptionTextSize { get; set; }
public string DescriptionTextColor { get; set; }
public string DescriptionBackgroundColor { get; set; }
public string DescriptionHeaderImageUrl { get; set; }
public bool DescriptionHeaderUseImage { get; set; }
public int DescriptionHeaderSize { get; set; }
public string DescriptionHeaderColor { get; set; }
public string DescriptionHeaderText { get; set; }
public string HeaderImageUrl { get; set; }
public bool HeaderUseImage { get; set; }
public int HeaderTextSize { get; set; }
public string HeaderColor { get; set; }
public string BackgroundColor { get; set; }
}

View File

@ -7,8 +7,13 @@ public record UserSellerProfile
public int Id { get; set; }
[ForeignKey(nameof(User))]
public string UserId { get; set; }
public string Biography { get; set; }
public List<string> SocialMediaLinks { get; set; } = new();
public string Name { get; set; }
public string Description { get; set; }
public string RequestGuidelines { get; set; }
public string SocialMediaLink1 { get; set; }
public string SocialMediaLink2 { get; set; }
public string SocialMediaLink3 { get; set; }
public string SocialMediaLink4 { get; set; }
public bool AgeRestricted { get; set; }
public string? StripeAccountId { get; set; }
public bool PrepaymentRequired { get; set; } = false;
@ -18,7 +23,10 @@ public record UserSellerProfile
public string? SuspendedReason { get; set; }
public string? SuspendAdminId { get; set; }
public virtual User User { get; set; } = null!;
public int SellerProfilePageSettingsId { get; set; }
public virtual SellerProfilePageSettings SellerProfilePageSettings { get; set; } = null!;
public virtual ICollection<SellerService> SellerServices { get; set; } = new List<SellerService>();
public virtual ICollection<SellerProfilePortfolioPiece> PortfolioPieces { get; set; } = new List<SellerProfilePortfolioPiece>();
}

View File

@ -0,0 +1,614 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using comissions.app.database;
#nullable disable
namespace comissions.app.api.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20240218121059_page settings")]
partial class pagesettings
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("comissions.app.database.Entities.SellerProfilePageSettings", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("BackgroundColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("DescriptionBackgroundColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("DescriptionHeaderColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("DescriptionHeaderImageUrl")
.IsRequired()
.HasColumnType("text");
b.Property<int>("DescriptionHeaderSize")
.HasColumnType("integer");
b.Property<string>("DescriptionHeaderText")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("DescriptionHeaderUseImage")
.HasColumnType("boolean");
b.Property<string>("DescriptionTextColor")
.IsRequired()
.HasColumnType("text");
b.Property<int>("DescriptionTextSize")
.HasColumnType("integer");
b.Property<string>("HeaderColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("HeaderImageUrl")
.IsRequired()
.HasColumnType("text");
b.Property<int>("HeaderTextSize")
.HasColumnType("integer");
b.Property<bool>("HeaderUseImage")
.HasColumnType("boolean");
b.Property<string>("PortfolioBackgroundColor")
.IsRequired()
.HasColumnType("text");
b.Property<int>("PortfolioColumns")
.HasColumnType("integer");
b.Property<bool>("PortfolioEnabledScrolling")
.HasColumnType("boolean");
b.Property<bool>("PortfolioMasonry")
.HasColumnType("boolean");
b.Property<int>("PortfolioMaximumSize")
.HasColumnType("integer");
b.Property<string>("PortfolionHeaderColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PortfolionHeaderImageUrl")
.IsRequired()
.HasColumnType("text");
b.Property<int>("PortfolionHeaderSize")
.HasColumnType("integer");
b.Property<string>("PortfolionHeaderText")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("PortfolionHeaderUseImage")
.HasColumnType("boolean");
b.Property<string>("RequestBackgroundColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("RequestButtonBGColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("RequestButtonHoverBGColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("RequestButtonTextColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("RequestHeaderColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("RequestHeaderImageUrl")
.IsRequired()
.HasColumnType("text");
b.Property<int>("RequestHeaderSize")
.HasColumnType("integer");
b.Property<string>("RequestHeaderText")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("RequestHeaderUseImage")
.HasColumnType("boolean");
b.Property<string>("RequestTermsColor")
.IsRequired()
.HasColumnType("text");
b.Property<int>("SellerProfileId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("SellerProfileId")
.IsUnique();
b.ToTable("SellerProfilePageSettings");
});
modelBuilder.Entity("comissions.app.database.Entities.SellerProfilePortfolioPiece", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("FileReference")
.IsRequired()
.HasColumnType("text");
b.Property<int>("SellerProfileId")
.HasColumnType("integer");
b.Property<int?>("SellerServiceId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("SellerProfileId");
b.HasIndex("SellerServiceId");
b.ToTable("SellerProfilePortfolioPieces");
});
modelBuilder.Entity("comissions.app.database.Entities.SellerProfileRequest", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<bool>("Accepted")
.HasColumnType("boolean");
b.Property<DateTime?>("AcceptedDate")
.HasColumnType("timestamp with time zone");
b.Property<DateTime>("RequestDate")
.HasColumnType("timestamp with time zone");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("SellerProfileRequests");
});
modelBuilder.Entity("comissions.app.database.Entities.SellerService", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<bool>("Archived")
.HasColumnType("boolean");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<double>("Price")
.HasColumnType("double precision");
b.Property<int>("SellerProfileId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("SellerProfileId");
b.ToTable("SellerServices");
});
modelBuilder.Entity("comissions.app.database.Entities.SellerServiceOrder", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("BuyerId")
.IsRequired()
.HasColumnType("text");
b.Property<DateTime>("CreatedDate")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("EndDate")
.HasColumnType("timestamp with time zone");
b.Property<string>("PaymentUrl")
.HasColumnType("text");
b.Property<double>("Price")
.HasColumnType("double precision");
b.Property<int>("SellerId")
.HasColumnType("integer");
b.Property<int>("SellerServiceId")
.HasColumnType("integer");
b.Property<int>("Status")
.HasColumnType("integer");
b.Property<DateTime?>("TermsAcceptedDate")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("BuyerId");
b.HasIndex("SellerId");
b.HasIndex("SellerServiceId");
b.ToTable("SellerServiceOrders");
});
modelBuilder.Entity("comissions.app.database.Entities.SellerServiceOrderReview", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("Rating")
.HasColumnType("integer");
b.Property<string>("Review")
.HasColumnType("text");
b.Property<DateTime>("ReviewDate")
.HasColumnType("timestamp with time zone");
b.Property<string>("ReviewerId")
.IsRequired()
.HasColumnType("text");
b.Property<int>("SellerServiceId")
.HasColumnType("integer");
b.Property<int>("SellerServiceOrderId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ReviewerId");
b.HasIndex("SellerServiceId");
b.HasIndex("SellerServiceOrderId");
b.ToTable("SellerServiceOrderReviews");
});
modelBuilder.Entity("comissions.app.database.Entities.User", b =>
{
b.Property<string>("Id")
.HasColumnType("text");
b.Property<string>("BanAdminId")
.HasColumnType("text");
b.Property<bool>("Banned")
.HasColumnType("boolean");
b.Property<DateTime?>("BannedDate")
.HasColumnType("timestamp with time zone");
b.Property<string>("BannedReason")
.HasColumnType("text");
b.Property<string>("Biography")
.IsRequired()
.HasColumnType("text");
b.Property<string>("DisplayName")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("text");
b.Property<string>("SuspendAdminId")
.HasColumnType("text");
b.Property<bool>("Suspended")
.HasColumnType("boolean");
b.Property<DateTime?>("SuspendedDate")
.HasColumnType("timestamp with time zone");
b.Property<string>("SuspendedReason")
.HasColumnType("text");
b.Property<DateTime?>("UnbanDate")
.HasColumnType("timestamp with time zone");
b.Property<DateTime?>("UnsuspendDate")
.HasColumnType("timestamp with time zone");
b.Property<int?>("UserSellerProfileId")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("comissions.app.database.Entities.UserSellerProfile", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<bool>("AgeRestricted")
.HasColumnType("boolean");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("PrepaymentRequired")
.HasColumnType("boolean");
b.Property<string>("RequestGuidelines")
.IsRequired()
.HasColumnType("text");
b.Property<int>("SellerProfilePageSettingsId")
.HasColumnType("integer");
b.Property<string>("SocialMediaLink1")
.IsRequired()
.HasColumnType("text");
b.Property<string>("SocialMediaLink2")
.IsRequired()
.HasColumnType("text");
b.Property<string>("SocialMediaLink3")
.IsRequired()
.HasColumnType("text");
b.Property<string>("SocialMediaLink4")
.IsRequired()
.HasColumnType("text");
b.Property<string>("StripeAccountId")
.HasColumnType("text");
b.Property<string>("SuspendAdminId")
.HasColumnType("text");
b.Property<bool>("Suspended")
.HasColumnType("boolean");
b.Property<DateTime?>("SuspendedDate")
.HasColumnType("timestamp with time zone");
b.Property<string>("SuspendedReason")
.HasColumnType("text");
b.Property<DateTime?>("UnsuspendDate")
.HasColumnType("timestamp with time zone");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("UserId")
.IsUnique();
b.ToTable("UserSellerProfiles");
});
modelBuilder.Entity("comissions.app.database.Entities.SellerProfilePageSettings", b =>
{
b.HasOne("comissions.app.database.Entities.UserSellerProfile", "SellerProfile")
.WithOne("SellerProfilePageSettings")
.HasForeignKey("comissions.app.database.Entities.SellerProfilePageSettings", "SellerProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("SellerProfile");
});
modelBuilder.Entity("comissions.app.database.Entities.SellerProfilePortfolioPiece", b =>
{
b.HasOne("comissions.app.database.Entities.UserSellerProfile", "SellerProfile")
.WithMany("PortfolioPieces")
.HasForeignKey("SellerProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("comissions.app.database.Entities.SellerService", "SellerService")
.WithMany("PortfolioPieces")
.HasForeignKey("SellerServiceId");
b.Navigation("SellerProfile");
b.Navigation("SellerService");
});
modelBuilder.Entity("comissions.app.database.Entities.SellerProfileRequest", b =>
{
b.HasOne("comissions.app.database.Entities.User", "User")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("comissions.app.database.Entities.SellerService", b =>
{
b.HasOne("comissions.app.database.Entities.UserSellerProfile", "SellerProfile")
.WithMany("SellerServices")
.HasForeignKey("SellerProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("SellerProfile");
});
modelBuilder.Entity("comissions.app.database.Entities.SellerServiceOrder", b =>
{
b.HasOne("comissions.app.database.Entities.User", "Buyer")
.WithMany("Orders")
.HasForeignKey("BuyerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("comissions.app.database.Entities.UserSellerProfile", "Seller")
.WithMany()
.HasForeignKey("SellerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("comissions.app.database.Entities.SellerService", "SellerService")
.WithMany()
.HasForeignKey("SellerServiceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Buyer");
b.Navigation("Seller");
b.Navigation("SellerService");
});
modelBuilder.Entity("comissions.app.database.Entities.SellerServiceOrderReview", b =>
{
b.HasOne("comissions.app.database.Entities.User", "Reviewer")
.WithMany()
.HasForeignKey("ReviewerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("comissions.app.database.Entities.SellerService", "SellerService")
.WithMany("Reviews")
.HasForeignKey("SellerServiceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("comissions.app.database.Entities.SellerServiceOrder", "SellerServiceOrder")
.WithMany("Reviews")
.HasForeignKey("SellerServiceOrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Reviewer");
b.Navigation("SellerService");
b.Navigation("SellerServiceOrder");
});
modelBuilder.Entity("comissions.app.database.Entities.UserSellerProfile", b =>
{
b.HasOne("comissions.app.database.Entities.User", "User")
.WithOne("UserSellerProfile")
.HasForeignKey("comissions.app.database.Entities.UserSellerProfile", "UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("comissions.app.database.Entities.SellerService", b =>
{
b.Navigation("PortfolioPieces");
b.Navigation("Reviews");
});
modelBuilder.Entity("comissions.app.database.Entities.SellerServiceOrder", b =>
{
b.Navigation("Reviews");
});
modelBuilder.Entity("comissions.app.database.Entities.User", b =>
{
b.Navigation("Orders");
b.Navigation("UserSellerProfile");
});
modelBuilder.Entity("comissions.app.database.Entities.UserSellerProfile", b =>
{
b.Navigation("PortfolioPieces");
b.Navigation("SellerProfilePageSettings")
.IsRequired();
b.Navigation("SellerServices");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,178 @@
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace comissions.app.api.Migrations
{
/// <inheritdoc />
public partial class pagesettings : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "SocialMediaLinks",
table: "UserSellerProfiles");
migrationBuilder.RenameColumn(
name: "Biography",
table: "UserSellerProfiles",
newName: "SocialMediaLink4");
migrationBuilder.AddColumn<string>(
name: "Description",
table: "UserSellerProfiles",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "Name",
table: "UserSellerProfiles",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "RequestGuidelines",
table: "UserSellerProfiles",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<int>(
name: "SellerProfilePageSettingsId",
table: "UserSellerProfiles",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<string>(
name: "SocialMediaLink1",
table: "UserSellerProfiles",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "SocialMediaLink2",
table: "UserSellerProfiles",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddColumn<string>(
name: "SocialMediaLink3",
table: "UserSellerProfiles",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.CreateTable(
name: "SellerProfilePageSettings",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
SellerProfileId = table.Column<int>(type: "integer", nullable: false),
RequestButtonHoverBGColor = table.Column<string>(type: "text", nullable: false),
RequestButtonTextColor = table.Column<string>(type: "text", nullable: false),
RequestButtonBGColor = table.Column<string>(type: "text", nullable: false),
RequestTermsColor = table.Column<string>(type: "text", nullable: false),
RequestBackgroundColor = table.Column<string>(type: "text", nullable: false),
RequestHeaderImageUrl = table.Column<string>(type: "text", nullable: false),
RequestHeaderUseImage = table.Column<bool>(type: "boolean", nullable: false),
RequestHeaderSize = table.Column<int>(type: "integer", nullable: false),
RequestHeaderColor = table.Column<string>(type: "text", nullable: false),
RequestHeaderText = table.Column<string>(type: "text", nullable: false),
PortfolioMaximumSize = table.Column<int>(type: "integer", nullable: false),
PortfolioEnabledScrolling = table.Column<bool>(type: "boolean", nullable: false),
PortfolioColumns = table.Column<int>(type: "integer", nullable: false),
PortfolioMasonry = table.Column<bool>(type: "boolean", nullable: false),
PortfolioBackgroundColor = table.Column<string>(type: "text", nullable: false),
PortfolionHeaderImageUrl = table.Column<string>(type: "text", nullable: false),
PortfolionHeaderUseImage = table.Column<bool>(type: "boolean", nullable: false),
PortfolionHeaderSize = table.Column<int>(type: "integer", nullable: false),
PortfolionHeaderColor = table.Column<string>(type: "text", nullable: false),
PortfolionHeaderText = table.Column<string>(type: "text", nullable: false),
DescriptionTextSize = table.Column<int>(type: "integer", nullable: false),
DescriptionTextColor = table.Column<string>(type: "text", nullable: false),
DescriptionBackgroundColor = table.Column<string>(type: "text", nullable: false),
DescriptionHeaderImageUrl = table.Column<string>(type: "text", nullable: false),
DescriptionHeaderUseImage = table.Column<bool>(type: "boolean", nullable: false),
DescriptionHeaderSize = table.Column<int>(type: "integer", nullable: false),
DescriptionHeaderColor = table.Column<string>(type: "text", nullable: false),
DescriptionHeaderText = table.Column<string>(type: "text", nullable: false),
HeaderImageUrl = table.Column<string>(type: "text", nullable: false),
HeaderUseImage = table.Column<bool>(type: "boolean", nullable: false),
HeaderTextSize = table.Column<int>(type: "integer", nullable: false),
HeaderColor = table.Column<string>(type: "text", nullable: false),
BackgroundColor = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SellerProfilePageSettings", x => x.Id);
table.ForeignKey(
name: "FK_SellerProfilePageSettings_UserSellerProfiles_SellerProfileId",
column: x => x.SellerProfileId,
principalTable: "UserSellerProfiles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_SellerProfilePageSettings_SellerProfileId",
table: "SellerProfilePageSettings",
column: "SellerProfileId",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "SellerProfilePageSettings");
migrationBuilder.DropColumn(
name: "Description",
table: "UserSellerProfiles");
migrationBuilder.DropColumn(
name: "Name",
table: "UserSellerProfiles");
migrationBuilder.DropColumn(
name: "RequestGuidelines",
table: "UserSellerProfiles");
migrationBuilder.DropColumn(
name: "SellerProfilePageSettingsId",
table: "UserSellerProfiles");
migrationBuilder.DropColumn(
name: "SocialMediaLink1",
table: "UserSellerProfiles");
migrationBuilder.DropColumn(
name: "SocialMediaLink2",
table: "UserSellerProfiles");
migrationBuilder.DropColumn(
name: "SocialMediaLink3",
table: "UserSellerProfiles");
migrationBuilder.RenameColumn(
name: "SocialMediaLink4",
table: "UserSellerProfiles",
newName: "Biography");
migrationBuilder.AddColumn<List<string>>(
name: "SocialMediaLinks",
table: "UserSellerProfiles",
type: "text[]",
nullable: false);
}
}
}

View File

@ -1,6 +1,5 @@
// <auto-generated />
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
@ -23,6 +22,144 @@ namespace comissions.app.api.Migrations
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("comissions.app.database.Entities.SellerProfilePageSettings", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("BackgroundColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("DescriptionBackgroundColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("DescriptionHeaderColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("DescriptionHeaderImageUrl")
.IsRequired()
.HasColumnType("text");
b.Property<int>("DescriptionHeaderSize")
.HasColumnType("integer");
b.Property<string>("DescriptionHeaderText")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("DescriptionHeaderUseImage")
.HasColumnType("boolean");
b.Property<string>("DescriptionTextColor")
.IsRequired()
.HasColumnType("text");
b.Property<int>("DescriptionTextSize")
.HasColumnType("integer");
b.Property<string>("HeaderColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("HeaderImageUrl")
.IsRequired()
.HasColumnType("text");
b.Property<int>("HeaderTextSize")
.HasColumnType("integer");
b.Property<bool>("HeaderUseImage")
.HasColumnType("boolean");
b.Property<string>("PortfolioBackgroundColor")
.IsRequired()
.HasColumnType("text");
b.Property<int>("PortfolioColumns")
.HasColumnType("integer");
b.Property<bool>("PortfolioEnabledScrolling")
.HasColumnType("boolean");
b.Property<bool>("PortfolioMasonry")
.HasColumnType("boolean");
b.Property<int>("PortfolioMaximumSize")
.HasColumnType("integer");
b.Property<string>("PortfolionHeaderColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("PortfolionHeaderImageUrl")
.IsRequired()
.HasColumnType("text");
b.Property<int>("PortfolionHeaderSize")
.HasColumnType("integer");
b.Property<string>("PortfolionHeaderText")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("PortfolionHeaderUseImage")
.HasColumnType("boolean");
b.Property<string>("RequestBackgroundColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("RequestButtonBGColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("RequestButtonHoverBGColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("RequestButtonTextColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("RequestHeaderColor")
.IsRequired()
.HasColumnType("text");
b.Property<string>("RequestHeaderImageUrl")
.IsRequired()
.HasColumnType("text");
b.Property<int>("RequestHeaderSize")
.HasColumnType("integer");
b.Property<string>("RequestHeaderText")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("RequestHeaderUseImage")
.HasColumnType("boolean");
b.Property<string>("RequestTermsColor")
.IsRequired()
.HasColumnType("text");
b.Property<int>("SellerProfileId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("SellerProfileId")
.IsUnique();
b.ToTable("SellerProfilePageSettings");
});
modelBuilder.Entity("comissions.app.database.Entities.SellerProfilePortfolioPiece", b =>
{
b.Property<int>("Id")
@ -261,16 +398,39 @@ namespace comissions.app.api.Migrations
b.Property<bool>("AgeRestricted")
.HasColumnType("boolean");
b.Property<string>("Biography")
b.Property<string>("Description")
.IsRequired()
.HasColumnType("text");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text");
b.Property<bool>("PrepaymentRequired")
.HasColumnType("boolean");
b.Property<List<string>>("SocialMediaLinks")
b.Property<string>("RequestGuidelines")
.IsRequired()
.HasColumnType("text[]");
.HasColumnType("text");
b.Property<int>("SellerProfilePageSettingsId")
.HasColumnType("integer");
b.Property<string>("SocialMediaLink1")
.IsRequired()
.HasColumnType("text");
b.Property<string>("SocialMediaLink2")
.IsRequired()
.HasColumnType("text");
b.Property<string>("SocialMediaLink3")
.IsRequired()
.HasColumnType("text");
b.Property<string>("SocialMediaLink4")
.IsRequired()
.HasColumnType("text");
b.Property<string>("StripeAccountId")
.HasColumnType("text");
@ -302,6 +462,17 @@ namespace comissions.app.api.Migrations
b.ToTable("UserSellerProfiles");
});
modelBuilder.Entity("comissions.app.database.Entities.SellerProfilePageSettings", b =>
{
b.HasOne("comissions.app.database.Entities.UserSellerProfile", "SellerProfile")
.WithOne("SellerProfilePageSettings")
.HasForeignKey("comissions.app.database.Entities.SellerProfilePageSettings", "SellerProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("SellerProfile");
});
modelBuilder.Entity("comissions.app.database.Entities.SellerProfilePortfolioPiece", b =>
{
b.HasOne("comissions.app.database.Entities.UserSellerProfile", "SellerProfile")
@ -429,6 +600,9 @@ namespace comissions.app.api.Migrations
{
b.Navigation("PortfolioPieces");
b.Navigation("SellerProfilePageSettings")
.IsRequired();
b.Navigation("SellerServices");
});
#pragma warning restore 612, 618

View File

@ -4,9 +4,13 @@ public class DiscoverySellerModel
{
public int Id { get; set; }
public string Name { get; set; }
public List<string> SocialMediaLinks { get; set; }
public string Biography { get; set; }
public string SocialMeidaLink1 { get; set; }
public string SocialMeidaLink2 { get; set; }
public string SocialMeidaLink3 { get; set; }
public string SocialMeidaLink4 { get; set; }
public string Description { get; set; }
public bool PrepaymentRequired { get; set; }
public double? AverageRating { get; set; }
public int? ReviewCount { get; set; }
public string RequestGuidelines { get; set; }
}

View File

@ -3,7 +3,11 @@ namespace comissions.app.api.Models.SellerProfile;
public class SellerProfileModel
{
public int Id { get; set; }
public List<string> SocialMediaLinks { get; set; }
public string Biography { get; set; }
public bool PrepaymentRequired { get; set; }
public string SocialMeidaLink3 { get; set; }
public string SocialMeidaLink2 { get; set; }
public string SocialMeidaLink1 { get; set; }
public string Description { get; set; }
public string SocialMeidaLink4 { get; set; }
public string RequestGuidelines { get; set; }
}

View File

@ -11,8 +11,12 @@ public static class SellerProfileModelExtensions
return new SellerProfileModel()
{
Id = sellerProfile.Id,
SocialMediaLinks = sellerProfile.SocialMediaLinks,
Biography = sellerProfile.Biography,
SocialMeidaLink1 = sellerProfile.SocialMediaLink1,
SocialMeidaLink2 = sellerProfile.SocialMediaLink2,
SocialMeidaLink3 = sellerProfile.SocialMediaLink3,
SocialMeidaLink4 = sellerProfile.SocialMediaLink4,
Description = sellerProfile.Description,
RequestGuidelines = sellerProfile.RequestGuidelines,
PrepaymentRequired = sellerProfile.PrepaymentRequired
};
}
@ -23,8 +27,12 @@ public static class SellerProfileModelExtensions
{
Name = sellerProfile.User.DisplayName,
Id = sellerProfile.Id,
SocialMediaLinks = sellerProfile.SocialMediaLinks,
Biography = sellerProfile.Biography,
SocialMeidaLink1 = sellerProfile.SocialMediaLink1,
SocialMeidaLink2 = sellerProfile.SocialMediaLink2,
SocialMeidaLink3 = sellerProfile.SocialMediaLink3,
SocialMeidaLink4 = sellerProfile.SocialMediaLink4,
Description = sellerProfile.Description,
RequestGuidelines = sellerProfile.RequestGuidelines,
PrepaymentRequired = sellerProfile.PrepaymentRequired,
};
}
@ -38,8 +46,12 @@ public static class SellerProfileModelExtensions
{
Name = sellerProfile.User.DisplayName,
Id = sellerProfile.Id,
SocialMediaLinks = sellerProfile.SocialMediaLinks,
Biography = sellerProfile.Biography,
SocialMeidaLink1 = sellerProfile.SocialMediaLink1,
SocialMeidaLink2 = sellerProfile.SocialMediaLink2,
SocialMeidaLink3 = sellerProfile.SocialMediaLink3,
SocialMeidaLink4 = sellerProfile.SocialMediaLink4,
Description = sellerProfile.Description,
RequestGuidelines = sellerProfile.RequestGuidelines,
PrepaymentRequired = sellerProfile.PrepaymentRequired,
AverageRating =reviewAverage,
ReviewCount = reviews.Count()
@ -47,8 +59,12 @@ public static class SellerProfileModelExtensions
}
public static UserSellerProfile ToModel(this SellerProfileModel sellerProfile, UserSellerProfile existingSellerProfile)
{
existingSellerProfile.SocialMediaLinks = sellerProfile.SocialMediaLinks;
existingSellerProfile.Biography = sellerProfile.Biography;
existingSellerProfile.SocialMediaLink1 = sellerProfile.SocialMeidaLink1;
existingSellerProfile.SocialMediaLink2 = sellerProfile.SocialMeidaLink2;
existingSellerProfile.SocialMediaLink3 = sellerProfile.SocialMeidaLink3;
existingSellerProfile.SocialMediaLink4 = sellerProfile.SocialMeidaLink4;
existingSellerProfile.Description = sellerProfile.Description;
existingSellerProfile.RequestGuidelines = sellerProfile.RequestGuidelines;
existingSellerProfile.PrepaymentRequired = sellerProfile.PrepaymentRequired;
return existingSellerProfile;
}

View File

@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("comissions.app.database.migrator")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d8d51b456050a060dd0ecc4ad9e1563fa2516ff2")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0d63aae1311642c2e8c803966369f5da0ea18ce2")]
[assembly: System.Reflection.AssemblyProductAttribute("comissions.app.database.migrator")]
[assembly: System.Reflection.AssemblyTitleAttribute("comissions.app.database.migrator")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
a282da1bb9c181a212285cc35598ecd3419f40b57c41b5e385a87aca4aed9fd3
a4159fd41a43dc7f19501c196bc7d0764162eaaba63418d3ac373794c8e4237f