using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using ServerCore; using ServerBase; using META_ID = System.UInt32; using OWNER_GUID = System.String; namespace ServerCommon; public class ItemFirstPurchaseHistoryAttrib : AttribBase { [JsonProperty("item_meta_id")] public META_ID ItemMetaId { get; set; } = 0; [JsonProperty("first_purchase_time")] public DateTime FirstPurchaseTime { get; set; } = new(); public ItemFirstPurchaseHistoryAttrib() : base(typeof(ItemFirstPurchaseHistoryAttrib).Name) { } } //============================================================================================= // PK(Partition Key) : "item_first_purchase_history#user_guid" // SK(Sort Key) : "item_meta_id" // DocType : ItemFirstPurchaseHistoryDoc // ItemFirstPurchaseHistoryAttrib : {} // ... //============================================================================================= public class ItemFirstPurchaseHistoryDoc : DynamoDbDocBase { private static string getPrefixOfPK() { return "item_first_purchase_history#"; } private static string getPrefixOfSK() { return ""; } public ItemFirstPurchaseHistoryDoc() : base(typeof(ItemFirstPurchaseHistoryDoc).Name) { appendAttribWrapperAll(); } public ItemFirstPurchaseHistoryDoc(string userGuid, META_ID socialActionMetaId) : base(typeof(ItemFirstPurchaseHistoryDoc).Name) { setCombinationKeyForPK(userGuid); setCombinationKeyForSK(socialActionMetaId.ToString()); appendAttribWrapperAll(); fillUpPrimaryKey(onMakePK(), onMakeSK()); } private void appendAttribWrapperAll() { appendAttribWrapper(new AttribWrapper()); } protected override string onGetPrefixOfPK() { return getPrefixOfPK(); } protected override ServerErrorCode onCheckAndSetSK(string sortKey) { getPrimaryKey().fillUpSK(sortKey); setCombinationKeyForSK(sortKey); return ServerErrorCode.Success; } }