121 lines
3.1 KiB
C#
121 lines
3.1 KiB
C#
using Newtonsoft.Json;
|
|
|
|
|
|
using ServerCore;
|
|
using ServerBase;
|
|
|
|
|
|
namespace ServerCommon;
|
|
|
|
public class BuildingFloorAttrib : AttribBase
|
|
{
|
|
[JsonProperty("land_meta_id")]
|
|
public int LandMetaId { get; set; }
|
|
|
|
[JsonProperty("building_meta_id")]
|
|
public int BuildingMetaId { get; set; }
|
|
|
|
[JsonProperty("floor")]
|
|
public int Floor { get; set; }
|
|
|
|
[JsonProperty("owner_guid")]
|
|
public string OwnerGuid { get; set; } = string.Empty;
|
|
|
|
[JsonProperty("myhome_guid")]
|
|
public string MyhomeGuid { get; set; } = string.Empty;
|
|
|
|
[JsonProperty("instance_name")]
|
|
public string InstanceName { get; set; } = string.Empty;
|
|
|
|
[JsonProperty("thumbnail_image_id")]
|
|
public int ThumbnailImageId { get; set; }
|
|
|
|
[JsonProperty("list_image_id")]
|
|
public int ListImageId { get; set; }
|
|
|
|
[JsonProperty("enter_player_count")]
|
|
public int EnterPlayerCount { get; set; }
|
|
|
|
[JsonProperty("rental_period")]
|
|
public TimeSpan RentalPeriod { get; set; } = new();
|
|
|
|
[JsonProperty("rental_start_time")]
|
|
public DateTime RentalStartTime { get; set; } = new();
|
|
|
|
[JsonProperty("rental_finish_time")]
|
|
public DateTime RentalFinishTime { get; set; } = new();
|
|
|
|
public BuildingFloorAttrib()
|
|
: base(typeof(BuildingFloorAttrib).Name, false)
|
|
{ }
|
|
}
|
|
|
|
//=============================================================================================
|
|
// PK(Partition Key) : "building#building_meta_id"
|
|
// SK(Sort Key) : "floor#층넘버"
|
|
// DocType : BuildingFloorDoc
|
|
// MyHomeAttrib : {}
|
|
// ...
|
|
//=============================================================================================
|
|
|
|
public class BuildingFloorDoc : DynamoDbDocBase
|
|
{
|
|
private static string getPrefixOfPK() { return "building#"; }
|
|
|
|
public static string getPrefixOfSK() { return "floor#"; }
|
|
public BuildingFloorDoc()
|
|
: base(typeof(BuildingFloorDoc).Name)
|
|
{
|
|
appendAttribWrapperAll();
|
|
}
|
|
|
|
public BuildingFloorDoc(int buildingMetaId, int floor)
|
|
: base(typeof(BuildingFloorDoc).Name)
|
|
{
|
|
setCombinationKeyForPK(buildingMetaId.ToString());
|
|
setCombinationKeyForSK(floor.ToString());
|
|
|
|
appendAttribWrapperAll();
|
|
|
|
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
|
}
|
|
|
|
public BuildingFloorDoc(int buildingMetaId, int floor, long ttlSeconds)
|
|
: base(typeof(BuildingFloorDoc).Name, ttlSeconds)
|
|
{
|
|
setCombinationKeyForPK(buildingMetaId.ToString());
|
|
setCombinationKeyForSK(floor.ToString());
|
|
|
|
appendAttribWrapperAll();
|
|
|
|
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
|
}
|
|
|
|
private void appendAttribWrapperAll()
|
|
{
|
|
appendAttribWrapper(new AttribWrapper<BuildingFloorAttrib>());
|
|
}
|
|
|
|
protected override string onGetPrefixOfPK()
|
|
{
|
|
return getPrefixOfPK();
|
|
}
|
|
|
|
protected override string onGetPrefixOfSK()
|
|
{
|
|
return getPrefixOfSK();
|
|
}
|
|
|
|
protected override string onMakeSK()
|
|
{
|
|
return $"{onGetPrefixOfSK()}{getCombinationKeyForSK()}";
|
|
}
|
|
|
|
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
|
|
{
|
|
getPrimaryKey().fillUpSK(sortKey);
|
|
|
|
return ServerErrorCode.Success;
|
|
}
|
|
}
|