73 lines
1.9 KiB
C#
73 lines
1.9 KiB
C#
using Newtonsoft.Json;
|
|
|
|
|
|
using ServerCore;
|
|
using ServerBase;
|
|
|
|
|
|
using RESERVATION_GUID = System.String;
|
|
|
|
|
|
namespace ServerCommon;
|
|
|
|
public class TaskReservationAttrib : AttribBase
|
|
{
|
|
[JsonProperty]
|
|
public RESERVATION_GUID ReservationGuid { get; set; } = string.Empty;
|
|
|
|
[JsonProperty]
|
|
public TaskReservationActionType ReservationType { get; set; } = TaskReservationActionType.None;
|
|
|
|
[JsonProperty]
|
|
public string JsonValue { get; set; } = string.Empty;
|
|
|
|
public TaskReservationAttrib()
|
|
: base(typeof(TaskReservationAttrib).Name)
|
|
{ }
|
|
}
|
|
|
|
//=============================================================================================
|
|
// PK(Partition Key) : "taskReservation#owner_guid"
|
|
// SK(Sort Key) : "reservation_guid"
|
|
// DocType : TaskReservationDoc
|
|
// Attrib : TaskReservationAttrib
|
|
// ...
|
|
//=============================================================================================
|
|
public class TaskReservationDoc : DynamoDbDocBase
|
|
{
|
|
private static string getPrefixOfPK() { return "taskReservation#"; }
|
|
|
|
public TaskReservationDoc()
|
|
: base(typeof(TaskReservationDoc).Name)
|
|
{
|
|
appendAttribWrapperAll();
|
|
}
|
|
|
|
public TaskReservationDoc(string ownerGuid, RESERVATION_GUID reservationGuid)
|
|
: base(typeof(TaskReservationDoc).Name)
|
|
{
|
|
setCombinationKeyForPKSK(ownerGuid, reservationGuid);
|
|
|
|
appendAttribWrapperAll();
|
|
|
|
fillUpPrimaryKey(onMakePK(), onMakeSK());
|
|
}
|
|
|
|
private void appendAttribWrapperAll()
|
|
{
|
|
appendAttribWrapper(new AttribWrapper<TaskReservationAttrib>());
|
|
}
|
|
|
|
protected override string onGetPrefixOfPK()
|
|
{
|
|
return getPrefixOfPK();
|
|
}
|
|
|
|
protected override ServerErrorCode onCheckAndSetSK(string sortKey)
|
|
{
|
|
getPrimaryKey().fillUpSK(sortKey);
|
|
setCombinationKeyForSK(sortKey);
|
|
return ServerErrorCode.Success;
|
|
}
|
|
}
|