Files
caliverse_server/ServerCommon/Doc/Global/LandAuctionRecordDoc.cs
2025-05-01 07:20:41 +09:00

85 lines
2.5 KiB
C#

using System;
using Newtonsoft.Json;
using ServerCore;
using ServerBase;
using META_ID = System.UInt32;
using LAND_AUCTION_NUMBER = System.Int32;
namespace ServerCommon;
public class LandAuctionRecordAttrib : AttribBase
{
[JsonProperty("land_meta_id")]
public META_ID LandMetaId { get; set; } = 0; // 경매 대상 LandData Meta Id
[JsonProperty("auction_number")]
public LAND_AUCTION_NUMBER AuctionNumber { get; set; } = 0; // 경매 번호
public LandAuctionRecordAttrib()
: base(nameof(LandAuctionRecordAttrib), false)
{
}
}
//=============================================================================================
// Desc : 랜드별 LandAuctionResult.Successed (낙찰)된 경매 정보
// Primary Key
// PK(Partition Key) : land_auction_record#global
// SK(Sort Key) : "{land_meta_id}"
// DocType : LandAuctionRecordDoc
// Attrib : LandAuctionRecordAttrib
// ...
//=============================================================================================
public class LandAuctionRecordDoc : DynamoDbDocBase
{
private static string getPrefixOfPK() => "land_auction_record#";
public LandAuctionRecordDoc()
: base(nameof(LandAuctionRecordDoc))
{
appendAttribWrapperAll();
}
public LandAuctionRecordDoc(META_ID landMetaId, LAND_AUCTION_NUMBER auctionNumber)
: base(nameof(LandAuctionRecordDoc))
{
setCombinationKeyForPK(DynamoDbClient.PK_GLOBAL);
setCombinationKeyForSK(landMetaId.ToString());
fillUpPrimaryKey(onMakePK(), onMakeSK());
appendAttribWrapperAll();
var land_auction_record_attrib = getAttrib<LandAuctionRecordAttrib>();
NullReferenceCheckHelper.throwIfNull(land_auction_record_attrib, () => $"land_auction_record_attrib is null !!!");
land_auction_record_attrib.LandMetaId = landMetaId;
land_auction_record_attrib.AuctionNumber = auctionNumber;
}
private void appendAttribWrapperAll()
{
appendAttribWrapper(new AttribWrapper<LandAuctionRecordAttrib>());
}
protected override string onGetPrefixOfPK() => getPrefixOfPK();
protected override string onMakeSK()
{
return $"{onGetPrefixOfSK()}{getCombinationKeyForSK()}";
}
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
{
getPrimaryKey().fillUpSK(sortKey);
setCombinationKeyForSK(sortKey);
return ServerErrorCode.Success;
}
}