🐛 Fix some issues in sepration of the Pass and Wallet service
This commit is contained in:
@@ -1,15 +1,18 @@
|
|||||||
namespace DysonNetwork.Drive.Storage;
|
namespace DysonNetwork.Drive.Storage;
|
||||||
|
|
||||||
public class FileReanalysisBackgroundService(FileReanalysisService reanalysisService, ILogger<FileReanalysisBackgroundService> logger, IConfiguration config) : BackgroundService
|
public class FileReanalysisBackgroundService(IServiceProvider srv, ILogger<FileReanalysisBackgroundService> logger, IConfiguration config) : BackgroundService
|
||||||
{
|
{
|
||||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
{
|
{
|
||||||
logger.LogInformation("File reanalysis background service started");
|
logger.LogInformation("File reanalysis background service started");
|
||||||
|
|
||||||
|
using var scope = srv.CreateScope();
|
||||||
|
|
||||||
while (!stoppingToken.IsCancellationRequested)
|
while (!stoppingToken.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
var reanalysisService = scope.ServiceProvider.GetRequiredService<FileReanalysisService>();
|
||||||
await reanalysisService.ProcessNextFileAsync();
|
await reanalysisService.ProcessNextFileAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using DysonNetwork.Shared.Cache;
|
|||||||
using DysonNetwork.Shared.Models;
|
using DysonNetwork.Shared.Models;
|
||||||
using DysonNetwork.Shared.Proto;
|
using DysonNetwork.Shared.Proto;
|
||||||
using DysonNetwork.Shared.Queue;
|
using DysonNetwork.Shared.Queue;
|
||||||
|
using DysonNetwork.Shared.Registry;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Localization;
|
using Microsoft.Extensions.Localization;
|
||||||
using NATS.Client.Core;
|
using NATS.Client.Core;
|
||||||
@@ -17,6 +18,7 @@ public class AccountEventService(
|
|||||||
IStringLocalizer<Localization.AccountEventResource> localizer,
|
IStringLocalizer<Localization.AccountEventResource> localizer,
|
||||||
RingService.RingServiceClient pusher,
|
RingService.RingServiceClient pusher,
|
||||||
Pass.Leveling.ExperienceService experienceService,
|
Pass.Leveling.ExperienceService experienceService,
|
||||||
|
RemotePaymentService payment,
|
||||||
INatsConnection nats
|
INatsConnection nats
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -70,21 +72,11 @@ public class AccountEventService(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool StatusesEqual(SnAccountStatus a, SnAccountStatus b)
|
|
||||||
{
|
|
||||||
return a.Attitude == b.Attitude &&
|
|
||||||
a.IsOnline == b.IsOnline &&
|
|
||||||
a.IsCustomized == b.IsCustomized &&
|
|
||||||
a.Label == b.Label &&
|
|
||||||
a.IsInvisible == b.IsInvisible &&
|
|
||||||
a.IsNotDisturb == b.IsNotDisturb;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<SnAccountStatus> GetStatus(Guid userId)
|
public async Task<SnAccountStatus> GetStatus(Guid userId)
|
||||||
{
|
{
|
||||||
var cacheKey = $"{StatusCacheKey}{userId}";
|
var cacheKey = $"{StatusCacheKey}{userId}";
|
||||||
var cachedStatus = await cache.GetAsync<SnAccountStatus>(cacheKey);
|
var cachedStatus = await cache.GetAsync<SnAccountStatus>(cacheKey);
|
||||||
SnAccountStatus status;
|
SnAccountStatus? status;
|
||||||
if (cachedStatus is not null)
|
if (cachedStatus is not null)
|
||||||
{
|
{
|
||||||
cachedStatus!.IsOnline = !cachedStatus.IsInvisible && await GetAccountIsConnected(userId);
|
cachedStatus!.IsOnline = !cachedStatus.IsInvisible && await GetAccountIsConnected(userId);
|
||||||
@@ -360,7 +352,7 @@ public class AccountEventService(
|
|||||||
// Skip random logic and tips generation for birthday
|
// Skip random logic and tips generation for birthday
|
||||||
checkInLevel = CheckInResultLevel.Special;
|
checkInLevel = CheckInResultLevel.Special;
|
||||||
tips = [
|
tips = [
|
||||||
new CheckInFortuneTip()
|
new CheckInFortuneTip
|
||||||
{
|
{
|
||||||
IsPositive = true,
|
IsPositive = true,
|
||||||
Title = localizer["FortuneTipSpecialTitle_Birthday"].Value,
|
Title = localizer["FortuneTipSpecialTitle_Birthday"].Value,
|
||||||
@@ -420,6 +412,22 @@ public class AccountEventService(
|
|||||||
CreatedAt = backdated ?? SystemClock.Instance.GetCurrentInstant(),
|
CreatedAt = backdated ?? SystemClock.Instance.GetCurrentInstant(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (result.RewardPoints.HasValue)
|
||||||
|
await payment.CreateTransactionWithAccount(
|
||||||
|
null,
|
||||||
|
user.Id.ToString(),
|
||||||
|
WalletCurrency.SourcePoint,
|
||||||
|
result.RewardPoints.Value.ToString(CultureInfo.InvariantCulture),
|
||||||
|
$"Check-in reward on {now:yyyy/MM/dd}"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
result.RewardPoints = null;
|
||||||
|
}
|
||||||
|
|
||||||
db.AccountCheckInResults.Add(result);
|
db.AccountCheckInResults.Add(result);
|
||||||
await db.SaveChangesAsync(); // Remember to save changes to the database
|
await db.SaveChangesAsync(); // Remember to save changes to the database
|
||||||
if (result.RewardExperience is not null)
|
if (result.RewardExperience is not null)
|
||||||
|
|||||||
2856
DysonNetwork.Pass/Migrations/20260203153052_PendingWalletRemoval.Designer.cs
generated
Normal file
2856
DysonNetwork.Pass/Migrations/20260203153052_PendingWalletRemoval.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,157 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace DysonNetwork.Pass.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class PendingWalletRemoval : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "fk_lotteries_accounts_account_id",
|
||||||
|
table: "lotteries");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "fk_wallet_fund_recipients_accounts_recipient_account_id",
|
||||||
|
table: "wallet_fund_recipients");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "fk_wallet_funds_accounts_creator_account_id",
|
||||||
|
table: "wallet_funds");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "fk_wallet_gifts_accounts_gifter_id",
|
||||||
|
table: "wallet_gifts");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "fk_wallet_gifts_accounts_recipient_id",
|
||||||
|
table: "wallet_gifts");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "fk_wallet_gifts_accounts_redeemer_id",
|
||||||
|
table: "wallet_gifts");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "fk_wallet_subscriptions_accounts_account_id",
|
||||||
|
table: "wallet_subscriptions");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "fk_wallets_accounts_account_id",
|
||||||
|
table: "wallets");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "ix_wallets_account_id",
|
||||||
|
table: "wallets");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "ix_wallet_gifts_redeemer_id",
|
||||||
|
table: "wallet_gifts");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "ix_wallet_funds_creator_account_id",
|
||||||
|
table: "wallet_funds");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "ix_wallet_fund_recipients_recipient_account_id",
|
||||||
|
table: "wallet_fund_recipients");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "ix_lotteries_account_id",
|
||||||
|
table: "lotteries");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "ix_wallets_account_id",
|
||||||
|
table: "wallets",
|
||||||
|
column: "account_id");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "ix_wallet_gifts_redeemer_id",
|
||||||
|
table: "wallet_gifts",
|
||||||
|
column: "redeemer_id");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "ix_wallet_funds_creator_account_id",
|
||||||
|
table: "wallet_funds",
|
||||||
|
column: "creator_account_id");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "ix_wallet_fund_recipients_recipient_account_id",
|
||||||
|
table: "wallet_fund_recipients",
|
||||||
|
column: "recipient_account_id");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "ix_lotteries_account_id",
|
||||||
|
table: "lotteries",
|
||||||
|
column: "account_id");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "fk_lotteries_accounts_account_id",
|
||||||
|
table: "lotteries",
|
||||||
|
column: "account_id",
|
||||||
|
principalTable: "accounts",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "fk_wallet_fund_recipients_accounts_recipient_account_id",
|
||||||
|
table: "wallet_fund_recipients",
|
||||||
|
column: "recipient_account_id",
|
||||||
|
principalTable: "accounts",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "fk_wallet_funds_accounts_creator_account_id",
|
||||||
|
table: "wallet_funds",
|
||||||
|
column: "creator_account_id",
|
||||||
|
principalTable: "accounts",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "fk_wallet_gifts_accounts_gifter_id",
|
||||||
|
table: "wallet_gifts",
|
||||||
|
column: "gifter_id",
|
||||||
|
principalTable: "accounts",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "fk_wallet_gifts_accounts_recipient_id",
|
||||||
|
table: "wallet_gifts",
|
||||||
|
column: "recipient_id",
|
||||||
|
principalTable: "accounts",
|
||||||
|
principalColumn: "id");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "fk_wallet_gifts_accounts_redeemer_id",
|
||||||
|
table: "wallet_gifts",
|
||||||
|
column: "redeemer_id",
|
||||||
|
principalTable: "accounts",
|
||||||
|
principalColumn: "id");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "fk_wallet_subscriptions_accounts_account_id",
|
||||||
|
table: "wallet_subscriptions",
|
||||||
|
column: "account_id",
|
||||||
|
principalTable: "accounts",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "fk_wallets_accounts_account_id",
|
||||||
|
table: "wallets",
|
||||||
|
column: "account_id",
|
||||||
|
principalTable: "accounts",
|
||||||
|
principalColumn: "id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@ namespace DysonNetwork.Pass.Migrations
|
|||||||
{
|
{
|
||||||
#pragma warning disable 612, 618
|
#pragma warning disable 612, 618
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.HasAnnotation("ProductVersion", "9.0.11")
|
.HasAnnotation("ProductVersion", "10.0.2")
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
@@ -507,7 +507,7 @@ namespace DysonNetwork.Pass.Migrations
|
|||||||
.HasColumnType("uuid")
|
.HasColumnType("uuid")
|
||||||
.HasColumnName("account_id");
|
.HasColumnName("account_id");
|
||||||
|
|
||||||
b.Property<List<string>>("BlockedPermissions")
|
b.PrimitiveCollection<string>("BlockedPermissions")
|
||||||
.HasColumnType("jsonb")
|
.HasColumnType("jsonb")
|
||||||
.HasColumnName("blocked_permissions");
|
.HasColumnName("blocked_permissions");
|
||||||
|
|
||||||
@@ -865,12 +865,12 @@ namespace DysonNetwork.Pass.Migrations
|
|||||||
.HasColumnType("uuid")
|
.HasColumnType("uuid")
|
||||||
.HasColumnName("account_id");
|
.HasColumnName("account_id");
|
||||||
|
|
||||||
b.Property<List<string>>("Audiences")
|
b.PrimitiveCollection<string>("Audiences")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("jsonb")
|
.HasColumnType("jsonb")
|
||||||
.HasColumnName("audiences");
|
.HasColumnName("audiences");
|
||||||
|
|
||||||
b.Property<List<Guid>>("BlacklistFactors")
|
b.PrimitiveCollection<string>("BlacklistFactors")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("jsonb")
|
.HasColumnType("jsonb")
|
||||||
.HasColumnName("blacklist_factors");
|
.HasColumnName("blacklist_factors");
|
||||||
@@ -920,7 +920,7 @@ namespace DysonNetwork.Pass.Migrations
|
|||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("platform");
|
.HasColumnName("platform");
|
||||||
|
|
||||||
b.Property<List<string>>("Scopes")
|
b.PrimitiveCollection<string>("Scopes")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("jsonb")
|
.HasColumnType("jsonb")
|
||||||
.HasColumnName("scopes");
|
.HasColumnName("scopes");
|
||||||
@@ -1019,7 +1019,7 @@ namespace DysonNetwork.Pass.Migrations
|
|||||||
.HasColumnType("uuid")
|
.HasColumnType("uuid")
|
||||||
.HasColumnName("app_id");
|
.HasColumnName("app_id");
|
||||||
|
|
||||||
b.Property<List<string>>("Audiences")
|
b.PrimitiveCollection<string>("Audiences")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("jsonb")
|
.HasColumnType("jsonb")
|
||||||
.HasColumnName("audiences");
|
.HasColumnName("audiences");
|
||||||
@@ -1061,7 +1061,7 @@ namespace DysonNetwork.Pass.Migrations
|
|||||||
.HasColumnType("uuid")
|
.HasColumnType("uuid")
|
||||||
.HasColumnName("parent_session_id");
|
.HasColumnName("parent_session_id");
|
||||||
|
|
||||||
b.Property<List<string>>("Scopes")
|
b.PrimitiveCollection<string>("Scopes")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("jsonb")
|
.HasColumnType("jsonb")
|
||||||
.HasColumnName("scopes");
|
.HasColumnName("scopes");
|
||||||
@@ -1129,7 +1129,7 @@ namespace DysonNetwork.Pass.Migrations
|
|||||||
.HasColumnType("numeric")
|
.HasColumnType("numeric")
|
||||||
.HasColumnName("reward_points");
|
.HasColumnName("reward_points");
|
||||||
|
|
||||||
b.Property<ICollection<CheckInFortuneTip>>("Tips")
|
b.Property<List<CheckInFortuneTip>>("Tips")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("jsonb")
|
.HasColumnType("jsonb")
|
||||||
.HasColumnName("tips");
|
.HasColumnName("tips");
|
||||||
@@ -1226,7 +1226,7 @@ namespace DysonNetwork.Pass.Migrations
|
|||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("draw_status");
|
.HasColumnName("draw_status");
|
||||||
|
|
||||||
b.Property<List<int>>("MatchedRegionOneNumbers")
|
b.PrimitiveCollection<string>("MatchedRegionOneNumbers")
|
||||||
.HasColumnType("jsonb")
|
.HasColumnType("jsonb")
|
||||||
.HasColumnName("matched_region_one_numbers");
|
.HasColumnName("matched_region_one_numbers");
|
||||||
|
|
||||||
@@ -1238,7 +1238,7 @@ namespace DysonNetwork.Pass.Migrations
|
|||||||
.HasColumnType("integer")
|
.HasColumnType("integer")
|
||||||
.HasColumnName("multiplier");
|
.HasColumnName("multiplier");
|
||||||
|
|
||||||
b.Property<List<int>>("RegionOneNumbers")
|
b.PrimitiveCollection<string>("RegionOneNumbers")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("jsonb")
|
.HasColumnType("jsonb")
|
||||||
.HasColumnName("region_one_numbers");
|
.HasColumnName("region_one_numbers");
|
||||||
@@ -1254,9 +1254,6 @@ namespace DysonNetwork.Pass.Migrations
|
|||||||
b.HasKey("Id")
|
b.HasKey("Id")
|
||||||
.HasName("pk_lotteries");
|
.HasName("pk_lotteries");
|
||||||
|
|
||||||
b.HasIndex("AccountId")
|
|
||||||
.HasDatabaseName("ix_lotteries_account_id");
|
|
||||||
|
|
||||||
b.ToTable("lotteries", (string)null);
|
b.ToTable("lotteries", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1295,7 +1292,7 @@ namespace DysonNetwork.Pass.Migrations
|
|||||||
.HasColumnType("timestamp with time zone")
|
.HasColumnType("timestamp with time zone")
|
||||||
.HasColumnName("updated_at");
|
.HasColumnName("updated_at");
|
||||||
|
|
||||||
b.Property<List<int>>("WinningRegionOneNumbers")
|
b.PrimitiveCollection<string>("WinningRegionOneNumbers")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("jsonb")
|
.HasColumnType("jsonb")
|
||||||
.HasColumnName("winning_region_one_numbers");
|
.HasColumnName("winning_region_one_numbers");
|
||||||
@@ -1832,9 +1829,6 @@ namespace DysonNetwork.Pass.Migrations
|
|||||||
b.HasKey("Id")
|
b.HasKey("Id")
|
||||||
.HasName("pk_wallets");
|
.HasName("pk_wallets");
|
||||||
|
|
||||||
b.HasIndex("AccountId")
|
|
||||||
.HasDatabaseName("ix_wallets_account_id");
|
|
||||||
|
|
||||||
b.ToTable("wallets", (string)null);
|
b.ToTable("wallets", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1958,9 +1952,6 @@ namespace DysonNetwork.Pass.Migrations
|
|||||||
b.HasKey("Id")
|
b.HasKey("Id")
|
||||||
.HasName("pk_wallet_funds");
|
.HasName("pk_wallet_funds");
|
||||||
|
|
||||||
b.HasIndex("CreatorAccountId")
|
|
||||||
.HasDatabaseName("ix_wallet_funds_creator_account_id");
|
|
||||||
|
|
||||||
b.ToTable("wallet_funds", (string)null);
|
b.ToTable("wallet_funds", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -2009,9 +2000,6 @@ namespace DysonNetwork.Pass.Migrations
|
|||||||
b.HasIndex("FundId")
|
b.HasIndex("FundId")
|
||||||
.HasDatabaseName("ix_wallet_fund_recipients_fund_id");
|
.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);
|
b.ToTable("wallet_fund_recipients", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -2121,9 +2109,6 @@ namespace DysonNetwork.Pass.Migrations
|
|||||||
b.HasIndex("RecipientId")
|
b.HasIndex("RecipientId")
|
||||||
.HasDatabaseName("ix_wallet_gifts_recipient_id");
|
.HasDatabaseName("ix_wallet_gifts_recipient_id");
|
||||||
|
|
||||||
b.HasIndex("RedeemerId")
|
|
||||||
.HasDatabaseName("ix_wallet_gifts_redeemer_id");
|
|
||||||
|
|
||||||
b.HasIndex("SubscriptionId")
|
b.HasIndex("SubscriptionId")
|
||||||
.IsUnique()
|
.IsUnique()
|
||||||
.HasDatabaseName("ix_wallet_gifts_subscription_id");
|
.HasDatabaseName("ix_wallet_gifts_subscription_id");
|
||||||
@@ -2649,18 +2634,6 @@ namespace DysonNetwork.Pass.Migrations
|
|||||||
b.Navigation("Account");
|
b.Navigation("Account");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnLottery", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("DysonNetwork.Shared.Models.SnAccount", "Account")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("AccountId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired()
|
|
||||||
.HasConstraintName("fk_lotteries_accounts_account_id");
|
|
||||||
|
|
||||||
b.Navigation("Account");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnMagicSpell", b =>
|
modelBuilder.Entity("DysonNetwork.Shared.Models.SnMagicSpell", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("DysonNetwork.Shared.Models.SnAccount", "Account")
|
b.HasOne("DysonNetwork.Shared.Models.SnAccount", "Account")
|
||||||
@@ -2741,30 +2714,6 @@ namespace DysonNetwork.Pass.Migrations
|
|||||||
b.Navigation("Account");
|
b.Navigation("Account");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWallet", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("DysonNetwork.Shared.Models.SnAccount", "Account")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("AccountId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired()
|
|
||||||
.HasConstraintName("fk_wallets_accounts_account_id");
|
|
||||||
|
|
||||||
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 =>
|
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletFundRecipient", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("DysonNetwork.Shared.Models.SnWalletFund", "Fund")
|
b.HasOne("DysonNetwork.Shared.Models.SnWalletFund", "Fund")
|
||||||
@@ -2774,16 +2723,7 @@ namespace DysonNetwork.Pass.Migrations
|
|||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasConstraintName("fk_wallet_fund_recipients_wallet_funds_fund_id");
|
.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("Fund");
|
||||||
|
|
||||||
b.Navigation("RecipientAccount");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletGift", b =>
|
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletGift", b =>
|
||||||
@@ -2793,23 +2733,6 @@ namespace DysonNetwork.Pass.Migrations
|
|||||||
.HasForeignKey("CouponId")
|
.HasForeignKey("CouponId")
|
||||||
.HasConstraintName("fk_wallet_gifts_wallet_coupons_coupon_id");
|
.HasConstraintName("fk_wallet_gifts_wallet_coupons_coupon_id");
|
||||||
|
|
||||||
b.HasOne("DysonNetwork.Shared.Models.SnAccount", "Gifter")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("GifterId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired()
|
|
||||||
.HasConstraintName("fk_wallet_gifts_accounts_gifter_id");
|
|
||||||
|
|
||||||
b.HasOne("DysonNetwork.Shared.Models.SnAccount", "Recipient")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("RecipientId")
|
|
||||||
.HasConstraintName("fk_wallet_gifts_accounts_recipient_id");
|
|
||||||
|
|
||||||
b.HasOne("DysonNetwork.Shared.Models.SnAccount", "Redeemer")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("RedeemerId")
|
|
||||||
.HasConstraintName("fk_wallet_gifts_accounts_redeemer_id");
|
|
||||||
|
|
||||||
b.HasOne("DysonNetwork.Shared.Models.SnWalletSubscription", "Subscription")
|
b.HasOne("DysonNetwork.Shared.Models.SnWalletSubscription", "Subscription")
|
||||||
.WithOne("Gift")
|
.WithOne("Gift")
|
||||||
.HasForeignKey("DysonNetwork.Shared.Models.SnWalletGift", "SubscriptionId")
|
.HasForeignKey("DysonNetwork.Shared.Models.SnWalletGift", "SubscriptionId")
|
||||||
@@ -2817,12 +2740,6 @@ namespace DysonNetwork.Pass.Migrations
|
|||||||
|
|
||||||
b.Navigation("Coupon");
|
b.Navigation("Coupon");
|
||||||
|
|
||||||
b.Navigation("Gifter");
|
|
||||||
|
|
||||||
b.Navigation("Recipient");
|
|
||||||
|
|
||||||
b.Navigation("Redeemer");
|
|
||||||
|
|
||||||
b.Navigation("Subscription");
|
b.Navigation("Subscription");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -2857,20 +2774,11 @@ namespace DysonNetwork.Pass.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletSubscription", b =>
|
modelBuilder.Entity("DysonNetwork.Shared.Models.SnWalletSubscription", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("DysonNetwork.Shared.Models.SnAccount", "Account")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("AccountId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired()
|
|
||||||
.HasConstraintName("fk_wallet_subscriptions_accounts_account_id");
|
|
||||||
|
|
||||||
b.HasOne("DysonNetwork.Shared.Models.SnWalletCoupon", "Coupon")
|
b.HasOne("DysonNetwork.Shared.Models.SnWalletCoupon", "Coupon")
|
||||||
.WithMany()
|
.WithMany()
|
||||||
.HasForeignKey("CouponId")
|
.HasForeignKey("CouponId")
|
||||||
.HasConstraintName("fk_wallet_subscriptions_wallet_coupons_coupon_id");
|
.HasConstraintName("fk_wallet_subscriptions_wallet_coupons_coupon_id");
|
||||||
|
|
||||||
b.Navigation("Account");
|
|
||||||
|
|
||||||
b.Navigation("Coupon");
|
b.Navigation("Coupon");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ builder.Services.AddAppAuthentication();
|
|||||||
builder.Services.AddRingService();
|
builder.Services.AddRingService();
|
||||||
builder.Services.AddDriveService();
|
builder.Services.AddDriveService();
|
||||||
builder.Services.AddDevelopService();
|
builder.Services.AddDevelopService();
|
||||||
|
builder.Services.AddWalletService();
|
||||||
|
|
||||||
builder.Services.AddAppFlushHandlers();
|
builder.Services.AddAppFlushHandlers();
|
||||||
builder.Services.AddAppBusinessServices(builder.Configuration);
|
builder.Services.AddAppBusinessServices(builder.Configuration);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class SnLottery : ModelBase
|
|||||||
{
|
{
|
||||||
public Guid Id { get; init; } = Guid.NewGuid();
|
public Guid Id { get; init; } = Guid.NewGuid();
|
||||||
|
|
||||||
public SnAccount Account { get; init; } = null!;
|
[NotMapped] public SnAccount Account { get; init; } = null!;
|
||||||
public Guid AccountId { get; init; }
|
public Guid AccountId { get; init; }
|
||||||
|
|
||||||
[Column(TypeName = "jsonb")]
|
[Column(TypeName = "jsonb")]
|
||||||
|
|||||||
@@ -74,13 +74,13 @@ public class SnWalletGift : ModelBase
|
|||||||
/// The user who purchased/gave the gift.
|
/// The user who purchased/gave the gift.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Guid GifterId { get; set; }
|
public Guid GifterId { get; set; }
|
||||||
public SnAccount Gifter { get; set; } = null!;
|
[NotMapped] public SnAccount Gifter { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The intended recipient. Null for open gifts that anyone can redeem.
|
/// The intended recipient. Null for open gifts that anyone can redeem.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Guid? RecipientId { get; set; }
|
public Guid? RecipientId { get; set; }
|
||||||
public SnAccount? Recipient { get; set; }
|
[NotMapped] public SnAccount? Recipient { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unique redemption code/link identifier for the gift.
|
/// Unique redemption code/link identifier for the gift.
|
||||||
@@ -124,7 +124,7 @@ public class SnWalletGift : ModelBase
|
|||||||
/// The user who redeemed the gift (if different from recipient).
|
/// The user who redeemed the gift (if different from recipient).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Guid? RedeemerId { get; set; }
|
public Guid? RedeemerId { get; set; }
|
||||||
public SnAccount? Redeemer { get; set; }
|
[NotMapped] public SnAccount? Redeemer { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The subscription created when the gift is redeemed.
|
/// The subscription created when the gift is redeemed.
|
||||||
@@ -331,7 +331,7 @@ public class SnWalletSubscription : ModelBase
|
|||||||
public Instant? RenewalAt { get; set; }
|
public Instant? RenewalAt { get; set; }
|
||||||
|
|
||||||
public Guid AccountId { get; set; }
|
public Guid AccountId { get; set; }
|
||||||
public SnAccount Account { get; set; } = null!;
|
[NotMapped] public SnAccount Account { get; set; } = null!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If this subscription was redeemed from a gift, this references the gift record.
|
/// If this subscription was redeemed from a gift, this references the gift record.
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using MessagePack;
|
using MessagePack;
|
||||||
@@ -14,7 +15,7 @@ public class SnWallet : ModelBase
|
|||||||
public List<SnWalletPocket> Pockets { get; set; } = new List<SnWalletPocket>();
|
public List<SnWalletPocket> Pockets { get; set; } = new List<SnWalletPocket>();
|
||||||
|
|
||||||
public Guid AccountId { get; set; }
|
public Guid AccountId { get; set; }
|
||||||
public SnAccount Account { get; set; } = null!;
|
[NotMapped] public SnAccount Account { get; set; } = null!;
|
||||||
|
|
||||||
public Proto.Wallet ToProtoValue()
|
public Proto.Wallet ToProtoValue()
|
||||||
{
|
{
|
||||||
@@ -95,7 +96,7 @@ public class SnWalletFund : ModelBase
|
|||||||
|
|
||||||
// Creator
|
// Creator
|
||||||
public Guid CreatorAccountId { get; set; }
|
public Guid CreatorAccountId { get; set; }
|
||||||
public SnAccount CreatorAccount { get; set; } = null!;
|
[NotMapped] public SnAccount CreatorAccount { get; set; } = null!;
|
||||||
|
|
||||||
// Recipients
|
// Recipients
|
||||||
public List<SnWalletFundRecipient> Recipients { get; set; } = new List<SnWalletFundRecipient>();
|
public List<SnWalletFundRecipient> Recipients { get; set; } = new List<SnWalletFundRecipient>();
|
||||||
@@ -139,7 +140,7 @@ public class SnWalletFundRecipient : ModelBase
|
|||||||
[JsonIgnore] public SnWalletFund Fund { get; set; } = null!;
|
[JsonIgnore] public SnWalletFund Fund { get; set; } = null!;
|
||||||
|
|
||||||
public Guid RecipientAccountId { get; set; }
|
public Guid RecipientAccountId { get; set; }
|
||||||
public SnAccount RecipientAccount { get; set; } = null!;
|
[NotMapped] public SnAccount RecipientAccount { get; set; } = null!;
|
||||||
|
|
||||||
public decimal Amount { get; set; }
|
public decimal Amount { get; set; }
|
||||||
public bool IsReceived { get; set; } = false;
|
public bool IsReceived { get; set; } = false;
|
||||||
|
|||||||
@@ -50,15 +50,7 @@ public class AppDatabase(
|
|||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
base.OnModelCreating(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();
|
modelBuilder.ApplySoftDeleteFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,10 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.2" />
|
<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" Version="3.15.1" />
|
||||||
<PackageReference Include="Quartz.AspNetCore" Version="3.15.1" />
|
<PackageReference Include="Quartz.AspNetCore" Version="3.15.1" />
|
||||||
<PackageReference Include="Quartz.Extensions.Hosting" 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(
|
public class OrderController(
|
||||||
PaymentService payment,
|
PaymentService payment,
|
||||||
AppDatabase db,
|
AppDatabase db,
|
||||||
IGrpcClientFactory<CustomAppService.CustomAppServiceClient> customAppsFactory
|
CustomAppService.CustomAppServiceClient customApps
|
||||||
) : ControllerBase
|
) : ControllerBase
|
||||||
{
|
{
|
||||||
private readonly CustomAppService.CustomAppServiceClient _customApps = customAppsFactory.CreateClient();
|
|
||||||
|
|
||||||
public class CreateOrderRequest
|
public class CreateOrderRequest
|
||||||
{
|
{
|
||||||
public string Currency { get; set; } = null!;
|
public string Currency { get; set; } = null!;
|
||||||
@@ -33,11 +31,11 @@ public class OrderController(
|
|||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<ActionResult<SnWalletOrder>> CreateOrder([FromBody] CreateOrderRequest request)
|
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");
|
if (clientResp.App is null) return BadRequest("Client not found");
|
||||||
var client = SnCustomApp.FromProtoValue(clientResp.App);
|
var client = SnCustomApp.FromProtoValue(clientResp.App);
|
||||||
|
|
||||||
var secret = await _customApps.CheckCustomAppSecretAsync(new CheckCustomAppSecretRequest
|
var secret = await customApps.CheckCustomAppSecretAsync(new CheckCustomAppSecretRequest
|
||||||
{
|
{
|
||||||
AppId = client.Id.ToString(),
|
AppId = client.Id.ToString(),
|
||||||
Secret = request.ClientSecret,
|
Secret = request.ClientSecret,
|
||||||
@@ -107,11 +105,11 @@ public class OrderController(
|
|||||||
[HttpPatch("{id:guid}/status")]
|
[HttpPatch("{id:guid}/status")]
|
||||||
public async Task<ActionResult<SnWalletOrder>> UpdateOrderStatus(Guid id, [FromBody] UpdateOrderStatusRequest request)
|
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");
|
if (clientResp.App is null) return BadRequest("Client not found");
|
||||||
var client = SnCustomApp.FromProtoValue(clientResp.App);
|
var client = SnCustomApp.FromProtoValue(clientResp.App);
|
||||||
|
|
||||||
var secret = await _customApps.CheckCustomAppSecretAsync(new CheckCustomAppSecretRequest
|
var secret = await customApps.CheckCustomAppSecretAsync(new CheckCustomAppSecretRequest
|
||||||
{
|
{
|
||||||
AppId = client.Id.ToString(),
|
AppId = client.Id.ToString(),
|
||||||
Secret = request.ClientSecret,
|
Secret = request.ClientSecret,
|
||||||
|
|||||||
@@ -16,13 +16,11 @@ namespace DysonNetwork.Wallet.Payment;
|
|||||||
public class PaymentService(
|
public class PaymentService(
|
||||||
AppDatabase db,
|
AppDatabase db,
|
||||||
WalletService wat,
|
WalletService wat,
|
||||||
IGrpcClientFactory<RingService.RingServiceClient> pusherFactory,
|
RingService.RingServiceClient pusher,
|
||||||
IStringLocalizer<NotificationResource> localizer,
|
IStringLocalizer<NotificationResource> localizer,
|
||||||
INatsConnection nats
|
INatsConnection nats
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
private readonly RingService.RingServiceClient _pusher = pusherFactory.CreateClient();
|
|
||||||
|
|
||||||
public async Task<SnWalletOrder> CreateOrderAsync(
|
public async Task<SnWalletOrder> CreateOrderAsync(
|
||||||
Guid? payeeWalletId,
|
Guid? payeeWalletId,
|
||||||
string currency,
|
string currency,
|
||||||
@@ -184,7 +182,7 @@ public class PaymentService(
|
|||||||
var readableTransactionId = transaction.Id.ToString().Replace("-", "")[..8];
|
var readableTransactionId = transaction.Id.ToString().Replace("-", "")[..8];
|
||||||
var readableTransactionRemark = transaction.Remarks ?? $"#{readableTransactionId}";
|
var readableTransactionRemark = transaction.Remarks ?? $"#{readableTransactionId}";
|
||||||
|
|
||||||
await _pusher.SendPushNotificationToUserAsync(
|
await pusher.SendPushNotificationToUserAsync(
|
||||||
new SendPushNotificationToUserRequest
|
new SendPushNotificationToUserRequest
|
||||||
{
|
{
|
||||||
UserId = payerWallet.AccountId.ToString(),
|
UserId = payerWallet.AccountId.ToString(),
|
||||||
@@ -211,7 +209,7 @@ public class PaymentService(
|
|||||||
var readableTransactionId = transaction.Id.ToString().Replace("-", "")[..8];
|
var readableTransactionId = transaction.Id.ToString().Replace("-", "")[..8];
|
||||||
var readableTransactionRemark = transaction.Remarks ?? $"#{readableTransactionId}";
|
var readableTransactionRemark = transaction.Remarks ?? $"#{readableTransactionId}";
|
||||||
|
|
||||||
await _pusher.SendPushNotificationToUserAsync(
|
await pusher.SendPushNotificationToUserAsync(
|
||||||
new SendPushNotificationToUserRequest
|
new SendPushNotificationToUserRequest
|
||||||
{
|
{
|
||||||
UserId = payeeWallet.AccountId.ToString(),
|
UserId = payeeWallet.AccountId.ToString(),
|
||||||
@@ -315,7 +313,7 @@ public class PaymentService(
|
|||||||
var readableOrderRemark = order.Remarks ?? $"#{readableOrderId}";
|
var readableOrderRemark = order.Remarks ?? $"#{readableOrderId}";
|
||||||
|
|
||||||
|
|
||||||
await _pusher.SendPushNotificationToUserAsync(
|
await pusher.SendPushNotificationToUserAsync(
|
||||||
new SendPushNotificationToUserRequest
|
new SendPushNotificationToUserRequest
|
||||||
{
|
{
|
||||||
UserId = payerWallet.AccountId.ToString(),
|
UserId = payerWallet.AccountId.ToString(),
|
||||||
@@ -338,7 +336,7 @@ public class PaymentService(
|
|||||||
var readableOrderId = order.Id.ToString().Replace("-", "")[..8];
|
var readableOrderId = order.Id.ToString().Replace("-", "")[..8];
|
||||||
var readableOrderRemark = order.Remarks ?? $"#{readableOrderId}";
|
var readableOrderRemark = order.Remarks ?? $"#{readableOrderId}";
|
||||||
|
|
||||||
await _pusher.SendPushNotificationToUserAsync(
|
await pusher.SendPushNotificationToUserAsync(
|
||||||
new SendPushNotificationToUserRequest
|
new SendPushNotificationToUserRequest
|
||||||
{
|
{
|
||||||
UserId = payeeWallet.AccountId.ToString(),
|
UserId = payeeWallet.AccountId.ToString(),
|
||||||
|
|||||||
@@ -17,17 +17,14 @@ namespace DysonNetwork.Wallet.Payment;
|
|||||||
public class SubscriptionService(
|
public class SubscriptionService(
|
||||||
AppDatabase db,
|
AppDatabase db,
|
||||||
PaymentService payment,
|
PaymentService payment,
|
||||||
IGrpcClientFactory<AccountService.AccountServiceClient> accountsFactory,
|
AccountService.AccountServiceClient accounts,
|
||||||
IGrpcClientFactory<RingService.RingServiceClient> pusherFactory,
|
RingService.RingServiceClient pusher,
|
||||||
IStringLocalizer<NotificationResource> localizer,
|
IStringLocalizer<NotificationResource> localizer,
|
||||||
IConfiguration configuration,
|
IConfiguration configuration,
|
||||||
ICacheService cache,
|
ICacheService cache,
|
||||||
ILogger<SubscriptionService> logger
|
ILogger<SubscriptionService> logger
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
private readonly AccountService.AccountServiceClient _accounts = accountsFactory.CreateClient();
|
|
||||||
private readonly RingService.RingServiceClient _pusher = pusherFactory.CreateClient();
|
|
||||||
|
|
||||||
public async Task<SnWalletSubscription> CreateSubscriptionAsync(
|
public async Task<SnWalletSubscription> CreateSubscriptionAsync(
|
||||||
SnAccount account,
|
SnAccount account,
|
||||||
string identifier,
|
string identifier,
|
||||||
@@ -141,14 +138,14 @@ public class SubscriptionService(
|
|||||||
// Use GetAccount instead of LookupAccountByConnection since that method may not exist
|
// Use GetAccount instead of LookupAccountByConnection since that method may not exist
|
||||||
if (Guid.TryParse(order.AccountId, out var accountId))
|
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)
|
if (accountProto != null)
|
||||||
account = SnAccount.FromProtoValue(accountProto);
|
account = SnAccount.FromProtoValue(accountProto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Guid.TryParse(order.AccountId, out var accountId))
|
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)
|
if (accountProto != null)
|
||||||
account = SnAccount.FromProtoValue(accountProto);
|
account = SnAccount.FromProtoValue(accountProto);
|
||||||
}
|
}
|
||||||
@@ -433,7 +430,7 @@ public class SubscriptionService(
|
|||||||
}),
|
}),
|
||||||
IsSavable = true
|
IsSavable = true
|
||||||
};
|
};
|
||||||
await _pusher.SendPushNotificationToUserAsync(
|
await pusher.SendPushNotificationToUserAsync(
|
||||||
new SendPushNotificationToUserRequest
|
new SendPushNotificationToUserRequest
|
||||||
{
|
{
|
||||||
UserId = subscription.AccountId.ToString(),
|
UserId = subscription.AccountId.ToString(),
|
||||||
@@ -598,7 +595,7 @@ public class SubscriptionService(
|
|||||||
SnAccount? recipient = null;
|
SnAccount? recipient = null;
|
||||||
if (recipientId.HasValue)
|
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)
|
if (accountProto != null)
|
||||||
recipient = SnAccount.FromProtoValue(accountProto);
|
recipient = SnAccount.FromProtoValue(accountProto);
|
||||||
if (recipient is null)
|
if (recipient is null)
|
||||||
@@ -934,7 +931,7 @@ public class SubscriptionService(
|
|||||||
IsSavable = true
|
IsSavable = true
|
||||||
};
|
};
|
||||||
|
|
||||||
await _pusher.SendPushNotificationToUserAsync(
|
await pusher.SendPushNotificationToUserAsync(
|
||||||
new SendPushNotificationToUserRequest
|
new SendPushNotificationToUserRequest
|
||||||
{
|
{
|
||||||
UserId = gifterId.ToString(),
|
UserId = gifterId.ToString(),
|
||||||
|
|||||||
@@ -13,11 +13,12 @@ builder.AddServiceDefaults();
|
|||||||
builder.ConfigureAppKestrel(builder.Configuration);
|
builder.ConfigureAppKestrel(builder.Configuration);
|
||||||
|
|
||||||
// Add application services
|
// Add application services
|
||||||
builder.Services.AddAppServices(builder.Configuration);
|
|
||||||
builder.Services.AddDysonAuth();
|
builder.Services.AddDysonAuth();
|
||||||
|
builder.Services.AddAccountService();
|
||||||
builder.Services.AddRingService();
|
builder.Services.AddRingService();
|
||||||
builder.Services.AddDriveService();
|
builder.Services.AddDriveService();
|
||||||
builder.Services.AddDevelopService();
|
builder.Services.AddDevelopService();
|
||||||
|
builder.Services.AddAppServices(builder.Configuration);
|
||||||
|
|
||||||
builder.Services.AddAppFlushHandlers();
|
builder.Services.AddAppFlushHandlers();
|
||||||
builder.Services.AddAppBusinessServices(builder.Configuration);
|
builder.Services.AddAppBusinessServices(builder.Configuration);
|
||||||
|
|||||||
Reference in New Issue
Block a user