초기커밋
This commit is contained in:
61
ServerCommon/Doc/OwnerContents/CartDoc.cs
Normal file
61
ServerCommon/Doc/OwnerContents/CartDoc.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
|
||||
|
||||
using META_ID = System.UInt32;
|
||||
|
||||
|
||||
namespace ServerCommon;
|
||||
|
||||
public class CartAttrib : AttribBase
|
||||
{
|
||||
[JsonProperty("cart_items")]
|
||||
public Dictionary<CurrencyType, Dictionary<META_ID/*ItemMetaID*/, Int32/*Count*/>> CartItems { get; set; } = new();
|
||||
|
||||
public CartAttrib()
|
||||
: base(typeof(CartAttrib).Name)
|
||||
{ }
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// PK(Partition Key) : "cart#user_guid"
|
||||
// SK(Sort Key) : ""
|
||||
// DocType : CartDoc
|
||||
// CartAttrib : {}
|
||||
// ...
|
||||
//=============================================================================================
|
||||
public class CartDoc : DynamoDbDocBase
|
||||
{
|
||||
private static string getPrefixOfPK() { return "cart#"; }
|
||||
|
||||
public CartDoc()
|
||||
: base(typeof(CartDoc).Name)
|
||||
{
|
||||
appendAttribWrapperAll();
|
||||
}
|
||||
|
||||
public CartDoc(string ownerGuid)
|
||||
: base(typeof(CartDoc).Name)
|
||||
{
|
||||
setCombinationKeyForPK(ownerGuid);
|
||||
|
||||
appendAttribWrapperAll();
|
||||
|
||||
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
||||
|
||||
setExceptionHandler(new DynamoDbQueryExceptionNotifier.ExceptionHandler(DynamoDbQueryExceptionNotifier.ConditionalCheckFailed, ServerErrorCode.CartDocException));
|
||||
}
|
||||
|
||||
private void appendAttribWrapperAll()
|
||||
{
|
||||
appendAttribWrapper(new AttribWrapper<CartAttrib>());
|
||||
}
|
||||
|
||||
protected override string onGetPrefixOfPK()
|
||||
{
|
||||
return getPrefixOfPK();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user