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

73 lines
1.8 KiB
C#

using Newtonsoft.Json;
using ServerCore;
using ServerBase;
using META_ID = System.UInt32;
namespace ServerCommon;
public class OwnedLandAttrib : AttribBase
{
[JsonProperty("land_meta_id")]
public META_ID LandMetaId { get; set; } = 0;
[JsonProperty("owned_type")]
public OwnedType OwnedType { get; set; } = OwnedType.None;
public OwnedLandAttrib()
: base(typeof(OwnedLandAttrib).Name)
{ }
}
//=============================================================================================
// PK(Partition Key) : "owned_land#user_guid"
// SK(Sort Key) : "land_meta_id"
// DocType : OwnedLandDoc
// OwnedLandAttrib : {}
// ...
//=============================================================================================
public class OwnedLandDoc : DynamoDbDocBase
{
private static string getPrefixOfPK() { return "owned_land#"; }
private static string getPrefixOfSK() { return ""; }
public OwnedLandDoc()
: base(typeof(OwnedLandDoc).Name)
{
appendAttribWrapperAll();
}
public OwnedLandDoc(string userGuid, META_ID landMetaId)
: base(typeof(OwnedLandDoc).Name)
{
setCombinationKeyForPK(userGuid);
setCombinationKeyForSK(landMetaId.ToString());
appendAttribWrapperAll();
fillUpPrimaryKey(onMakePK(), onMakeSK());
}
private void appendAttribWrapperAll()
{
appendAttribWrapper(new AttribWrapper<OwnedLandAttrib>());
}
protected override string onGetPrefixOfPK()
{
return getPrefixOfPK();
}
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
{
getPrimaryKey().fillUpSK(sortKey);
setCombinationKeyForSK(sortKey);
return ServerErrorCode.Success;
}
}