초기커밋

This commit is contained in:
2025-05-01 07:20:41 +09:00
commit 98bb2e3c5c
2747 changed files with 646947 additions and 0 deletions

View File

@@ -0,0 +1,163 @@
namespace BrokerCore.DbEntity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
public class PlanetExchangeOrderConfig : IEntityTypeConfiguration<PlanetItemExchangeOrder>
{
public void Configure(EntityTypeBuilder<PlanetItemExchangeOrder> builder)
{
builder.ToTable("planet_item_exchange_order");
builder.HasIndex(o => o.CreatedAt);
builder.HasIndex(o => o.OrderStatus);
builder.HasIndex(o => o.PlanetId);
builder.HasIndex(o => o.SeasonId);
builder.HasIndex(o => o.AccountId);
builder.HasIndex(o => o.UserGuid);
// 기본 키 (Primary Key)
builder.HasKey(o => o.OrderId);
builder.Property(o => o.OrderId)
.HasColumnOrder(1)
.HasColumnName("order_id")
.HasMaxLength(50)
.IsRequired()
.HasComment("교환 주문 아이디 (GUID)");
// 주문 상태 (Enum)
builder.Property(o => o.OrderStatus)
.HasColumnOrder(2)
.HasColumnName("order_status")
.IsRequired()
.HasConversion<string>()
.HasMaxLength(50)
.HasComment("교환 주문 상태");
// 플래닛 ID (string)
builder.Property(o => o.PlanetId)
.HasColumnOrder(3)
.HasColumnName("planet_id")
.HasMaxLength(50)
.IsRequired()
.HasComment("플래닛 아이디");
// PlanetInfo와의 외래 키 관계 설정
builder.HasOne<PlanetInfo>()
.WithMany()
.HasForeignKey(o => o.PlanetId)
.OnDelete(DeleteBehavior.Restrict) // 삭제 동작 정책을 Restrict로 설정
.HasConstraintName("FK_PlanetExchangeOrder_PlanetInfo");
builder.Property(o => o.SeasonId)
.HasColumnOrder(4)
.HasColumnName("season_id")
.HasMaxLength(50)
.IsRequired()
.HasComment("시즌 아이디");
builder.Property(o => o.ExchangeMetaId)
.HasColumnOrder(5)
.HasColumnName("exchange_meta_id")
.HasMaxLength(50)
.IsRequired()
.HasComment("교환 메타 아이디");
builder.Property(o => o.ExchangeMetaAmount)
.HasColumnOrder(6)
.HasColumnName("exchange_meta_amount")
.HasColumnType("INT")
.IsRequired()
.HasComment("교환 메타 수량");
// 계정 ID (ulong)
builder.Property(o => o.AccountId)
.HasColumnOrder(7)
.HasColumnName("account_id")
.HasMaxLength(50)
.IsRequired()
.HasComment("SSO 아이디");
// 사용자 GUID (string)
builder.Property(o => o.UserGuid)
.HasColumnOrder(8)
.HasColumnName("user_guid")
.HasMaxLength(50)
.IsRequired()
.HasComment("유저 아이디 (GUID)");
// 사용자 닉네임 (string)
builder.Property(o => o.Nickname)
.HasColumnOrder(9)
.HasColumnName("nickname")
.HasMaxLength(50)
.IsRequired()
.HasComment("유저 닉네임");
// 칼리버스 아이템 타입 (Enum)
builder.Property(o => o.CaliverseItemType)
.HasColumnOrder(10)
.HasColumnName("caliverse_item_type")
.IsRequired()
.HasConversion<string>()
.HasMaxLength(50)
.HasComment("칼리버스 아이템 타입");
// 칼리버스 아이템 ID (string)
builder.Property(o => o.CaliverseItemId)
.HasColumnOrder(11)
.HasColumnName("caliverse_item_id")
.HasMaxLength(50)
.IsRequired()
.HasComment("칼리버스 아이템 아이디");
// 칼리버스 아이템 수량 (long)
builder.Property(o => o.CaliverseItemDeltaAmount)
.HasColumnOrder(12)
.HasColumnName("caliverse_item_quantity")
.HasColumnType("INT")
.IsRequired()
.HasComment("칼리버스 아이템 갯수");
// 플래닛 아이템 타입 (Enum)
builder.Property(o => o.PlanetItemType)
.HasColumnOrder(13)
.HasColumnName("planet_item_type")
.IsRequired()
.HasConversion<string>()
.HasMaxLength(50)
.HasComment("플래닛 아이템 타입");
// 플래닛 아이템 ID (string)
builder.Property(o => o.PlanetItemId)
.HasColumnOrder(14)
.HasColumnName("planet_item_id")
.HasMaxLength(50)
.IsRequired()
.HasComment("플래닛 아이템 아이디");
// 플래닛 아이템 수량 (long)
builder.Property(o => o.PlanetItemDeltaAmount)
.HasColumnOrder(15)
.HasColumnName("planet_item_quantity")
.HasColumnType("INT")
.IsRequired()
.HasComment("플래닛 아이템 갯수");
// 생성 시간 (TIMESTAMP)
builder.Property(o => o.CreatedAt)
.HasColumnOrder(16)
.HasColumnName("created_at")
.HasColumnType("TIMESTAMP")
.IsRequired()
.HasDefaultValueSql("CURRENT_TIMESTAMP")
.HasComment("교환 주문 시작 시간");
// 완료 시간 (TIMESTAMP?) - Nullable
builder.Property(o => o.CompletedAt)
.HasColumnOrder(17)
.HasColumnName("completed_at")
.HasColumnType("TIMESTAMP")
.IsRequired(false)
.HasComment("교환 주문 완료 시간");
}
}

