초기커밋
This commit is contained in:
67
ServerCommon/Doc/OwnerContents/RoomDoc.cs
Normal file
67
ServerCommon/Doc/OwnerContents/RoomDoc.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
|
||||
|
||||
namespace ServerCommon;
|
||||
|
||||
public class RoomAttrib : AttribBase
|
||||
{
|
||||
[JsonProperty("room_id")] public int RoomId { get; set; }
|
||||
[JsonProperty("owner")] public string Owner { get; set; } = string.Empty;
|
||||
[JsonProperty("name")] public string Name { get; set; } = string.Empty;
|
||||
[JsonProperty("description")] public string Description { get; set; } = string.Empty;
|
||||
[JsonProperty("prop_info")] public Dictionary<string, AnchorProp> PropInfo = new();
|
||||
|
||||
public RoomAttrib()
|
||||
: base(typeof(RoomAttrib).Name)
|
||||
{ }
|
||||
}
|
||||
|
||||
//=============================================================================================
|
||||
// PK(Partition Key) : "room#owner_guid"
|
||||
// SK(Sort Key) : "room_id"
|
||||
// DocType : IndividualRoomDoc
|
||||
// RoomAttrib : {}
|
||||
// ...
|
||||
//=============================================================================================
|
||||
public class RoomDoc : DynamoDbDocBase
|
||||
{
|
||||
public RoomDoc() : base(nameof(RoomDoc))
|
||||
{
|
||||
}
|
||||
|
||||
public RoomDoc(string owner_guid, int room_id) : base(nameof(RoomDoc))
|
||||
{
|
||||
onInit(owner_guid, room_id);
|
||||
}
|
||||
|
||||
public void onInit(string owner_guid, int room_id)
|
||||
{
|
||||
setCombinationKeyForPK(owner_guid);
|
||||
setCombinationKeyForSK(room_id.ToString());
|
||||
|
||||
appendAttribWrapperAll();
|
||||
|
||||
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
||||
}
|
||||
|
||||
private void appendAttribWrapperAll()
|
||||
{
|
||||
appendAttribWrapper(new AttribWrapper<RoomAttrib>());
|
||||
}
|
||||
|
||||
protected override string onGetPrefixOfPK()
|
||||
{
|
||||
return "room#";
|
||||
}
|
||||
|
||||
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
|
||||
{
|
||||
getPrimaryKey().fillUpSK(sortKey);
|
||||
setCombinationKeyForSK(sortKey);
|
||||
|
||||
return ServerErrorCode.Success;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user