초기커밋
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
using System.Globalization;
|
||||
|
||||
|
||||
using Amazon.DynamoDBv2;
|
||||
using Amazon.DynamoDBv2.DocumentModel;
|
||||
using Amazon.DynamoDBv2.Model;
|
||||
|
||||
|
||||
using ServerCore; using ServerBase;
|
||||
using ServerCommon;
|
||||
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class DBQBeaconShopItemDelete : QueryExecutorBase
|
||||
{
|
||||
private string m_combination_key_for_pk = string.Empty;
|
||||
|
||||
private string m_combination_key_for_sk = string.Empty;
|
||||
private double m_item_count { get; set; }
|
||||
|
||||
private PrimaryKey m_primary_key = new();
|
||||
|
||||
public DBQBeaconShopItemDelete(string combinationKeyForPK, string combinationKeyForSK, int itemCount) : base(nameof(DBQBeaconShopItemDelete))
|
||||
{
|
||||
m_item_count = itemCount;
|
||||
m_combination_key_for_pk = combinationKeyForPK;
|
||||
m_combination_key_for_sk = combinationKeyForSK;
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
// DB 쿼리 직전에 준비해야 할 로직들을 작성한다.
|
||||
//=====================================================================================
|
||||
public override async Task<Result> onPrepareQuery()
|
||||
{
|
||||
var owner = getOwner();
|
||||
|
||||
var (result, make_primary_key) = await DynamoDBDocBaseHelper.makePrimaryKey<BeaconShopItemDoc>(m_combination_key_for_pk, m_combination_key_for_sk);
|
||||
if (result.isFail())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
NullReferenceCheckHelper.throwIfNull(make_primary_key, () => $"make_primary_key is null !!! - {owner.toBasicString()}");
|
||||
|
||||
m_primary_key = make_primary_key;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
// onPrepareQuery()를 성공할 경우 호출된다.
|
||||
//=====================================================================================
|
||||
public override async Task<Result> onQuery()
|
||||
{
|
||||
var owner = getOwner();
|
||||
|
||||
var query_batch = getQueryBatch() as QueryBatch<QueryRunnerWithItemRequest>;
|
||||
NullReferenceCheckHelper.throwIfNull(query_batch, () => $"query_batch is null !!! - {owner.toBasicString()}");
|
||||
|
||||
var query_runner_with_item_request = query_batch.getQueryRunner();
|
||||
NullReferenceCheckHelper.throwIfNull(query_runner_with_item_request, () => $"query_runner_with_item_request is null !!! - {owner.toBasicString()}");
|
||||
|
||||
var db_connector = query_batch.getDynamoDbConnector();
|
||||
|
||||
var table = db_connector.getTableByDoc<BeaconShopItemDoc>();
|
||||
var delete = makeDeleteItemRequestBeaconShopItem(table, m_primary_key.toKeyWithAttributeValue(), JsonHelper.getJsonPropertyName<BeaconShopItemAttrib>(nameof(BeaconShopItemAttrib.ItemStackCount)));
|
||||
if (delete.result.isFail()) return delete.result;
|
||||
NullReferenceCheckHelper.throwIfNull(delete.deleteRequest, () => $"deleteRequest is null !!! - {owner.toBasicString()}");
|
||||
|
||||
var exception_handler = new DynamoDbQueryExceptionNotifier.ExceptionHandler(DynamoDbQueryExceptionNotifier.ConditionalCheckFailed, ServerErrorCode.BeaconShopUpdateNewData);
|
||||
|
||||
var query_context = delete.deleteRequest.createItemRequestQueryContext(QueryType.Delete, exception_handler);
|
||||
var result = await query_runner_with_item_request.tryRegisterQueryContext(query_context);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
// DB 쿼리를 성공하고, doFnCommit()가 QueryResultType.NotCalledQueryFunc를 반환할 경우 호출된다.
|
||||
//=====================================================================================
|
||||
public override async Task onQueryResponseCommit()
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
return;
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
// DB 쿼리를 실패하고, doFnRollback()가 QueryResultType.NotCalledQueryFunc를 반환할 경우 호출된다.
|
||||
//=====================================================================================
|
||||
public override async Task onQueryResponseRollback(Result errorResult)
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
return;
|
||||
}
|
||||
|
||||
private (Result result, DeleteItemRequest? deleteRequest) makeDeleteItemRequestBeaconShopItem( Table table
|
||||
, Dictionary<string, AttributeValue> attributeValueWithPrimaryKey
|
||||
, string targetAttribName )
|
||||
{
|
||||
var result = new Result();
|
||||
string err_msg;
|
||||
|
||||
if (string.IsNullOrEmpty(targetAttribName))
|
||||
{
|
||||
err_msg = $"Failed to DynamoDbClientHelper.toAttributeExpressionFromJson() !!! : targetAttribName - {targetAttribName}";
|
||||
result.setFail(ServerErrorCode.AttribPathMakeFailed, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
|
||||
var query_builder = new DynamoDbItemRequestHelper.DeleteItemRequestBuilder(table.TableName);
|
||||
query_builder.withKeys(attributeValueWithPrimaryKey);
|
||||
query_builder.withConditionExpression($"attribute_exists({PrimaryKey.PK_Define}) AND attribute_exists({PrimaryKey.SK_Define})");
|
||||
|
||||
var target_doc = new BeaconShopItemDoc();
|
||||
var attrib_path_json_string = target_doc.toJsonStringOfAttribs();
|
||||
(var is_success, var attribute_expression) = DynamoDbClientHelper.toAttributeExpressionFromJson(attrib_path_json_string, targetAttribName);
|
||||
if (false == is_success)
|
||||
{
|
||||
err_msg = $"Failed to DynamoDbClientHelper.toAttributeExpressionFromJson() !!! : attribPath:{attrib_path_json_string}, targetKey:{targetAttribName}";
|
||||
result.setFail(ServerErrorCode.AttribPathMakeFailed, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
|
||||
var attribute_names = DynamoDbClientHelper.toExpressionAttributeNamesFromJson(attrib_path_json_string, targetAttribName);
|
||||
query_builder.withExpressionAttributeNames(attribute_names);
|
||||
query_builder.withConditionExpression($"{attribute_expression} = :changeValue");
|
||||
|
||||
var expression_attribute_values = new Dictionary<string, AttributeValue>
|
||||
{
|
||||
{ ":changeValue", new AttributeValue { N = Math.Abs(m_item_count).ToString(CultureInfo.InvariantCulture) } }
|
||||
};
|
||||
query_builder.withExpressionAttributeValues(expression_attribute_values);
|
||||
|
||||
query_builder.withReturnValues(ReturnValue.ALL_NEW);
|
||||
|
||||
return (result, query_builder.build());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
using System.Globalization;
|
||||
|
||||
|
||||
using Amazon.DynamoDBv2;
|
||||
using Amazon.DynamoDBv2.DocumentModel;
|
||||
using Amazon.DynamoDBv2.Model;
|
||||
|
||||
|
||||
using ServerCore; using ServerBase;
|
||||
using ServerCommon;
|
||||
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class DBQBeaconShopItemUpdate : QueryExecutorBase
|
||||
{
|
||||
private string m_combination_key_for_pk = string.Empty;
|
||||
|
||||
private string m_combination_key_for_sk = string.Empty;
|
||||
private double m_delta { get; set; }
|
||||
|
||||
private PrimaryKey m_primary_key = new();
|
||||
|
||||
//=====================================================================================
|
||||
// 0 < deltaCount => 증가
|
||||
// 0 > deltaCount => 감소
|
||||
//=====================================================================================
|
||||
|
||||
public DBQBeaconShopItemUpdate(string combinationKeyForPK, string combinationKeyForSK, double delta) : base(nameof(DBQBeaconShopItemUpdate))
|
||||
{
|
||||
m_delta = delta;
|
||||
m_combination_key_for_pk = combinationKeyForPK;
|
||||
m_combination_key_for_sk = combinationKeyForSK;
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
// DB 쿼리 직전에 준비해야 할 로직들을 작성한다.
|
||||
//=====================================================================================
|
||||
public override async Task<Result> onPrepareQuery()
|
||||
{
|
||||
var owner = getOwner();
|
||||
|
||||
var (result, make_primary_key) = await DynamoDBDocBaseHelper.makePrimaryKey<BeaconShopItemDoc>(m_combination_key_for_pk, m_combination_key_for_sk);
|
||||
if (result.isFail())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
NullReferenceCheckHelper.throwIfNull(make_primary_key, () => $"make_primary_key is null !!! - {owner.toBasicString()}");
|
||||
|
||||
m_primary_key = make_primary_key;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
// onPrepareQuery()를 성공할 경우 호출된다.
|
||||
//=====================================================================================
|
||||
public override async Task<Result> onQuery()
|
||||
{
|
||||
var owner = getOwner();
|
||||
|
||||
var query_batch = getQueryBatch() as QueryBatch<QueryRunnerWithItemRequest>;
|
||||
NullReferenceCheckHelper.throwIfNull(query_batch, () => $"query_batch is null !!! - {owner.toBasicString()}");
|
||||
|
||||
var query_runner_with_item_request = query_batch.getQueryRunner();
|
||||
NullReferenceCheckHelper.throwIfNull(query_runner_with_item_request, () => $"query_runner_with_item_request is null !!! - {owner.toBasicString()}");
|
||||
|
||||
var db_connector = query_batch.getDynamoDbConnector();
|
||||
|
||||
var table = db_connector.getTableByDoc<BeaconShopItemDoc>();
|
||||
var update = makeUpdateItemRequestUpdateBeaconShopItemCount(table, m_primary_key.toKeyWithAttributeValue(), JsonHelper.getJsonPropertyName<BeaconShopItemAttrib>(nameof(BeaconShopItemAttrib.ItemStackCount)));
|
||||
if (update.result.isFail()) return update.result;
|
||||
NullReferenceCheckHelper.throwIfNull(update.updateRequest, () => $"update_request is null !!! - {owner.toBasicString()}");
|
||||
|
||||
var exception_handler = new DynamoDbQueryExceptionNotifier.ExceptionHandler(DynamoDbQueryExceptionNotifier.ConditionalCheckFailed, ServerErrorCode.BeaconShopUpdateNewData);
|
||||
|
||||
var query_context = update.updateRequest.createItemRequestQueryContext(QueryType.Update, exception_handler);
|
||||
var result = await query_runner_with_item_request.tryRegisterQueryContext(query_context);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
// DB 쿼리를 성공하고, doFnCommit()가 QueryResultType.NotCalledQueryFunc를 반환할 경우 호출된다.
|
||||
//=====================================================================================
|
||||
public override async Task onQueryResponseCommit()
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
return;
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
// DB 쿼리를 실패하고, doFnRollback()가 QueryResultType.NotCalledQueryFunc를 반환할 경우 호출된다.
|
||||
//=====================================================================================
|
||||
public override async Task onQueryResponseRollback(Result errorResult)
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
return;
|
||||
}
|
||||
|
||||
private (Result result, UpdateItemRequest? updateRequest) makeUpdateItemRequestUpdateBeaconShopItemCount( Table table
|
||||
, Dictionary<string, AttributeValue> attributeValueWithPrimaryKey
|
||||
, string targetAttribName )
|
||||
{
|
||||
var result = new Result();
|
||||
string err_msg;
|
||||
|
||||
if (string.IsNullOrEmpty(targetAttribName))
|
||||
{
|
||||
err_msg = $"Failed to DynamoDbClientHelper.toAttributeExpressionFromJson() !!! : targetAttribName - {targetAttribName}";
|
||||
result.setFail(ServerErrorCode.AttribPathMakeFailed, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
|
||||
var query_builder = new DynamoDbItemRequestHelper.UpdateItemRequestBuilder(table.TableName);
|
||||
query_builder.withKeys(attributeValueWithPrimaryKey);
|
||||
|
||||
var target_doc = new BeaconShopItemDoc();
|
||||
var attrib_path_json_string = target_doc.toJsonStringOfAttribs();
|
||||
(var is_success, var attribute_expression) = DynamoDbClientHelper.toAttributeExpressionFromJson(attrib_path_json_string, targetAttribName);
|
||||
if (false == is_success)
|
||||
{
|
||||
err_msg = $"Failed to DynamoDbClientHelper.toAttributeExpressionFromJson() !!! : attribPath:{attrib_path_json_string}, targetKey:{targetAttribName}";
|
||||
result.setFail(ServerErrorCode.AttribPathMakeFailed, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
|
||||
var attribute_names = DynamoDbClientHelper.toExpressionAttributeNamesFromJson(attrib_path_json_string, targetAttribName);
|
||||
query_builder.withExpressionAttributeNames(attribute_names);
|
||||
|
||||
var update_expression = (m_delta >= 0)
|
||||
? $"SET {attribute_expression} = if_not_exists({attribute_expression}, :start) + :changeValue"
|
||||
: $"SET {attribute_expression} = if_not_exists({attribute_expression}, :start) - :changeValue";
|
||||
|
||||
query_builder.withUpdateExpression(update_expression);
|
||||
|
||||
if (m_delta < 0)
|
||||
{
|
||||
query_builder.withConditionExpression($"{attribute_expression} >= :changeValue");
|
||||
}
|
||||
|
||||
var expression_attribute_values = new Dictionary<string, AttributeValue>
|
||||
{
|
||||
{ ":changeValue", new AttributeValue { N = Math.Abs(m_delta).ToString(CultureInfo.InvariantCulture) } },
|
||||
{ ":start", new AttributeValue { N = "0" } }
|
||||
};
|
||||
query_builder.withExpressionAttributeValues(expression_attribute_values);
|
||||
|
||||
query_builder.withReturnValues(ReturnValue.ALL_NEW);
|
||||
|
||||
return query_builder.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
using Amazon.DynamoDBv2.DocumentModel;
|
||||
|
||||
|
||||
using ServerCore;
|
||||
using ServerBase;
|
||||
using ServerCommon;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public class DBQBeaconShopSoldReadAll : QueryExecutorBase
|
||||
{
|
||||
private string m_combination_key_for_pk = string.Empty;
|
||||
|
||||
private string m_recoed_pk = string.Empty;
|
||||
private string m_price_pk = string.Empty;
|
||||
|
||||
private List<BeaconShopSoldRecordDoc> m_to_read_beacon_shop_sold_record_docs = new();
|
||||
private List<BeaconShopSoldPriceDoc> m_to_read_beacon_shop_sold_price_docs = new();
|
||||
|
||||
public DBQBeaconShopSoldReadAll(string combinationKeyForPK)
|
||||
: base(typeof(DBQBeaconShopSoldReadAll).Name)
|
||||
{
|
||||
m_combination_key_for_pk = combinationKeyForPK;
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
// DB 쿼리 직전에 준비해야 할 로직들을 작성한다.
|
||||
//=====================================================================================
|
||||
public override Task<Result> onPrepareQuery()
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var owner = getOwner();
|
||||
NullReferenceCheckHelper.throwIfNull(owner, () => "owner is null !!!");
|
||||
|
||||
var record_doc = new BeaconShopSoldRecordDoc();
|
||||
record_doc.setCombinationKeyForPK(m_combination_key_for_pk);
|
||||
|
||||
var error_code = record_doc.onApplyPKSK();
|
||||
if (error_code.isFail())
|
||||
{
|
||||
err_msg = $"Failed to onApplyPKSK() !!! : {error_code.toBasicString()} - {toBasicString()}, {owner.toBasicString()}";
|
||||
result.setFail(error_code, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
return Task.FromResult(result);
|
||||
}
|
||||
|
||||
m_recoed_pk = record_doc.getPK();
|
||||
|
||||
var price_doc = new BeaconShopSoldPriceDoc();
|
||||
price_doc.setCombinationKeyForPK(m_combination_key_for_pk);
|
||||
|
||||
error_code = price_doc.onApplyPKSK();
|
||||
if (error_code.isFail())
|
||||
{
|
||||
err_msg = $"Failed to onApplyPKSK() !!! : {error_code.toBasicString()} - {toBasicString()}, {owner.toBasicString()}";
|
||||
result.setFail(error_code, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
return Task.FromResult(result);
|
||||
}
|
||||
|
||||
m_price_pk = price_doc.getPK();
|
||||
|
||||
return Task.FromResult(result);
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
// onPrepareQuery()를 성공할 경우 호출된다.
|
||||
//=====================================================================================
|
||||
public override async Task<Result> onQuery()
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var owner = getOwner();
|
||||
NullReferenceCheckHelper.throwIfNull(owner, () => "owner is null !!!");
|
||||
|
||||
var query_batch = getQueryBatch();
|
||||
NullReferenceCheckHelper.throwIfNull(query_batch, () => "query_batch is null !!!");
|
||||
|
||||
var db_connector = query_batch.getDynamoDbConnector();
|
||||
var query_config = db_connector.makeQueryConfigForReadByPKOnly(m_recoed_pk);
|
||||
|
||||
(result, var record_read_docs) = await db_connector.simpleQueryDocTypesWithQueryOperationConfig<BeaconShopSoldRecordDoc>(query_config, eventTid: query_batch.getTransId());
|
||||
if (result.isFail())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
var beacon_shop_inventory_action = owner.getEntityAction<BeaconShopAction>();
|
||||
NullReferenceCheckHelper.throwIfNull(beacon_shop_inventory_action, () => "beacon_shop_inventory_action is null !!!");
|
||||
|
||||
result = await beacon_shop_inventory_action.AddBeaconShopSoldRecordsFromDocs(record_read_docs);
|
||||
if (result.isFail())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
var price_query_config = db_connector.makeQueryConfigForReadByPKOnly(m_price_pk);
|
||||
|
||||
(result, var price_read_docs) = await db_connector.simpleQueryDocTypesWithQueryOperationConfig<BeaconShopSoldPriceDoc>(price_query_config, eventTid: query_batch.getTransId());
|
||||
if (result.isFail())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
result = await beacon_shop_inventory_action.AddBeaconShopSoldPriceFromDocs(price_read_docs);
|
||||
if (result.isFail())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
result = await beacon_shop_inventory_action.ProcessBeaconShopDeleteRecord();
|
||||
if (result.isFail())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
m_to_read_beacon_shop_sold_record_docs = record_read_docs;
|
||||
m_to_read_beacon_shop_sold_price_docs = price_read_docs;
|
||||
|
||||
return await Task.FromResult(result);
|
||||
}
|
||||
|
||||
public List<BeaconShopSoldRecordDoc> getToReadItemDocs() => m_to_read_beacon_shop_sold_record_docs;
|
||||
|
||||
//=====================================================================================
|
||||
// DB 쿼리를 성공하고, doFnCommit()가 QueryResultType.NotCalledQueryFunc를 반환할 경우 호출된다.
|
||||
//=====================================================================================
|
||||
public override async Task onQueryResponseCommit()
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
return;
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
// DB 쿼리를 실패하고, doFnRollback()가 QueryResultType.NotCalledQueryFunc를 반환할 경우 호출된다.
|
||||
//=====================================================================================
|
||||
public override async Task onQueryResponseRollback(Result errorResult)
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
return;
|
||||
}
|
||||
|
||||
public new Player? getOwner() => getQueryBatch()?.getLogActor() as Player;
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
using Amazon.DynamoDBv2.DocumentModel;
|
||||
using GameServer;
|
||||
using ServerCommon;
|
||||
using ServerCore; using ServerBase;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace GameServer
|
||||
{
|
||||
public class DBQBeaconShopSoldRecordReadAll : QueryExecutorBase
|
||||
{
|
||||
private string m_combination_key_for_pk = string.Empty;
|
||||
|
||||
private string m_pk = string.Empty;
|
||||
|
||||
private List<BeaconShopSoldRecordDoc> m_to_read_beacon_shop_sold_record_docs = new();
|
||||
|
||||
public DBQBeaconShopSoldRecordReadAll(string combinationKeyForPK)
|
||||
: base(typeof(DBQBeaconShopSoldRecordReadAll).Name)
|
||||
{
|
||||
m_combination_key_for_pk = combinationKeyForPK;
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
// DB 쿼리 직전에 준비해야 할 로직들을 작성한다.
|
||||
//=====================================================================================
|
||||
public override Task<Result> onPrepareQuery()
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var owner = getOwner();
|
||||
NullReferenceCheckHelper.throwIfNull(owner, () => "owner is null !!!");
|
||||
|
||||
var doc = new BeaconShopSoldRecordDoc();
|
||||
doc.setCombinationKeyForPK(m_combination_key_for_pk);
|
||||
|
||||
var error_code = doc.onApplyPKSK();
|
||||
if (error_code.isFail())
|
||||
{
|
||||
err_msg = $"Failed to onApplyPKSK() !!! : {error_code.toBasicString()} - {toBasicString()}, {owner.toBasicString()}";
|
||||
result.setFail(error_code, err_msg);
|
||||
Log.getLogger().error(result.toBasicString());
|
||||
return Task.FromResult(result);
|
||||
}
|
||||
|
||||
m_pk = doc.getPK();
|
||||
|
||||
return Task.FromResult(result);
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
// onPrepareQuery()를 성공할 경우 호출된다.
|
||||
//=====================================================================================
|
||||
public override async Task<Result> onQuery()
|
||||
{
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var owner = getOwner();
|
||||
NullReferenceCheckHelper.throwIfNull(owner, () => "owner is null !!!");
|
||||
|
||||
var query_batch = getQueryBatch();
|
||||
NullReferenceCheckHelper.throwIfNull(query_batch, () => "query_batch is null !!!");
|
||||
|
||||
var db_connector = query_batch.getDynamoDbConnector();
|
||||
var query_config = db_connector.makeQueryConfigForReadByPKOnly(m_pk);
|
||||
|
||||
(result, var read_docs) = await db_connector.simpleQueryDocTypesWithQueryOperationConfig<BeaconShopSoldRecordDoc>(query_config, eventTid: query_batch.getTransId());
|
||||
if (result.isFail())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
var beacon_shop_inventory_action = owner.getEntityAction<BeaconShopAction>();
|
||||
NullReferenceCheckHelper.throwIfNull(beacon_shop_inventory_action, () => "beacon_shop_inventory_action is null !!!");
|
||||
|
||||
result = await beacon_shop_inventory_action.AddBeaconShopSoldRecordsFromDocs(read_docs);
|
||||
if (result.isFail())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
m_to_read_beacon_shop_sold_record_docs = read_docs;
|
||||
|
||||
return await Task.FromResult(result);
|
||||
}
|
||||
|
||||
public List<BeaconShopSoldRecordDoc> getToReadItemDocs() => m_to_read_beacon_shop_sold_record_docs;
|
||||
|
||||
//=====================================================================================
|
||||
// DB 쿼리를 성공하고, doFnCommit()가 QueryResultType.NotCalledQueryFunc를 반환할 경우 호출된다.
|
||||
//=====================================================================================
|
||||
public override async Task onQueryResponseCommit()
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
return;
|
||||
}
|
||||
|
||||
//=====================================================================================
|
||||
// DB 쿼리를 실패하고, doFnRollback()가 QueryResultType.NotCalledQueryFunc를 반환할 경우 호출된다.
|
||||
//=====================================================================================
|
||||
public override async Task onQueryResponseRollback(Result errorResult)
|
||||
{
|
||||
await Task.CompletedTask;
|
||||
return;
|
||||
}
|
||||
|
||||
public new Player? getOwner() => getQueryBatch()?.getLogActor() as Player;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user