using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Google.Protobuf.WellKnownTypes; using Newtonsoft.Json; using ServerCore; using ServerBase; namespace ServerCommon; public class UserReportAttrib : AttribBase { [JsonProperty] public string ReporterGuid = string.Empty; [JsonProperty] public string ReporterNickName = string.Empty; [JsonProperty] public string TargetGuid = string.Empty; [JsonProperty] public string TargetNickName = string.Empty; [JsonProperty] public string Reason = string.Empty; [JsonProperty] public string Title = string.Empty; [JsonProperty] public string Detail = string.Empty; [JsonProperty] public int State = 0; [JsonProperty] public DateTime CreateTime = new(); [JsonProperty] public DateTime ResolutionTime = new(); public UserReportAttrib() : base(typeof(UserReportAttrib).Name) { } } //============================================================================================= // Primary Key // PK(Partition Key) : "management_user_report#owner_guid" // SK(Sort Key) : "date" // DocType : UserReportDoc // UserReportAttrib : {} // ... //============================================================================================= public class UserReportDoc : DynamoDbDocBase { private static string getPrefixOfPK() { return "management_user_report#"; } private static string getPrefixOfSK() { return ""; } public UserReportDoc() : base(typeof(UserReportDoc).Name) { appendAttribWrapperAll(); } public UserReportDoc(string ownerGuid, string date) : base(typeof(UserReportDoc).Name) { setCombinationKeyForPKSK(ownerGuid, date); appendAttribWrapperAll(); fillUpPrimaryKey(onMakePK(), onMakeSK()); setExceptionHandler(new DynamoDbQueryExceptionNotifier.ExceptionHandler(DynamoDbQueryExceptionNotifier.ConditionalCheckFailed, ServerErrorCode.UserReportDocException)); } private void appendAttribWrapperAll() { appendAttribWrapper(new AttribWrapper()); } protected override string onGetPrefixOfPK() { return getPrefixOfPK(); } protected override ServerErrorCode onCheckAndSetSK(string sortKey) { getPrimaryKey().fillUpSK(sortKey); setCombinationKeyForSK(sortKey); return ServerErrorCode.Success; } }