77 lines
2.1 KiB
C#
77 lines
2.1 KiB
C#
using Newtonsoft.Json;
|
|
|
|
|
|
|
|
using ServerCore;
|
|
using ServerBase;
|
|
|
|
|
|
using USER_GUID = System.String;
|
|
|
|
|
|
|
|
namespace ServerCommon;
|
|
|
|
public class CaliumConverterForUserAttrib : AttribBase
|
|
{
|
|
[JsonProperty("data")] public Dictionary<USER_GUID, double> UserCalium { get; set; } = new();
|
|
|
|
public CaliumConverterForUserAttrib() : base(nameof(CaliumConverterForUserAttrib), false)
|
|
{
|
|
}
|
|
}
|
|
|
|
//=============================================================================================
|
|
// Primary Key : Deprecated -> Migration 에서 쓰고 있음 ( 추후 삭제 필요 )
|
|
// PK(Partition Key) : "caliumconverter#user"
|
|
// SK(Sort Key) : "dd"
|
|
// DocType : CaliumConverterForUserDoc
|
|
// Attrib : CaliumConverterForUserAttrib
|
|
// ...
|
|
//=============================================================================================
|
|
public class CaliumConverterForUserDoc : DynamoDbDocBase
|
|
{
|
|
public static string pk = "caliumconverter#user";
|
|
|
|
private static string getPrefixOfPK() => "";
|
|
private static string getPrefixOfSK() => "";
|
|
|
|
public CaliumConverterForUserDoc(int day, Int64 ttlSeconds) : base(nameof(CaliumConverterForUserDoc), ttlSeconds)
|
|
{
|
|
setCombinationKeyForSK(day.ToString());
|
|
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
|
|
|
appendAttribWrapperAll();
|
|
}
|
|
|
|
public CaliumConverterForUserDoc() : base(nameof(CaliumConverterForUserDoc))
|
|
{
|
|
appendAttribWrapperAll();
|
|
}
|
|
|
|
private void appendAttribWrapperAll()
|
|
{
|
|
appendAttribWrapper(new AttribWrapper<CaliumConverterForUserAttrib>());
|
|
}
|
|
|
|
protected override string onGetPrefixOfPK() => getPrefixOfPK();
|
|
|
|
protected override string onMakePK()
|
|
{
|
|
return pk;
|
|
}
|
|
|
|
protected override string onMakeSK()
|
|
{
|
|
return $"{onGetPrefixOfSK()}{getCombinationKeyForSK()}";
|
|
}
|
|
|
|
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
|
|
{
|
|
getPrimaryKey().fillUpSK(sortKey);
|
|
setCombinationKeyForSK(sortKey);
|
|
return ServerErrorCode.Success;
|
|
}
|
|
|
|
|
|
} |