🐛 Fix some issues in sepration of the Pass and Wallet service
This commit is contained in:
@@ -50,15 +50,7 @@ public class AppDatabase(
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
// Ignore account-related entities that belong to Pass project
|
||||
// These are referenced via navigation properties but tables are in Pass database
|
||||
modelBuilder.Ignore<SnAccount>();
|
||||
modelBuilder.Ignore<SnAccountProfile>();
|
||||
modelBuilder.Ignore<SnPermissionGroupMember>();
|
||||
modelBuilder.Ignore<SnAccountRelationship>();
|
||||
modelBuilder.Ignore<SnRealmMember>();
|
||||
|
||||
|
||||
modelBuilder.ApplySoftDeleteFilters();
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.2">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Quartz" Version="3.15.1" />
|
||||
<PackageReference Include="Quartz.AspNetCore" Version="3.15.1" />
|
||||
<PackageReference Include="Quartz.Extensions.Hosting" Version="3.15.1" />
|
||||
|
||||
826
DysonNetwork.Wallet/Migrations/20260203080529_InitialMigration.Designer.cs
generated
Normal file
826
DysonNetwork.Wallet/Migrations/20260203080529_InitialMigration.Designer.cs
generated
Normal file
@@ -0,0 +1,826 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DysonNetwork.Shared.Models;
|
||||
using DysonNetwork.Wallet;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using NodaTime;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DysonNetwork.Wallet.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDatabase))]
|
||||
[Migration("20260203080529_InitialMigration")]
|
||||
partial class InitialMigration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.2")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnLottery", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<Guid>("AccountId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("account_id");
|
||||
|
||||
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<Instant?>("DrawDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("draw_date");
|
||||
|
||||
b.Property<int>("DrawStatus")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("draw_status");
|
||||
|
||||
b.PrimitiveCollection<string>("MatchedRegionOneNumbers")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("matched_region_one_numbers");
|
||||
|
||||
b.Property<int?>("MatchedRegionTwoNumber")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("matched_region_two_number");
|
||||
|
||||
b.Property<int>("Multiplier")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("multiplier");
|
||||
|
||||
b.PrimitiveCollection<string>("RegionOneNumbers")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("region_one_numbers");
|
||||
|
||||
b.Property<int>("RegionTwoNumber")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("region_two_number");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_lotteries");
|
||||
|
||||
b.ToTable("lotteries", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnLotteryRecord", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
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<Instant>("DrawDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("draw_date");
|
||||
|
||||
b.Property<long>("TotalPrizeAmount")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("total_prize_amount");
|
||||
|
||||
b.Property<int>("TotalPrizesAwarded")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("total_prizes_awarded");
|
||||
|
||||
b.Property<int>("TotalTickets")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("total_tickets");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.PrimitiveCollection<string>("WinningRegionOneNumbers")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("winning_region_one_numbers");
|
||||
|
||||
b.Property<int>("WinningRegionTwoNumber")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("winning_region_two_number");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_lottery_records");
|
||||
|
||||
b.ToTable("lottery_records", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWallet", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<Guid>("AccountId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("account_id");
|
||||
|
||||
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<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_wallets");
|
||||
|
||||
b.ToTable("wallets", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletCoupon", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<Instant?>("AffectedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("affected_at");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.HasMaxLength(1024)
|
||||
.HasColumnType("character varying(1024)")
|
||||
.HasColumnName("code");
|
||||
|
||||
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<decimal?>("DiscountAmount")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("discount_amount");
|
||||
|
||||
b.Property<double?>("DiscountRate")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("discount_rate");
|
||||
|
||||
b.Property<Instant?>("ExpiredAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("expired_at");
|
||||
|
||||
b.Property<string>("Identifier")
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("identifier");
|
||||
|
||||
b.Property<int?>("MaxUsage")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("max_usage");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_wallet_coupons");
|
||||
|
||||
b.ToTable("wallet_coupons", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletFund", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<int>("AmountOfSplits")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("amount_of_splits");
|
||||
|
||||
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<bool>("IsOpen")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_open");
|
||||
|
||||
b.Property<string>("Message")
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("message");
|
||||
|
||||
b.Property<decimal>("RemainingAmount")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("remaining_amount");
|
||||
|
||||
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.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.ToTable("wallet_fund_recipients", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletGift", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<decimal>("BasePrice")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("base_price");
|
||||
|
||||
b.Property<Guid?>("CouponId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("coupon_id");
|
||||
|
||||
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<Instant>("ExpiresAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("expires_at");
|
||||
|
||||
b.Property<decimal>("FinalPrice")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("final_price");
|
||||
|
||||
b.Property<string>("GiftCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)")
|
||||
.HasColumnName("gift_code");
|
||||
|
||||
b.Property<Guid>("GifterId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("gifter_id");
|
||||
|
||||
b.Property<bool>("IsOpenGift")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_open_gift");
|
||||
|
||||
b.Property<string>("Message")
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("character varying(1000)")
|
||||
.HasColumnName("message");
|
||||
|
||||
b.Property<SnPaymentDetails>("PaymentDetails")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("payment_details");
|
||||
|
||||
b.Property<string>("PaymentMethod")
|
||||
.IsRequired()
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("payment_method");
|
||||
|
||||
b.Property<Guid?>("RecipientId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("recipient_id");
|
||||
|
||||
b.Property<Instant?>("RedeemedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("redeemed_at");
|
||||
|
||||
b.Property<Guid?>("RedeemerId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("redeemer_id");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<Guid?>("SubscriptionId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("subscription_id");
|
||||
|
||||
b.Property<string>("SubscriptionIdentifier")
|
||||
.IsRequired()
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("subscription_identifier");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_wallet_gifts");
|
||||
|
||||
b.HasIndex("CouponId")
|
||||
.HasDatabaseName("ix_wallet_gifts_coupon_id");
|
||||
|
||||
b.HasIndex("GiftCode")
|
||||
.HasDatabaseName("ix_wallet_gifts_gift_code");
|
||||
|
||||
b.HasIndex("GifterId")
|
||||
.HasDatabaseName("ix_wallet_gifts_gifter_id");
|
||||
|
||||
b.HasIndex("RecipientId")
|
||||
.HasDatabaseName("ix_wallet_gifts_recipient_id");
|
||||
|
||||
b.HasIndex("SubscriptionId")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_wallet_gifts_subscription_id");
|
||||
|
||||
b.ToTable("wallet_gifts", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletOrder", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<decimal>("Amount")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("amount");
|
||||
|
||||
b.Property<string>("AppIdentifier")
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("app_identifier");
|
||||
|
||||
b.Property<Instant>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
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<Dictionary<string, object>>("Meta")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("meta");
|
||||
|
||||
b.Property<Guid?>("PayeeWalletId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("payee_wallet_id");
|
||||
|
||||
b.Property<string>("ProductIdentifier")
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("product_identifier");
|
||||
|
||||
b.Property<string>("Remarks")
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("remarks");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<Guid?>("TransactionId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("transaction_id");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_payment_orders");
|
||||
|
||||
b.HasIndex("PayeeWalletId")
|
||||
.HasDatabaseName("ix_payment_orders_payee_wallet_id");
|
||||
|
||||
b.HasIndex("TransactionId")
|
||||
.HasDatabaseName("ix_payment_orders_transaction_id");
|
||||
|
||||
b.ToTable("payment_orders", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletPocket", 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<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>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.Property<Guid>("WalletId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("wallet_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_wallet_pockets");
|
||||
|
||||
b.HasIndex("WalletId")
|
||||
.HasDatabaseName("ix_wallet_pockets_wallet_id");
|
||||
|
||||
b.ToTable("wallet_pockets", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletSubscription", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<Guid>("AccountId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("account_id");
|
||||
|
||||
b.Property<decimal>("BasePrice")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("base_price");
|
||||
|
||||
b.Property<Instant>("BegunAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("begun_at");
|
||||
|
||||
b.Property<Guid?>("CouponId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("coupon_id");
|
||||
|
||||
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<Instant?>("EndedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("ended_at");
|
||||
|
||||
b.Property<string>("Identifier")
|
||||
.IsRequired()
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("identifier");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_active");
|
||||
|
||||
b.Property<bool>("IsFreeTrial")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_free_trial");
|
||||
|
||||
b.Property<SnPaymentDetails>("PaymentDetails")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("payment_details");
|
||||
|
||||
b.Property<string>("PaymentMethod")
|
||||
.IsRequired()
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("payment_method");
|
||||
|
||||
b.Property<Instant?>("RenewalAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("renewal_at");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_wallet_subscriptions");
|
||||
|
||||
b.HasIndex("AccountId")
|
||||
.HasDatabaseName("ix_wallet_subscriptions_account_id");
|
||||
|
||||
b.HasIndex("CouponId")
|
||||
.HasDatabaseName("ix_wallet_subscriptions_coupon_id");
|
||||
|
||||
b.HasIndex("Identifier")
|
||||
.HasDatabaseName("ix_wallet_subscriptions_identifier");
|
||||
|
||||
b.HasIndex("Status")
|
||||
.HasDatabaseName("ix_wallet_subscriptions_status");
|
||||
|
||||
b.HasIndex("AccountId", "Identifier")
|
||||
.HasDatabaseName("ix_wallet_subscriptions_account_id_identifier");
|
||||
|
||||
b.HasIndex("AccountId", "IsActive")
|
||||
.HasDatabaseName("ix_wallet_subscriptions_account_id_is_active");
|
||||
|
||||
b.ToTable("wallet_subscriptions", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletTransaction", 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<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<Guid?>("PayeeWalletId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("payee_wallet_id");
|
||||
|
||||
b.Property<Guid?>("PayerWalletId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("payer_wallet_id");
|
||||
|
||||
b.Property<string>("Remarks")
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("remarks");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("type");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_payment_transactions");
|
||||
|
||||
b.HasIndex("PayeeWalletId")
|
||||
.HasDatabaseName("ix_payment_transactions_payee_wallet_id");
|
||||
|
||||
b.HasIndex("PayerWalletId")
|
||||
.HasDatabaseName("ix_payment_transactions_payer_wallet_id");
|
||||
|
||||
b.ToTable("payment_transactions", (string)null);
|
||||
});
|
||||
|
||||
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.Navigation("Fund");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletGift", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Shared.Models.SnWalletCoupon", "Coupon")
|
||||
.WithMany()
|
||||
.HasForeignKey("CouponId")
|
||||
.HasConstraintName("fk_wallet_gifts_wallet_coupons_coupon_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("Subscription");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletOrder", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Shared.Models.SnWallet", "PayeeWallet")
|
||||
.WithMany()
|
||||
.HasForeignKey("PayeeWalletId")
|
||||
.HasConstraintName("fk_payment_orders_wallets_payee_wallet_id");
|
||||
|
||||
b.HasOne("DysonNetwork.Shared.Models.SnWalletTransaction", "Transaction")
|
||||
.WithMany()
|
||||
.HasForeignKey("TransactionId")
|
||||
.HasConstraintName("fk_payment_orders_payment_transactions_transaction_id");
|
||||
|
||||
b.Navigation("PayeeWallet");
|
||||
|
||||
b.Navigation("Transaction");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletPocket", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Shared.Models.SnWallet", "Wallet")
|
||||
.WithMany("Pockets")
|
||||
.HasForeignKey("WalletId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_wallet_pockets_wallets_wallet_id");
|
||||
|
||||
b.Navigation("Wallet");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletSubscription", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Shared.Models.SnWalletCoupon", "Coupon")
|
||||
.WithMany()
|
||||
.HasForeignKey("CouponId")
|
||||
.HasConstraintName("fk_wallet_subscriptions_wallet_coupons_coupon_id");
|
||||
|
||||
b.Navigation("Coupon");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletTransaction", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Shared.Models.SnWallet", "PayeeWallet")
|
||||
.WithMany()
|
||||
.HasForeignKey("PayeeWalletId")
|
||||
.HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id");
|
||||
|
||||
b.HasOne("DysonNetwork.Shared.Models.SnWallet", "PayerWallet")
|
||||
.WithMany()
|
||||
.HasForeignKey("PayerWalletId")
|
||||
.HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id");
|
||||
|
||||
b.Navigation("PayeeWallet");
|
||||
|
||||
b.Navigation("PayerWallet");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWallet", b =>
|
||||
{
|
||||
b.Navigation("Pockets");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletFund", b =>
|
||||
{
|
||||
b.Navigation("Recipients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletSubscription", b =>
|
||||
{
|
||||
b.Navigation("Gift");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,426 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DysonNetwork.Shared.Models;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using NodaTime;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DysonNetwork.Wallet.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitialMigration : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "lotteries",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
account_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
region_one_numbers = table.Column<string>(type: "jsonb", nullable: false),
|
||||
region_two_number = table.Column<int>(type: "integer", nullable: false),
|
||||
multiplier = table.Column<int>(type: "integer", nullable: false),
|
||||
draw_status = table.Column<int>(type: "integer", nullable: false),
|
||||
draw_date = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
|
||||
matched_region_one_numbers = table.Column<string>(type: "jsonb", nullable: true),
|
||||
matched_region_two_number = table.Column<int>(type: "integer", 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_lotteries", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "lottery_records",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
draw_date = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
winning_region_one_numbers = table.Column<string>(type: "jsonb", nullable: false),
|
||||
winning_region_two_number = table.Column<int>(type: "integer", nullable: false),
|
||||
total_tickets = table.Column<int>(type: "integer", nullable: false),
|
||||
total_prizes_awarded = table.Column<int>(type: "integer", nullable: false),
|
||||
total_prize_amount = table.Column<long>(type: "bigint", 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_lottery_records", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "wallet_coupons",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
identifier = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
|
||||
code = table.Column<string>(type: "character varying(1024)", maxLength: 1024, nullable: true),
|
||||
affected_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
|
||||
expired_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
|
||||
discount_amount = table.Column<decimal>(type: "numeric", nullable: true),
|
||||
discount_rate = table.Column<double>(type: "double precision", nullable: true),
|
||||
max_usage = table.Column<int>(type: "integer", 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_coupons", x => x.id);
|
||||
});
|
||||
|
||||
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),
|
||||
remaining_amount = table.Column<decimal>(type: "numeric", nullable: false),
|
||||
amount_of_splits = table.Column<int>(type: "integer", 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),
|
||||
is_open = table.Column<bool>(type: "boolean", nullable: false),
|
||||
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);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "wallets",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
account_id = table.Column<Guid>(type: "uuid", 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_wallets", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "wallet_subscriptions",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
begun_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
ended_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
|
||||
identifier = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false),
|
||||
is_active = table.Column<bool>(type: "boolean", nullable: false),
|
||||
is_free_trial = table.Column<bool>(type: "boolean", nullable: false),
|
||||
status = table.Column<int>(type: "integer", nullable: false),
|
||||
payment_method = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false),
|
||||
payment_details = table.Column<SnPaymentDetails>(type: "jsonb", nullable: false),
|
||||
base_price = table.Column<decimal>(type: "numeric", nullable: false),
|
||||
coupon_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
renewal_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
|
||||
account_id = table.Column<Guid>(type: "uuid", 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_subscriptions", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_wallet_subscriptions_wallet_coupons_coupon_id",
|
||||
column: x => x.coupon_id,
|
||||
principalTable: "wallet_coupons",
|
||||
principalColumn: "id");
|
||||
});
|
||||
|
||||
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_wallet_funds_fund_id",
|
||||
column: x => x.fund_id,
|
||||
principalTable: "wallet_funds",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "payment_transactions",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
currency = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
||||
amount = table.Column<decimal>(type: "numeric", nullable: false),
|
||||
remarks = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
|
||||
type = table.Column<int>(type: "integer", nullable: false),
|
||||
payer_wallet_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
payee_wallet_id = table.Column<Guid>(type: "uuid", 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_payment_transactions", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_payment_transactions_wallets_payee_wallet_id",
|
||||
column: x => x.payee_wallet_id,
|
||||
principalTable: "wallets",
|
||||
principalColumn: "id");
|
||||
table.ForeignKey(
|
||||
name: "fk_payment_transactions_wallets_payer_wallet_id",
|
||||
column: x => x.payer_wallet_id,
|
||||
principalTable: "wallets",
|
||||
principalColumn: "id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "wallet_pockets",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
currency = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
||||
amount = table.Column<decimal>(type: "numeric", nullable: false),
|
||||
wallet_id = table.Column<Guid>(type: "uuid", 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_pockets", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_wallet_pockets_wallets_wallet_id",
|
||||
column: x => x.wallet_id,
|
||||
principalTable: "wallets",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "wallet_gifts",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
gifter_id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
recipient_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
gift_code = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
||||
message = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: true),
|
||||
subscription_identifier = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false),
|
||||
base_price = table.Column<decimal>(type: "numeric", nullable: false),
|
||||
final_price = table.Column<decimal>(type: "numeric", nullable: false),
|
||||
status = table.Column<int>(type: "integer", nullable: false),
|
||||
redeemed_at = table.Column<Instant>(type: "timestamp with time zone", nullable: true),
|
||||
redeemer_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
subscription_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
expires_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
is_open_gift = table.Column<bool>(type: "boolean", nullable: false),
|
||||
payment_method = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: false),
|
||||
payment_details = table.Column<SnPaymentDetails>(type: "jsonb", nullable: false),
|
||||
coupon_id = table.Column<Guid>(type: "uuid", 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_gifts", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_wallet_gifts_wallet_coupons_coupon_id",
|
||||
column: x => x.coupon_id,
|
||||
principalTable: "wallet_coupons",
|
||||
principalColumn: "id");
|
||||
table.ForeignKey(
|
||||
name: "fk_wallet_gifts_wallet_subscriptions_subscription_id",
|
||||
column: x => x.subscription_id,
|
||||
principalTable: "wallet_subscriptions",
|
||||
principalColumn: "id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "payment_orders",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
status = table.Column<int>(type: "integer", nullable: false),
|
||||
currency = table.Column<string>(type: "character varying(128)", maxLength: 128, nullable: false),
|
||||
remarks = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
|
||||
app_identifier = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
|
||||
product_identifier = table.Column<string>(type: "character varying(4096)", maxLength: 4096, nullable: true),
|
||||
meta = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: true),
|
||||
amount = table.Column<decimal>(type: "numeric", nullable: false),
|
||||
expired_at = table.Column<Instant>(type: "timestamp with time zone", nullable: false),
|
||||
payee_wallet_id = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
transaction_id = table.Column<Guid>(type: "uuid", 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_payment_orders", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_payment_orders_payment_transactions_transaction_id",
|
||||
column: x => x.transaction_id,
|
||||
principalTable: "payment_transactions",
|
||||
principalColumn: "id");
|
||||
table.ForeignKey(
|
||||
name: "fk_payment_orders_wallets_payee_wallet_id",
|
||||
column: x => x.payee_wallet_id,
|
||||
principalTable: "wallets",
|
||||
principalColumn: "id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_payment_orders_payee_wallet_id",
|
||||
table: "payment_orders",
|
||||
column: "payee_wallet_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_payment_orders_transaction_id",
|
||||
table: "payment_orders",
|
||||
column: "transaction_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_payment_transactions_payee_wallet_id",
|
||||
table: "payment_transactions",
|
||||
column: "payee_wallet_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_payment_transactions_payer_wallet_id",
|
||||
table: "payment_transactions",
|
||||
column: "payer_wallet_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_wallet_fund_recipients_fund_id",
|
||||
table: "wallet_fund_recipients",
|
||||
column: "fund_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_wallet_gifts_coupon_id",
|
||||
table: "wallet_gifts",
|
||||
column: "coupon_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_wallet_gifts_gift_code",
|
||||
table: "wallet_gifts",
|
||||
column: "gift_code");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_wallet_gifts_gifter_id",
|
||||
table: "wallet_gifts",
|
||||
column: "gifter_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_wallet_gifts_recipient_id",
|
||||
table: "wallet_gifts",
|
||||
column: "recipient_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_wallet_gifts_subscription_id",
|
||||
table: "wallet_gifts",
|
||||
column: "subscription_id",
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_wallet_pockets_wallet_id",
|
||||
table: "wallet_pockets",
|
||||
column: "wallet_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_wallet_subscriptions_account_id",
|
||||
table: "wallet_subscriptions",
|
||||
column: "account_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_wallet_subscriptions_account_id_identifier",
|
||||
table: "wallet_subscriptions",
|
||||
columns: new[] { "account_id", "identifier" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_wallet_subscriptions_account_id_is_active",
|
||||
table: "wallet_subscriptions",
|
||||
columns: new[] { "account_id", "is_active" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_wallet_subscriptions_coupon_id",
|
||||
table: "wallet_subscriptions",
|
||||
column: "coupon_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_wallet_subscriptions_identifier",
|
||||
table: "wallet_subscriptions",
|
||||
column: "identifier");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_wallet_subscriptions_status",
|
||||
table: "wallet_subscriptions",
|
||||
column: "status");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "lotteries");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "lottery_records");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "payment_orders");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "wallet_fund_recipients");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "wallet_gifts");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "wallet_pockets");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "payment_transactions");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "wallet_funds");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "wallet_subscriptions");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "wallets");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "wallet_coupons");
|
||||
}
|
||||
}
|
||||
}
|
||||
823
DysonNetwork.Wallet/Migrations/AppDatabaseModelSnapshot.cs
Normal file
823
DysonNetwork.Wallet/Migrations/AppDatabaseModelSnapshot.cs
Normal file
@@ -0,0 +1,823 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DysonNetwork.Shared.Models;
|
||||
using DysonNetwork.Wallet;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using NodaTime;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DysonNetwork.Wallet.Migrations
|
||||
{
|
||||
[DbContext(typeof(AppDatabase))]
|
||||
partial class AppDatabaseModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "10.0.2")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnLottery", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<Guid>("AccountId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("account_id");
|
||||
|
||||
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<Instant?>("DrawDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("draw_date");
|
||||
|
||||
b.Property<int>("DrawStatus")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("draw_status");
|
||||
|
||||
b.PrimitiveCollection<string>("MatchedRegionOneNumbers")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("matched_region_one_numbers");
|
||||
|
||||
b.Property<int?>("MatchedRegionTwoNumber")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("matched_region_two_number");
|
||||
|
||||
b.Property<int>("Multiplier")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("multiplier");
|
||||
|
||||
b.PrimitiveCollection<string>("RegionOneNumbers")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("region_one_numbers");
|
||||
|
||||
b.Property<int>("RegionTwoNumber")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("region_two_number");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_lotteries");
|
||||
|
||||
b.ToTable("lotteries", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnLotteryRecord", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
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<Instant>("DrawDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("draw_date");
|
||||
|
||||
b.Property<long>("TotalPrizeAmount")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("total_prize_amount");
|
||||
|
||||
b.Property<int>("TotalPrizesAwarded")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("total_prizes_awarded");
|
||||
|
||||
b.Property<int>("TotalTickets")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("total_tickets");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.PrimitiveCollection<string>("WinningRegionOneNumbers")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("winning_region_one_numbers");
|
||||
|
||||
b.Property<int>("WinningRegionTwoNumber")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("winning_region_two_number");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_lottery_records");
|
||||
|
||||
b.ToTable("lottery_records", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWallet", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<Guid>("AccountId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("account_id");
|
||||
|
||||
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<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_wallets");
|
||||
|
||||
b.ToTable("wallets", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletCoupon", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<Instant?>("AffectedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("affected_at");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.HasMaxLength(1024)
|
||||
.HasColumnType("character varying(1024)")
|
||||
.HasColumnName("code");
|
||||
|
||||
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<decimal?>("DiscountAmount")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("discount_amount");
|
||||
|
||||
b.Property<double?>("DiscountRate")
|
||||
.HasColumnType("double precision")
|
||||
.HasColumnName("discount_rate");
|
||||
|
||||
b.Property<Instant?>("ExpiredAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("expired_at");
|
||||
|
||||
b.Property<string>("Identifier")
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("identifier");
|
||||
|
||||
b.Property<int?>("MaxUsage")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("max_usage");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_wallet_coupons");
|
||||
|
||||
b.ToTable("wallet_coupons", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletFund", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<int>("AmountOfSplits")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("amount_of_splits");
|
||||
|
||||
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<bool>("IsOpen")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_open");
|
||||
|
||||
b.Property<string>("Message")
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("message");
|
||||
|
||||
b.Property<decimal>("RemainingAmount")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("remaining_amount");
|
||||
|
||||
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.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.ToTable("wallet_fund_recipients", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletGift", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<decimal>("BasePrice")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("base_price");
|
||||
|
||||
b.Property<Guid?>("CouponId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("coupon_id");
|
||||
|
||||
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<Instant>("ExpiresAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("expires_at");
|
||||
|
||||
b.Property<decimal>("FinalPrice")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("final_price");
|
||||
|
||||
b.Property<string>("GiftCode")
|
||||
.IsRequired()
|
||||
.HasMaxLength(128)
|
||||
.HasColumnType("character varying(128)")
|
||||
.HasColumnName("gift_code");
|
||||
|
||||
b.Property<Guid>("GifterId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("gifter_id");
|
||||
|
||||
b.Property<bool>("IsOpenGift")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_open_gift");
|
||||
|
||||
b.Property<string>("Message")
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnType("character varying(1000)")
|
||||
.HasColumnName("message");
|
||||
|
||||
b.Property<SnPaymentDetails>("PaymentDetails")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("payment_details");
|
||||
|
||||
b.Property<string>("PaymentMethod")
|
||||
.IsRequired()
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("payment_method");
|
||||
|
||||
b.Property<Guid?>("RecipientId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("recipient_id");
|
||||
|
||||
b.Property<Instant?>("RedeemedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("redeemed_at");
|
||||
|
||||
b.Property<Guid?>("RedeemerId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("redeemer_id");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<Guid?>("SubscriptionId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("subscription_id");
|
||||
|
||||
b.Property<string>("SubscriptionIdentifier")
|
||||
.IsRequired()
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("subscription_identifier");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_wallet_gifts");
|
||||
|
||||
b.HasIndex("CouponId")
|
||||
.HasDatabaseName("ix_wallet_gifts_coupon_id");
|
||||
|
||||
b.HasIndex("GiftCode")
|
||||
.HasDatabaseName("ix_wallet_gifts_gift_code");
|
||||
|
||||
b.HasIndex("GifterId")
|
||||
.HasDatabaseName("ix_wallet_gifts_gifter_id");
|
||||
|
||||
b.HasIndex("RecipientId")
|
||||
.HasDatabaseName("ix_wallet_gifts_recipient_id");
|
||||
|
||||
b.HasIndex("SubscriptionId")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_wallet_gifts_subscription_id");
|
||||
|
||||
b.ToTable("wallet_gifts", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletOrder", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<decimal>("Amount")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("amount");
|
||||
|
||||
b.Property<string>("AppIdentifier")
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("app_identifier");
|
||||
|
||||
b.Property<Instant>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("created_at");
|
||||
|
||||
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<Dictionary<string, object>>("Meta")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("meta");
|
||||
|
||||
b.Property<Guid?>("PayeeWalletId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("payee_wallet_id");
|
||||
|
||||
b.Property<string>("ProductIdentifier")
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("product_identifier");
|
||||
|
||||
b.Property<string>("Remarks")
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("remarks");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<Guid?>("TransactionId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("transaction_id");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_payment_orders");
|
||||
|
||||
b.HasIndex("PayeeWalletId")
|
||||
.HasDatabaseName("ix_payment_orders_payee_wallet_id");
|
||||
|
||||
b.HasIndex("TransactionId")
|
||||
.HasDatabaseName("ix_payment_orders_transaction_id");
|
||||
|
||||
b.ToTable("payment_orders", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletPocket", 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<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>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.Property<Guid>("WalletId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("wallet_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_wallet_pockets");
|
||||
|
||||
b.HasIndex("WalletId")
|
||||
.HasDatabaseName("ix_wallet_pockets_wallet_id");
|
||||
|
||||
b.ToTable("wallet_pockets", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletSubscription", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<Guid>("AccountId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("account_id");
|
||||
|
||||
b.Property<decimal>("BasePrice")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("base_price");
|
||||
|
||||
b.Property<Instant>("BegunAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("begun_at");
|
||||
|
||||
b.Property<Guid?>("CouponId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("coupon_id");
|
||||
|
||||
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<Instant?>("EndedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("ended_at");
|
||||
|
||||
b.Property<string>("Identifier")
|
||||
.IsRequired()
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("identifier");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_active");
|
||||
|
||||
b.Property<bool>("IsFreeTrial")
|
||||
.HasColumnType("boolean")
|
||||
.HasColumnName("is_free_trial");
|
||||
|
||||
b.Property<SnPaymentDetails>("PaymentDetails")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("payment_details");
|
||||
|
||||
b.Property<string>("PaymentMethod")
|
||||
.IsRequired()
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("payment_method");
|
||||
|
||||
b.Property<Instant?>("RenewalAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("renewal_at");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("status");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_wallet_subscriptions");
|
||||
|
||||
b.HasIndex("AccountId")
|
||||
.HasDatabaseName("ix_wallet_subscriptions_account_id");
|
||||
|
||||
b.HasIndex("CouponId")
|
||||
.HasDatabaseName("ix_wallet_subscriptions_coupon_id");
|
||||
|
||||
b.HasIndex("Identifier")
|
||||
.HasDatabaseName("ix_wallet_subscriptions_identifier");
|
||||
|
||||
b.HasIndex("Status")
|
||||
.HasDatabaseName("ix_wallet_subscriptions_status");
|
||||
|
||||
b.HasIndex("AccountId", "Identifier")
|
||||
.HasDatabaseName("ix_wallet_subscriptions_account_id_identifier");
|
||||
|
||||
b.HasIndex("AccountId", "IsActive")
|
||||
.HasDatabaseName("ix_wallet_subscriptions_account_id_is_active");
|
||||
|
||||
b.ToTable("wallet_subscriptions", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletTransaction", 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<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<Guid?>("PayeeWalletId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("payee_wallet_id");
|
||||
|
||||
b.Property<Guid?>("PayerWalletId")
|
||||
.HasColumnType("uuid")
|
||||
.HasColumnName("payer_wallet_id");
|
||||
|
||||
b.Property<string>("Remarks")
|
||||
.HasMaxLength(4096)
|
||||
.HasColumnType("character varying(4096)")
|
||||
.HasColumnName("remarks");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("type");
|
||||
|
||||
b.Property<Instant>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("updated_at");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_payment_transactions");
|
||||
|
||||
b.HasIndex("PayeeWalletId")
|
||||
.HasDatabaseName("ix_payment_transactions_payee_wallet_id");
|
||||
|
||||
b.HasIndex("PayerWalletId")
|
||||
.HasDatabaseName("ix_payment_transactions_payer_wallet_id");
|
||||
|
||||
b.ToTable("payment_transactions", (string)null);
|
||||
});
|
||||
|
||||
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.Navigation("Fund");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletGift", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Shared.Models.SnWalletCoupon", "Coupon")
|
||||
.WithMany()
|
||||
.HasForeignKey("CouponId")
|
||||
.HasConstraintName("fk_wallet_gifts_wallet_coupons_coupon_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("Subscription");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletOrder", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Shared.Models.SnWallet", "PayeeWallet")
|
||||
.WithMany()
|
||||
.HasForeignKey("PayeeWalletId")
|
||||
.HasConstraintName("fk_payment_orders_wallets_payee_wallet_id");
|
||||
|
||||
b.HasOne("DysonNetwork.Shared.Models.SnWalletTransaction", "Transaction")
|
||||
.WithMany()
|
||||
.HasForeignKey("TransactionId")
|
||||
.HasConstraintName("fk_payment_orders_payment_transactions_transaction_id");
|
||||
|
||||
b.Navigation("PayeeWallet");
|
||||
|
||||
b.Navigation("Transaction");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletPocket", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Shared.Models.SnWallet", "Wallet")
|
||||
.WithMany("Pockets")
|
||||
.HasForeignKey("WalletId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired()
|
||||
.HasConstraintName("fk_wallet_pockets_wallets_wallet_id");
|
||||
|
||||
b.Navigation("Wallet");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletSubscription", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Shared.Models.SnWalletCoupon", "Coupon")
|
||||
.WithMany()
|
||||
.HasForeignKey("CouponId")
|
||||
.HasConstraintName("fk_wallet_subscriptions_wallet_coupons_coupon_id");
|
||||
|
||||
b.Navigation("Coupon");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletTransaction", b =>
|
||||
{
|
||||
b.HasOne("DysonNetwork.Shared.Models.SnWallet", "PayeeWallet")
|
||||
.WithMany()
|
||||
.HasForeignKey("PayeeWalletId")
|
||||
.HasConstraintName("fk_payment_transactions_wallets_payee_wallet_id");
|
||||
|
||||
b.HasOne("DysonNetwork.Shared.Models.SnWallet", "PayerWallet")
|
||||
.WithMany()
|
||||
.HasForeignKey("PayerWalletId")
|
||||
.HasConstraintName("fk_payment_transactions_wallets_payer_wallet_id");
|
||||
|
||||
b.Navigation("PayeeWallet");
|
||||
|
||||
b.Navigation("PayerWallet");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWallet", b =>
|
||||
{
|
||||
b.Navigation("Pockets");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletFund", b =>
|
||||
{
|
||||
b.Navigation("Recipients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletSubscription", b =>
|
||||
{
|
||||
b.Navigation("Gift");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,11 +12,9 @@ namespace DysonNetwork.Wallet.Payment;
|
||||
public class OrderController(
|
||||
PaymentService payment,
|
||||
AppDatabase db,
|
||||
IGrpcClientFactory<CustomAppService.CustomAppServiceClient> customAppsFactory
|
||||
CustomAppService.CustomAppServiceClient customApps
|
||||
) : ControllerBase
|
||||
{
|
||||
private readonly CustomAppService.CustomAppServiceClient _customApps = customAppsFactory.CreateClient();
|
||||
|
||||
public class CreateOrderRequest
|
||||
{
|
||||
public string Currency { get; set; } = null!;
|
||||
@@ -33,11 +31,11 @@ public class OrderController(
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<SnWalletOrder>> CreateOrder([FromBody] CreateOrderRequest request)
|
||||
{
|
||||
var clientResp = await _customApps.GetCustomAppAsync(new GetCustomAppRequest { Slug = request.ClientId });
|
||||
var clientResp = await customApps.GetCustomAppAsync(new GetCustomAppRequest { Slug = request.ClientId });
|
||||
if (clientResp.App is null) return BadRequest("Client not found");
|
||||
var client = SnCustomApp.FromProtoValue(clientResp.App);
|
||||
|
||||
var secret = await _customApps.CheckCustomAppSecretAsync(new CheckCustomAppSecretRequest
|
||||
var secret = await customApps.CheckCustomAppSecretAsync(new CheckCustomAppSecretRequest
|
||||
{
|
||||
AppId = client.Id.ToString(),
|
||||
Secret = request.ClientSecret,
|
||||
@@ -107,11 +105,11 @@ public class OrderController(
|
||||
[HttpPatch("{id:guid}/status")]
|
||||
public async Task<ActionResult<SnWalletOrder>> UpdateOrderStatus(Guid id, [FromBody] UpdateOrderStatusRequest request)
|
||||
{
|
||||
var clientResp = await _customApps.GetCustomAppAsync(new GetCustomAppRequest { Slug = request.ClientId });
|
||||
var clientResp = await customApps.GetCustomAppAsync(new GetCustomAppRequest { Slug = request.ClientId });
|
||||
if (clientResp.App is null) return BadRequest("Client not found");
|
||||
var client = SnCustomApp.FromProtoValue(clientResp.App);
|
||||
|
||||
var secret = await _customApps.CheckCustomAppSecretAsync(new CheckCustomAppSecretRequest
|
||||
var secret = await customApps.CheckCustomAppSecretAsync(new CheckCustomAppSecretRequest
|
||||
{
|
||||
AppId = client.Id.ToString(),
|
||||
Secret = request.ClientSecret,
|
||||
|
||||
@@ -16,13 +16,11 @@ namespace DysonNetwork.Wallet.Payment;
|
||||
public class PaymentService(
|
||||
AppDatabase db,
|
||||
WalletService wat,
|
||||
IGrpcClientFactory<RingService.RingServiceClient> pusherFactory,
|
||||
RingService.RingServiceClient pusher,
|
||||
IStringLocalizer<NotificationResource> localizer,
|
||||
INatsConnection nats
|
||||
)
|
||||
{
|
||||
private readonly RingService.RingServiceClient _pusher = pusherFactory.CreateClient();
|
||||
|
||||
public async Task<SnWalletOrder> CreateOrderAsync(
|
||||
Guid? payeeWalletId,
|
||||
string currency,
|
||||
@@ -184,7 +182,7 @@ public class PaymentService(
|
||||
var readableTransactionId = transaction.Id.ToString().Replace("-", "")[..8];
|
||||
var readableTransactionRemark = transaction.Remarks ?? $"#{readableTransactionId}";
|
||||
|
||||
await _pusher.SendPushNotificationToUserAsync(
|
||||
await pusher.SendPushNotificationToUserAsync(
|
||||
new SendPushNotificationToUserRequest
|
||||
{
|
||||
UserId = payerWallet.AccountId.ToString(),
|
||||
@@ -211,7 +209,7 @@ public class PaymentService(
|
||||
var readableTransactionId = transaction.Id.ToString().Replace("-", "")[..8];
|
||||
var readableTransactionRemark = transaction.Remarks ?? $"#{readableTransactionId}";
|
||||
|
||||
await _pusher.SendPushNotificationToUserAsync(
|
||||
await pusher.SendPushNotificationToUserAsync(
|
||||
new SendPushNotificationToUserRequest
|
||||
{
|
||||
UserId = payeeWallet.AccountId.ToString(),
|
||||
@@ -315,7 +313,7 @@ public class PaymentService(
|
||||
var readableOrderRemark = order.Remarks ?? $"#{readableOrderId}";
|
||||
|
||||
|
||||
await _pusher.SendPushNotificationToUserAsync(
|
||||
await pusher.SendPushNotificationToUserAsync(
|
||||
new SendPushNotificationToUserRequest
|
||||
{
|
||||
UserId = payerWallet.AccountId.ToString(),
|
||||
@@ -338,7 +336,7 @@ public class PaymentService(
|
||||
var readableOrderId = order.Id.ToString().Replace("-", "")[..8];
|
||||
var readableOrderRemark = order.Remarks ?? $"#{readableOrderId}";
|
||||
|
||||
await _pusher.SendPushNotificationToUserAsync(
|
||||
await pusher.SendPushNotificationToUserAsync(
|
||||
new SendPushNotificationToUserRequest
|
||||
{
|
||||
UserId = payeeWallet.AccountId.ToString(),
|
||||
|
||||
@@ -17,17 +17,14 @@ namespace DysonNetwork.Wallet.Payment;
|
||||
public class SubscriptionService(
|
||||
AppDatabase db,
|
||||
PaymentService payment,
|
||||
IGrpcClientFactory<AccountService.AccountServiceClient> accountsFactory,
|
||||
IGrpcClientFactory<RingService.RingServiceClient> pusherFactory,
|
||||
AccountService.AccountServiceClient accounts,
|
||||
RingService.RingServiceClient pusher,
|
||||
IStringLocalizer<NotificationResource> localizer,
|
||||
IConfiguration configuration,
|
||||
ICacheService cache,
|
||||
ILogger<SubscriptionService> logger
|
||||
)
|
||||
{
|
||||
private readonly AccountService.AccountServiceClient _accounts = accountsFactory.CreateClient();
|
||||
private readonly RingService.RingServiceClient _pusher = pusherFactory.CreateClient();
|
||||
|
||||
public async Task<SnWalletSubscription> CreateSubscriptionAsync(
|
||||
SnAccount account,
|
||||
string identifier,
|
||||
@@ -141,14 +138,14 @@ public class SubscriptionService(
|
||||
// Use GetAccount instead of LookupAccountByConnection since that method may not exist
|
||||
if (Guid.TryParse(order.AccountId, out var accountId))
|
||||
{
|
||||
var accountProto = await _accounts.GetAccountAsync(new GetAccountRequest { Id = accountId.ToString() });
|
||||
var accountProto = await accounts.GetAccountAsync(new GetAccountRequest { Id = accountId.ToString() });
|
||||
if (accountProto != null)
|
||||
account = SnAccount.FromProtoValue(accountProto);
|
||||
}
|
||||
}
|
||||
else if (Guid.TryParse(order.AccountId, out var accountId))
|
||||
{
|
||||
var accountProto = await _accounts.GetAccountAsync(new GetAccountRequest { Id = accountId.ToString() });
|
||||
var accountProto = await accounts.GetAccountAsync(new GetAccountRequest { Id = accountId.ToString() });
|
||||
if (accountProto != null)
|
||||
account = SnAccount.FromProtoValue(accountProto);
|
||||
}
|
||||
@@ -433,7 +430,7 @@ public class SubscriptionService(
|
||||
}),
|
||||
IsSavable = true
|
||||
};
|
||||
await _pusher.SendPushNotificationToUserAsync(
|
||||
await pusher.SendPushNotificationToUserAsync(
|
||||
new SendPushNotificationToUserRequest
|
||||
{
|
||||
UserId = subscription.AccountId.ToString(),
|
||||
@@ -598,7 +595,7 @@ public class SubscriptionService(
|
||||
SnAccount? recipient = null;
|
||||
if (recipientId.HasValue)
|
||||
{
|
||||
var accountProto = await _accounts.GetAccountAsync(new GetAccountRequest { Id = recipientId.Value.ToString() });
|
||||
var accountProto = await accounts.GetAccountAsync(new GetAccountRequest { Id = recipientId.Value.ToString() });
|
||||
if (accountProto != null)
|
||||
recipient = SnAccount.FromProtoValue(accountProto);
|
||||
if (recipient is null)
|
||||
@@ -934,7 +931,7 @@ public class SubscriptionService(
|
||||
IsSavable = true
|
||||
};
|
||||
|
||||
await _pusher.SendPushNotificationToUserAsync(
|
||||
await pusher.SendPushNotificationToUserAsync(
|
||||
new SendPushNotificationToUserRequest
|
||||
{
|
||||
UserId = gifterId.ToString(),
|
||||
|
||||
@@ -13,11 +13,12 @@ builder.AddServiceDefaults();
|
||||
builder.ConfigureAppKestrel(builder.Configuration);
|
||||
|
||||
// Add application services
|
||||
builder.Services.AddAppServices(builder.Configuration);
|
||||
builder.Services.AddDysonAuth();
|
||||
builder.Services.AddAccountService();
|
||||
builder.Services.AddRingService();
|
||||
builder.Services.AddDriveService();
|
||||
builder.Services.AddDevelopService();
|
||||
builder.Services.AddAppServices(builder.Configuration);
|
||||
|
||||
builder.Services.AddAppFlushHandlers();
|
||||
builder.Services.AddAppBusinessServices(builder.Configuration);
|
||||
|
||||
Reference in New Issue
Block a user