초기커밋
This commit is contained in:
92
ServerCommon/Doc/OwnerContents/BeaconShopItemDoc.cs
Normal file
92
ServerCommon/Doc/OwnerContents/BeaconShopItemDoc.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using BEACON_GUID = System.String;
|
||||
using META_ID = System.UInt32;
|
||||
using USER_GUID = System.String;
|
||||
using ITEM_GUID = System.String;
|
||||
using ServerCore; using ServerBase;
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
namespace ServerCommon
|
||||
{
|
||||
public class BeaconShopItemAttrib : ItemAttrib
|
||||
{
|
||||
[JsonProperty("user_guid")]
|
||||
public USER_GUID UserGuid { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("beacon_guid")]
|
||||
public BEACON_GUID BeaconGuid { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("selling_finish_time")]
|
||||
public DateTime SellingFinishTime { get; set; } = new();
|
||||
|
||||
[JsonProperty("price_for_unit")]
|
||||
public double PriceForUnit { get; set; } = 0;
|
||||
|
||||
public BeaconShopItemAttrib()
|
||||
: base(typeof(BeaconShopItemAttrib).Name, false)
|
||||
{ }
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// PK(Partition Key) : "beacon_shop_item#beacon_guid"
|
||||
// SK(Sort Key) : "item_guid"
|
||||
// DocType : BeaconShopItemDoc
|
||||
// Attrib : BeaconShopItemAttrib
|
||||
// ...
|
||||
//=============================================================================================
|
||||
public class BeaconShopItemDoc : ItemDoc
|
||||
{
|
||||
private static string getPrefixOfPK() { return "beacon_shop_item#"; }
|
||||
private static string getPrefixOfSK() { return ""; }
|
||||
|
||||
public BeaconShopItemDoc()
|
||||
: base(typeof(BeaconShopItemDoc).Name)
|
||||
{
|
||||
appendAttribWrapperAll();
|
||||
}
|
||||
|
||||
public BeaconShopItemDoc(OwnerEntityType ownerEntityType, string beaconGuid, string userGuid, ITEM_GUID itemGuid)
|
||||
: base(typeof(BeaconShopItemDoc).Name)
|
||||
{
|
||||
setCombinationKeyForPKSK(beaconGuid, itemGuid);
|
||||
|
||||
appendAttribWrapperAll();
|
||||
|
||||
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
||||
|
||||
setExceptionHandler(new DynamoDbQueryExceptionNotifier.ExceptionHandler(DynamoDbQueryExceptionNotifier.ConditionalCheckFailed, ServerErrorCode.BeaconShopException));
|
||||
|
||||
var doc_beacon_shop_item_attrib = getAttrib<BeaconShopItemAttrib>();
|
||||
NullReferenceCheckHelper.throwIfNull(doc_beacon_shop_item_attrib, () => $"doc_beacon_shop_item_attrib is null !!! - beaconGuid:{beaconGuid}, itemGuid:{itemGuid}, userGuid:{userGuid}, ownerEntityType:{ownerEntityType}");
|
||||
|
||||
doc_beacon_shop_item_attrib.BeaconGuid = beaconGuid;
|
||||
doc_beacon_shop_item_attrib.UserGuid = userGuid;
|
||||
doc_beacon_shop_item_attrib.OwnerGuid = beaconGuid;
|
||||
doc_beacon_shop_item_attrib.OwnerEntityType = ownerEntityType;
|
||||
doc_beacon_shop_item_attrib.ItemGuid = itemGuid;
|
||||
}
|
||||
|
||||
private void appendAttribWrapperAll()
|
||||
{
|
||||
appendAttribWrapper(new AttribWrapper<BeaconShopItemAttrib>());
|
||||
}
|
||||
|
||||
protected override string onGetPrefixOfPK()
|
||||
{
|
||||
return getPrefixOfPK();
|
||||
}
|
||||
|
||||
protected override string onGetPrefixOfSK()
|
||||
{
|
||||
return getPrefixOfSK();
|
||||
}
|
||||
|
||||
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
|
||||
{
|
||||
getPrimaryKey().fillUpSK(sortKey);
|
||||
setCombinationKeyForSK(sortKey);
|
||||
return ServerErrorCode.Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user