✨ Wallet funds
This commit is contained in:
2207
DysonNetwork.Pass/Migrations/20251003123103_RefactorSubscriptionRelation.Designer.cs
generated
Normal file
2207
DysonNetwork.Pass/Migrations/20251003123103_RefactorSubscriptionRelation.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DysonNetwork.Pass.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class RefactorSubscriptionRelation : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "fk_wallet_subscriptions_wallet_gifts_gift_id",
|
||||
table: "wallet_subscriptions");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "ix_wallet_subscriptions_gift_id",
|
||||
table: "wallet_subscriptions");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "gift_id",
|
||||
table: "wallet_subscriptions");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "subscription_id",
|
||||
table: "wallet_gifts",
|
||||
type: "uuid",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_wallet_gifts_subscription_id",
|
||||
table: "wallet_gifts",
|
||||
column: "subscription_id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "fk_wallet_gifts_wallet_subscriptions_subscription_id",
|
||||
table: "wallet_gifts",
|
||||
column: "subscription_id",
|
||||
principalTable: "wallet_subscriptions",
|
||||
principalColumn: "id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "fk_wallet_gifts_wallet_subscriptions_subscription_id",
|
||||
table: "wallet_gifts");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "ix_wallet_gifts_subscription_id",
|
||||
table: "wallet_gifts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "subscription_id",
|
||||
table: "wallet_gifts");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "gift_id",
|
||||
table: "wallet_subscriptions",
|
||||
type: "uuid",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_wallet_subscriptions_gift_id",
|
||||
table: "wallet_subscriptions",
|
||||
column: "gift_id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "fk_wallet_subscriptions_wallet_gifts_gift_id",
|
||||
table: "wallet_subscriptions",
|
||||
column: "gift_id",
|
||||
principalTable: "wallet_gifts",
|
||||
principalColumn: "id");
|
||||
}
|
||||
}
|
||||
}
|
2355
DysonNetwork.Pass/Migrations/20251003152102_AddWalletFund.Designer.cs
generated
Normal file
2355
DysonNetwork.Pass/Migrations/20251003152102_AddWalletFund.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
99
DysonNetwork.Pass/Migrations/20251003152102_AddWalletFund.cs
Normal file
99
DysonNetwork.Pass/Migrations/20251003152102_AddWalletFund.cs
Normal file
@@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using NodaTime;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DysonNetwork.Pass.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddWalletFund : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "wallet_funds",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
currency = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
||||
total_amount = table.Column<decimal>(type: "numeric", nullable: false),
|
||||
split_type = table.Column<int>(type: "integer", nullable: false),
|
||||
status = table.Column<int>(type: "integer", nullable: false),
|
||||
message = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
|
||||
creator_account_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
expired_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_wallet_funds", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_wallet_funds_accounts_creator_account_id",
|
||||
column: x => x.creator_account_id,
|
||||
principalTable: "accounts",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "wallet_fund_recipients",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
fund_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
recipient_account_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
amount = table.Column<decimal>(type: "numeric", nullable: false),
|
||||
is_received = table.Column<bool>(type: "boolean", nullable: false),
|
||||
received_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
|
||||
created_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
updated_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
deleted_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_wallet_fund_recipients", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_wallet_fund_recipients_accounts_recipient_account_id",
|
||||
column: x => x.recipient_account_id,
|
||||
principalTable: "accounts",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "fk_wallet_fund_recipients_wallet_funds_fund_id",
|
||||
column: x => x.fund_id,
|
||||
principalTable: "wallet_funds",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_wallet_fund_recipients_fund_id",
|
||||
table: "wallet_fund_recipients",
|
||||
column: "fund_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_wallet_fund_recipients_recipient_account_id",
|
||||
table: "wallet_fund_recipients",
|
||||
column: "recipient_account_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_wallet_funds_creator_account_id",
|
||||
table: "wallet_funds",
|
||||
column: "creator_account_id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "wallet_fund_recipients");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "wallet_funds");
|
||||
}
|
||||
}
|
||||
}
|
@@ -1387,6 +1387,116 @@ namespace DysonNetwork.Pass.Migrations
|
||||
b.ToTable("wallet_coupons", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletFund", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<Instant>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<Guid>("CreatorAccountId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("creator_account_id");
|
||||
|
||||
b.Property<string>("Currency")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)")
|
||||
.HasColumnName("currency");
|
||||
|
||||
b.Property<Instant?>("DeletedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("deleted_at");
|
||||
|
||||
b.Property<Instant>("ExpiredAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("expired_at");
|
||||
|
||||
b.Property<string>("Message")
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("message");
|
||||
|
||||
b.Property<int>("SplitType")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("split_type");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<decimal>("TotalAmount")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("total_amount");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_wallet_funds");
|
||||
|
||||
b.HasIndex("CreatorAccountId")
|
||||
.HasDatabaseName("ix_wallet_funds_creator_account_id");
|
||||
|
||||
b.ToTable("wallet_funds", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletFundRecipient", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<decimal>("Amount")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("amount");
|
||||
|
||||
b.Property<Instant>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
b.Property<Instant?>("DeletedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("deleted_at");
|
||||
|
||||
b.Property<Guid>("FundId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("fund_id");
|
||||
|
||||
b.Property<bool>("IsReceived")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_received");
|
||||
|
||||
b.Property<Instant?>("ReceivedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("received_at");
|
||||
|
||||
b.Property<Guid>("RecipientAccountId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("recipient_account_id");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_wallet_fund_recipients");
|
||||
|
||||
b.HasIndex("FundId")
|
||||
.HasDatabaseName("ix_wallet_fund_recipients_fund_id");
|
||||
|
||||
b.HasIndex("RecipientAccountId")
|
||||
.HasDatabaseName("ix_wallet_fund_recipients_recipient_account_id");
|
||||
|
||||
b.ToTable("wallet_fund_recipients", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletGift", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
@@ -1464,6 +1574,10 @@ namespace DysonNetwork.Pass.Migrations
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<Guid?>("SubscriptionId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("subscription_id");
|
||||
|
||||
b.Property<string>("SubscriptionIdentifier")
|
||||
.IsRequired()
|
||||
.HasMaxLength(4096)
|
||||
@@ -1492,6 +1606,10 @@ namespace DysonNetwork.Pass.Migrations
|
||||
b.HasIndex("RedeemerId")
|
||||
.HasDatabaseName("ix_wallet_gifts_redeemer_id");
|
||||
|
||||
b.HasIndex("SubscriptionId")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_wallet_gifts_subscription_id");
|
||||
|
||||
b.ToTable("wallet_gifts", (string)null);
|
||||
});
|
||||
|
||||
@@ -1648,10 +1766,6 @@ namespace DysonNetwork.Pass.Migrations
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("ended_at");
|
||||
|
||||
b.Property<Guid?>("GiftId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("gift_id");
|
||||
|
||||
b.Property<string>("Identifier")
|
||||
.IsRequired()
|
||||
.HasMaxLength(4096)
|
||||
@@ -1698,10 +1812,6 @@ namespace DysonNetwork.Pass.Migrations
|
||||
b.HasIndex("CouponId")
|
||||
.HasDatabaseName("ix_wallet_subscriptions_coupon_id");
|
||||
|
||||
b.HasIndex("GiftId")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_wallet_subscriptions_gift_id");
|
||||
|
||||
b.HasIndex("Identifier")
|
||||
.HasDatabaseName("ix_wallet_subscriptions_identifier");
|
||||
|
||||
@@ -2055,6 +2165,39 @@ namespace DysonNetwork.Pass.Migrations
|
||||
b.Navigation("Account");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletFund", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Shared.Models.SnAccount", "CreatorAccount")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatorAccountId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_wallet_funds_accounts_creator_account_id");
|
||||
|
||||
b.Navigation("CreatorAccount");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletFundRecipient", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Shared.Models.SnWalletFund", "Fund")
|
||||
.WithMany("Recipients")
|
||||
.HasForeignKey("FundId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_wallet_fund_recipients_wallet_funds_fund_id");
|
||||
|
||||
b.HasOne("DysonNetwork.Shared.Models.SnAccount", "RecipientAccount")
|
||||
.WithMany()
|
||||
.HasForeignKey("RecipientAccountId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_wallet_fund_recipients_accounts_recipient_account_id");
|
||||
|
||||
b.Navigation("Fund");
|
||||
|
||||
b.Navigation("RecipientAccount");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletGift", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Shared.Models.SnWalletCoupon", "Coupon")
|
||||
@@ -2079,6 +2222,11 @@ namespace DysonNetwork.Pass.Migrations
|
||||
.HasForeignKey("RedeemerId")
|
||||
.HasConstraintName("fk_wallet_gifts_accounts_redeemer_id");
|
||||
|
||||
b.HasOne("DysonNetwork.Shared.Models.SnWalletSubscription", "Subscription")
|
||||
.WithOne("Gift")
|
||||
.HasForeignKey("DysonNetwork.Shared.Models.SnWalletGift", "SubscriptionId")
|
||||
.HasConstraintName("fk_wallet_gifts_wallet_subscriptions_subscription_id");
|
||||
|
||||
b.Navigation("Coupon");
|
||||
|
||||
b.Navigation("Gifter");
|
||||
@@ -2086,6 +2234,8 @@ namespace DysonNetwork.Pass.Migrations
|
||||
b.Navigation("Recipient");
|
||||
|
||||
b.Navigation("Redeemer");
|
||||
|
||||
b.Navigation("Subscription");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletOrder", b =>
|
||||
@@ -2131,16 +2281,9 @@ namespace DysonNetwork.Pass.Migrations
|
||||
.HasForeignKey("CouponId")
|
||||
.HasConstraintName("fk_wallet_subscriptions_wallet_coupons_coupon_id");
|
||||
|
||||
b.HasOne("DysonNetwork.Shared.Models.SnWalletGift", "Gift")
|
||||
.WithOne("Subscription")
|
||||
.HasForeignKey("DysonNetwork.Shared.Models.SnWalletSubscription", "GiftId")
|
||||
.HasConstraintName("fk_wallet_subscriptions_wallet_gifts_gift_id");
|
||||
|
||||
b.Navigation("Account");
|
||||
|
||||
b.Navigation("Coupon");
|
||||
|
||||
b.Navigation("Gift");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletTransaction", b =>
|
||||
@@ -2194,9 +2337,14 @@ namespace DysonNetwork.Pass.Migrations
|
||||
b.Navigation("Pockets");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletGift", b =>
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletFund", b =>
|
||||
{
|
||||
b.Navigation("Subscription");
|
||||
b.Navigation("Recipients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletSubscription", b =>
|
||||
{
|
||||
b.Navigation("Gift");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
|
Reference in New Issue
Block a user