many fixes and improvements - rework for modules/ and common/

feat(emailer): add Postmark and Resend providers
This commit is contained in:
2025-06-06 12:21:43 -04:00
parent 31ba18fa8d
commit 25b94d3e02
313 changed files with 6586 additions and 18260 deletions

View File

@@ -0,0 +1,190 @@
// <auto-generated />
using System;
using Hutopy.Modules.Memberships.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.Modules.Memberships.Migrations
{
[DbContext(typeof(MembershipsDbContext))]
[Migration("20250609212641_Initial")]
partial class Initial
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("Memberships")
.HasAnnotation("ProductVersion", "9.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Hutopy.Modules.Memberships.Data.Membership", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<Guid>("CreatorId")
.HasColumnType("uuid");
b.Property<DateTimeOffset?>("EndDate")
.HasColumnType("timestamp with time zone");
b.Property<Guid?>("MembershipTierId")
.HasColumnType("uuid");
b.Property<DateTimeOffset?>("StartDate")
.HasColumnType("timestamp with time zone");
b.Property<int>("State")
.HasColumnType("integer");
b.Property<string>("StripeSubscriptionId")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<Guid>("TierId")
.HasColumnType("uuid");
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("MembershipTierId");
b.ToTable("Memberships", "Memberships");
});
modelBuilder.Entity("Hutopy.Modules.Memberships.Data.MembershipTier", 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<Guid>("CreatorId")
.HasColumnType("uuid");
b.Property<string>("CurrencyCode")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property<DateTimeOffset?>("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid?>("DeletedBy")
.HasColumnType("uuid");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(4096)
.HasColumnType("character varying(4096)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property<decimal>("Price")
.HasColumnType("numeric");
b.Property<string>("StripePriceId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property<string>("StripeProductId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.HasKey("Id");
b.ToTable("MembershipTiers", "Memberships");
});
modelBuilder.Entity("Hutopy.Modules.Memberships.Data.Payment", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<decimal>("Amount")
.HasColumnType("numeric");
b.Property<DateTimeOffset>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<string>("Currency")
.IsRequired()
.HasMaxLength(8)
.HasColumnType("character varying(8)");
b.Property<string>("InvoiceUrl")
.IsRequired()
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<Guid?>("MembershipId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("MembershipId");
b.ToTable("Payments", "Memberships");
});
modelBuilder.Entity("Hutopy.Modules.Memberships.Data.Membership", b =>
{
b.HasOne("Hutopy.Modules.Memberships.Data.MembershipTier", "MembershipTier")
.WithMany("Subscriptions")
.HasForeignKey("MembershipTierId");
b.Navigation("MembershipTier");
});
modelBuilder.Entity("Hutopy.Modules.Memberships.Data.Payment", b =>
{
b.HasOne("Hutopy.Modules.Memberships.Data.Membership", null)
.WithMany("Payments")
.HasForeignKey("MembershipId");
});
modelBuilder.Entity("Hutopy.Modules.Memberships.Data.Membership", b =>
{
b.Navigation("Payments");
});
modelBuilder.Entity("Hutopy.Modules.Memberships.Data.MembershipTier", b =>
{
b.Navigation("Subscriptions");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,119 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Hutopy.Modules.Memberships.Migrations
{
/// <inheritdoc />
public partial class Initial : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.EnsureSchema(
name: "Memberships");
migrationBuilder.CreateTable(
name: "MembershipTiers",
schema: "Memberships",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
CreatorId = table.Column<Guid>(type: "uuid", nullable: false),
Name = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
Description = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false),
Price = table.Column<decimal>(type: "numeric", nullable: false),
CurrencyCode = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
StripeProductId = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
StripePriceId = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
CreatedBy = table.Column<Guid>(type: "uuid", nullable: false),
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
DeletedBy = table.Column<Guid>(type: "uuid", nullable: true),
DeletedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_MembershipTiers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Memberships",
schema: "Memberships",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
UserId = table.Column<Guid>(type: "uuid", nullable: false),
CreatorId = table.Column<Guid>(type: "uuid", nullable: false),
TierId = table.Column<Guid>(type: "uuid", nullable: false),
MembershipTierId = table.Column<Guid>(type: "uuid", nullable: true),
State = table.Column<int>(type: "integer", nullable: false),
StartDate = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
EndDate = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
StripeSubscriptionId = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Memberships", x => x.Id);
table.ForeignKey(
name: "FK_Memberships_MembershipTiers_MembershipTierId",
column: x => x.MembershipTierId,
principalSchema: "Memberships",
principalTable: "MembershipTiers",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "Payments",
schema: "Memberships",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
Amount = table.Column<decimal>(type: "numeric", nullable: false),
Currency = table.Column<string>(type: "character varying(8)", maxLength: 8, nullable: false),
InvoiceUrl = table.Column<string>(type: "character varying(2048)", maxLength: 2048, nullable: false),
MembershipId = table.Column<Guid>(type: "uuid", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Payments", x => x.Id);
table.ForeignKey(
name: "FK_Payments_Memberships_MembershipId",
column: x => x.MembershipId,
principalSchema: "Memberships",
principalTable: "Memberships",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_Memberships_MembershipTierId",
schema: "Memberships",
table: "Memberships",
column: "MembershipTierId");
migrationBuilder.CreateIndex(
name: "IX_Payments_MembershipId",
schema: "Memberships",
table: "Payments",
column: "MembershipId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Payments",
schema: "Memberships");
migrationBuilder.DropTable(
name: "Memberships",
schema: "Memberships");
migrationBuilder.DropTable(
name: "MembershipTiers",
schema: "Memberships");
}
}
}

View File

@@ -0,0 +1,187 @@
// <auto-generated />
using System;
using Hutopy.Modules.Memberships.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Hutopy.Modules.Memberships.Migrations
{
[DbContext(typeof(MembershipsDbContext))]
partial class MembershipsDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("Memberships")
.HasAnnotation("ProductVersion", "9.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Hutopy.Modules.Memberships.Data.Membership", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTimeOffset>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<Guid>("CreatorId")
.HasColumnType("uuid");
b.Property<DateTimeOffset?>("EndDate")
.HasColumnType("timestamp with time zone");
b.Property<Guid?>("MembershipTierId")
.HasColumnType("uuid");
b.Property<DateTimeOffset?>("StartDate")
.HasColumnType("timestamp with time zone");
b.Property<int>("State")
.HasColumnType("integer");
b.Property<string>("StripeSubscriptionId")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property<Guid>("TierId")
.HasColumnType("uuid");
b.Property<Guid>("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("MembershipTierId");
b.ToTable("Memberships", "Memberships");
});
modelBuilder.Entity("Hutopy.Modules.Memberships.Data.MembershipTier", 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<Guid>("CreatorId")
.HasColumnType("uuid");
b.Property<string>("CurrencyCode")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property<DateTimeOffset?>("DeletedAt")
.HasColumnType("timestamp with time zone");
b.Property<Guid?>("DeletedBy")
.HasColumnType("uuid");
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(4096)
.HasColumnType("character varying(4096)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property<decimal>("Price")
.HasColumnType("numeric");
b.Property<string>("StripePriceId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property<string>("StripeProductId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.HasKey("Id");
b.ToTable("MembershipTiers", "Memberships");
});
modelBuilder.Entity("Hutopy.Modules.Memberships.Data.Payment", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<decimal>("Amount")
.HasColumnType("numeric");
b.Property<DateTimeOffset>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("timestamp with time zone")
.HasDefaultValueSql("CURRENT_TIMESTAMP");
b.Property<string>("Currency")
.IsRequired()
.HasMaxLength(8)
.HasColumnType("character varying(8)");
b.Property<string>("InvoiceUrl")
.IsRequired()
.HasMaxLength(2048)
.HasColumnType("character varying(2048)");
b.Property<Guid?>("MembershipId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("MembershipId");
b.ToTable("Payments", "Memberships");
});
modelBuilder.Entity("Hutopy.Modules.Memberships.Data.Membership", b =>
{
b.HasOne("Hutopy.Modules.Memberships.Data.MembershipTier", "MembershipTier")
.WithMany("Subscriptions")
.HasForeignKey("MembershipTierId");
b.Navigation("MembershipTier");
});
modelBuilder.Entity("Hutopy.Modules.Memberships.Data.Payment", b =>
{
b.HasOne("Hutopy.Modules.Memberships.Data.Membership", null)
.WithMany("Payments")
.HasForeignKey("MembershipId");
});
modelBuilder.Entity("Hutopy.Modules.Memberships.Data.Membership", b =>
{
b.Navigation("Payments");
});
modelBuilder.Entity("Hutopy.Modules.Memberships.Data.MembershipTier", b =>
{
b.Navigation("Subscriptions");
});
#pragma warning restore 612, 618
}
}
}