View File

@@ -0,0 +1,56 @@
namespace BrokerCore.Repository.SqlConfig;
using DbEntity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
public class PlanetInfoConfig : IEntityTypeConfiguration<PlanetInfo>
{
public void Configure(EntityTypeBuilder<PlanetInfo> builder)
{
builder.ToTable("planet_info");
builder.HasKey(x => x.PlanetId);
builder.HasIndex(x => x.PlanetName);
builder.HasIndex(x => x.CompanyName);
builder.HasIndex(x => x.SecretKey);
builder.Property(x => x.PlanetId)
.IsRequired()
.HasColumnName("planet_id")
.HasColumnType("varchar(50)");
builder.Property(x => x.PlanetName)
.IsRequired()
.HasColumnName("planet_name")
.HasColumnType("varchar(32)");
builder.Property(x => x.CompanyName)
.IsRequired()
.HasColumnName("company_name")
.HasColumnType("varchar(32)");
builder.Property(x => x.SecretKey)
.IsRequired()
.HasColumnName("secret_key")
.HasColumnType("varchar(50)");
builder.Property(x => x.ServerType)
.IsRequired()
.HasColumnName("server_type")
.HasColumnType("varchar(50)");
builder.Property(x => x.Description)
.IsRequired()
.HasColumnName("description")
.HasColumnType("varchar(255)");
builder.Property(x => x.CreatedAt)
.HasColumnName("created_at")
.HasComment("생성 시간")
.HasColumnType("timestamp")
.IsRequired()
.HasDefaultValueSql("CURRENT_TIMESTAMP"); // MySQL 기본값
builder.Property(x => x.UpdatedAt)
.HasColumnName("updated_at")
.HasComment("수정 시간")
.HasColumnType("timestamp")
.IsRequired()
.HasDefaultValueSql("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); // MySQL 기본값
}
}

View File

@@ -0,0 +1,63 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace BrokerApiCore.Repository.SqlConfig;
using BrokerCore.DbEntity;
public class PlanetItemExchangeOrderAmountTotalLimitConfig : IEntityTypeConfiguration<PlanetItemExchangeOrderAmountTotalLimit>
{
public void Configure(EntityTypeBuilder<PlanetItemExchangeOrderAmountTotalLimit> builder)
{
// 테이블 이름
builder.ToTable("planet_exchange_order_amount_total_limits");
// 인덱스
builder.HasIndex(o => o.ExchangeDate);
builder.HasIndex(o => o.ExchangeMetaId);
builder.HasIndex(o => o.SeasonId);
// 복합 기본 키 (Primary Key) - ExchangeMetaId에 PlanetId 속성이 있으므로 생략함
builder.HasKey(o => new { o.ExchangeMetaId, o.ExchangeDate, o.SeasonId});
// 교환 메타 아이디
builder.Property(o => o.ExchangeMetaId)
.HasColumnName("exchange_meta_id")
.HasMaxLength(50)
.IsRequired()
.HasComment("교환 메타 아이디");
// 교환 일자
builder.Property(o => o.ExchangeDate)
.HasColumnName("exchange_date")
.IsRequired()
.HasComment("교환 일자");
// 교환 메타 수량
builder.Property(o => o.DailyAmount)
.HasColumnName("daily_amount")
.HasColumnType("INT")
.IsRequired()
.HasComment("일일 교환 메타 수량 합계");
builder.Property(o => o.SeasonId)
.HasColumnName("season_id")
.HasMaxLength(50)
.IsRequired()
.HasComment("시즌 아이디");
builder.Property(o => o.CreatedAt)
.HasColumnName("created_at")
.HasColumnType("TIMESTAMP")
.IsRequired()
.HasComment("생성 일자");
builder.Property(o => o.UpdatedAt)
.HasColumnName("updated_at")
.HasColumnType("TIMESTAMP")
.IsRequired()
.HasComment("업데이트 일자");
}
}

View File

@@ -0,0 +1,72 @@

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace BrokerApiCore.Repository.SqlConfig;
using BrokerCore.DbEntity;
public class PlanetItemExchangeOrderAmountUserLimitConfig : IEntityTypeConfiguration<PlanetItemExchangeOrderAmountUserLimit>
{
public void Configure(EntityTypeBuilder<PlanetItemExchangeOrderAmountUserLimit> builder)
{
// 테이블 이름
builder.ToTable("planet_exchange_order_amount_user_limits");
// 인덱스
builder.HasIndex(o => o.ExchangeMetaId);
builder.HasIndex(o => o.ExchangeDate);
builder.HasIndex(o => o.SeasonId);
builder.HasIndex(o => o.UserGuid);
// 복합 기본 키 (Primary Key) - ExchangeMetaId에 PlanetId 속성이 있으므로 생략함
builder.HasKey(o => new { o.ExchangeMetaId, o.ExchangeDate, o.SeasonId, o.UserGuid });
// 교환 메타 아이디
builder.Property(o => o.ExchangeMetaId)
.HasColumnName("exchange_meta_id")
.HasMaxLength(50)
.IsRequired()
.HasComment("교환 메타 아이디");
// 교환 일자
builder.Property(o => o.ExchangeDate)
.HasColumnName("exchange_date")
.IsRequired()
.HasComment("교환 일자");
// 유저 아이디
builder.Property(o => o.UserGuid)
.HasColumnName("user_guid")
.HasMaxLength(50)
.IsRequired()
.HasComment("유저 아이디 (GUID)");
// 교환 메타 수량
builder.Property(o => o.DailyAmount)
.HasColumnName("daily_amount")
.HasColumnType("INT")
.IsRequired()
.HasComment("사용자별 일일 교환 메타 수량");
builder.Property(o => o.SeasonId)
.HasColumnName("season_id")
.HasMaxLength(50)
.IsRequired()
.HasComment("시즌 아이디");
builder.Property(o => o.CreatedAt)
.HasColumnName("created_at")
.HasColumnType("TIMESTAMP")
.IsRequired()
.HasComment("생성 일자");
builder.Property(o => o.UpdatedAt)
.HasColumnName("updated_at")
.HasColumnType("TIMESTAMP")
.IsRequired()
.HasComment("업데이트 일자");
}
}

View File

@@ -0,0 +1,67 @@
namespace BrokerCore.Repository.SqlConfig;
using DbEntity;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
public class SapphireExchangeOrderConfig : IEntityTypeConfiguration<SapphireExchangeOrder>
{
public void Configure(EntityTypeBuilder<SapphireExchangeOrder> builder)
{
builder.ToTable("sapphire_exchange_order");
builder.HasKey(x => x.OrderId);
builder.HasIndex(x => x.CreatedAt);
builder.HasIndex(x => x.OrderStatus);
builder.HasIndex(x => x.AccountId);
builder.HasIndex(x => x.UserGuid);
builder.HasIndex(x => x.PlanetId);
builder.Property(x => x.OrderId)
.HasColumnName("order_id")
.HasColumnType("varchar(60)")
.HasComment("사파이어 교환 주문 아이디 guid")
.IsRequired();
builder.Property(x => x.OrderStatus)
.HasColumnName("order_status")
.HasComment("사파이어 교환 주문 상태")
.HasColumnType("tinyint")
.IsRequired();
builder.Property(x => x.AccountId)
.HasColumnName("account_id")
.HasComment("sso 계정 아이디")
.HasColumnType("bigint unsigned")
.IsRequired();
builder.Property(x => x.UserGuid)
.HasColumnName("user_guid")
.HasComment("유저 아이디")
.HasColumnType("varchar(50)")
.IsRequired();
builder.Property(x => x.PlanetId)
.HasColumnName("planet_id")
.HasComment("플래닛 아이디")
.HasColumnType("varchar(50)")
.IsRequired();
builder.Property(x => x.SapphireReducedDelta)
.HasColumnName("sapphire_reduced_amount")
.HasComment("사파이어 차감 수량")
.HasColumnType("decimal(20, 0)")
.IsRequired();
builder.Property(x => x.PlanetMoneyIncDelta)
.HasColumnName("planet_money_amount")
.HasComment("플래닛에서 발급한 재화 수량")
.HasColumnType("decimal(20, 0)")
.IsRequired();
builder.Property(x => x.CreatedAt)
.HasColumnName("created_at")
.HasComment("사파이어 교환 주문 시작 시간")
.HasColumnType("timestamp")
.IsRequired();
builder.Property(x => x.CompletedAt)
.HasColumnName("completed_at")
.HasComment("사파이어 교환 주문 완료 시간")
.HasColumnType("timestamp")
.IsRequired(false);
}
}