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

77 lines
2.0 KiB
C#

using Newtonsoft.Json;
using ServerCore;
using ServerBase;
using BEACON_GUID = System.String;
namespace ServerCommon;
public class BeaconShopProfileAttrib : AttribBase
{
[JsonProperty("beacon_guid")]
public BEACON_GUID BeaconGuid { get; set; } = string.Empty;
[JsonProperty("daily_register_count")]
public Int32 DailyRegisterCount { get; set; } = 0;
[JsonProperty("register_update_day")]
public DateTime RegisterUpdateDay { get; set; } = new();
public BeaconShopProfileAttrib()
: base(typeof(BeaconShopProfileAttrib).Name)
{ }
}
//=============================================================================================
// PK(Partition Key) : "beacon_shop_profile#user_guid"
// SK(Sort Key) : ""
// DocType : BeaconShopProfileDoc
// Attrib : BeaconShopProfileAttrib
// ...
//=============================================================================================
public class BeaconShopProfileDoc : DynamoDbDocBase
{
private static string getPrefixOfPK() { return "beacon_shop_profile#"; }
public BeaconShopProfileDoc()
: base(typeof(BeaconShopProfileDoc).Name)
{
appendAttribWrapperAll();
}
public BeaconShopProfileDoc(string ownerGuid)
: base(typeof(BeaconShopProfileDoc).Name)
{
setCombinationKeyForPK(ownerGuid);
appendAttribWrapperAll();
fillUpPrimaryKey(onMakePK(), onMakeSK());
setExceptionHandler(new DynamoDbQueryExceptionNotifier.ExceptionHandler(DynamoDbQueryExceptionNotifier.ConditionalCheckFailed, ServerErrorCode.BeaconShopProfileException));
}
private void appendAttribWrapperAll()
{
appendAttribWrapper(new AttribWrapper<BeaconShopProfileAttrib>());
}
protected override string onGetPrefixOfPK()
{
return getPrefixOfPK();
}
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
{
getPrimaryKey().fillUpSK(sortKey);
setCombinationKeyForSK(sortKey);
return ServerErrorCode.Success;
}
}