초기커밋
This commit is contained in:
499
GameServer/Entity/LandAuction/Helper/LandAuctionDbHelper.cs
Normal file
499
GameServer/Entity/LandAuction/Helper/LandAuctionDbHelper.cs
Normal file
@@ -0,0 +1,499 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
using Amazon.DynamoDBv2.Model;
|
||||
using Amazon.DynamoDBv2;
|
||||
|
||||
|
||||
using ServerCore; using ServerBase;
|
||||
using ServerCommon;
|
||||
|
||||
|
||||
using static ServerCommon.MetaHelper;
|
||||
|
||||
|
||||
using META_ID = System.UInt32;
|
||||
using USER_GUID = System.String;
|
||||
using LAND_AUCTION_NUMBER = System.Int32;
|
||||
|
||||
|
||||
|
||||
namespace GameServer
|
||||
{
|
||||
public static class LandAuctionDbHelper
|
||||
{
|
||||
public static async Task<(Result, bool)> isExistHighestBidderFromDb(this LandAuction landAuction, USER_GUID toCheckHighestBidUserGuid, double toCheckHighestBidPrice)
|
||||
{
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
var db_connector = server_logic.getDynamoDbClient();
|
||||
|
||||
var registry_attribute = landAuction.getEntityAttribute<LandAuctionRegistryAttribute>();
|
||||
NullReferenceCheckHelper.throwIfNull(registry_attribute, () => $"registry_attribute is null !!! - {landAuction.toBasicString()}");
|
||||
|
||||
var highest_bid_user_doc = new LandAuctionHighestBidUserDoc(registry_attribute.LandMetaId, registry_attribute.AuctionNumber);
|
||||
|
||||
var get_request = new TransactGetItem
|
||||
{
|
||||
Get = new Get
|
||||
{
|
||||
TableName = db_connector.getTableFullName(highest_bid_user_doc.TableName),
|
||||
Key = highest_bid_user_doc.getPrimaryKey().toKeyWithAttributeValue()
|
||||
}
|
||||
};
|
||||
(var result, var found_highest_bid_user_item_doc) = await db_connector.simpleQueryTransactReadDocWithItemRequest<LandAuctionHighestBidUserDoc>(get_request, isFailOnEmptyData: false);
|
||||
if (result.isFail())
|
||||
{
|
||||
var err_msg = $"Failed to simpleQueryTransactReadDocWithItemRequest<LandAuctionHighestBidUserDoc>() !!! : {get_request.Get.toBasicString()} - {landAuction.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
return (result, false);
|
||||
}
|
||||
if( null == found_highest_bid_user_item_doc)
|
||||
{
|
||||
var err_msg = $"Not found LandAuctionHighestBidUserDoc at simpleQueryTransactReadDocWithItemRequest<LandAuctionHighestBidUserDoc>() !!! : {get_request.Get.toBasicString()} - {landAuction.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
return (result, false);
|
||||
}
|
||||
|
||||
var heighest_bid_user_attrib = found_highest_bid_user_item_doc.getAttrib<LandAuctionHighestBidUserAttrib>();
|
||||
NullReferenceCheckHelper.throwIfNull(heighest_bid_user_attrib, () => $"heighest_bid_user_attrib is null !!! - {landAuction.toBasicString()}");
|
||||
if ( heighest_bid_user_attrib.HighestBidUserGuid == toCheckHighestBidUserGuid
|
||||
&& heighest_bid_user_attrib.HighestBidPrice == toCheckHighestBidPrice )
|
||||
{
|
||||
return (result, true);
|
||||
}
|
||||
|
||||
return (result, false);
|
||||
}
|
||||
|
||||
public static async Task<(Result, LandAuctionHighestBidUserDoc?)> tryGetLandAuctionHighestBidUserDoc(this LandAuction landAuction, META_ID landMetaId, LAND_AUCTION_NUMBER auctionNumber)
|
||||
{
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
var db_client = server_logic.getDynamoDbClient();
|
||||
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
(result, var found_highest_bid_user_doc) = await readLandAuctionHighestBidUserDocFromDb(landMetaId, auctionNumber);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to readLandAuctionHighestBidUserDocFromDb() !!! : {result.toBasicString()} - landMetaId:{landMetaId}, auctionNumber:{auctionNumber}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
|
||||
return (result, found_highest_bid_user_doc);
|
||||
}
|
||||
|
||||
public static async Task<Result> tryLoadLandAuctionActivityDoc(this LandAuction landAuction, META_ID landMetaId)
|
||||
{
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
var db_client = server_logic.getDynamoDbClient();
|
||||
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var activity_attribute = landAuction.getEntityAttribute<LandAuctionActivityAttribute>();
|
||||
NullReferenceCheckHelper.throwIfNull(activity_attribute, () => $"activity_attribute is null !!! - landMetaId:{landMetaId}");
|
||||
|
||||
(result, var found_activity_doc) = await readLandAuctionActivityDocFromDb(landMetaId);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to readLandAuctionActivityDocFromDb() !!! : {result.toBasicString()} - landMetaId:{landMetaId}";
|
||||
Log.getLogger().error(err_msg);
|
||||
return result;
|
||||
}
|
||||
NullReferenceCheckHelper.throwIfNull(found_activity_doc, () => $"found_activity_doc is null !!! - landMetaId:{landMetaId}");
|
||||
|
||||
result = await landAuction.copyDocToEntityAttributeForLandAuction(activity_attribute, found_activity_doc, false);
|
||||
if(result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to copyDocToEntityAttributeForLandAuction() !!! : {result.toBasicString()} - landMetaId:{landMetaId}";
|
||||
Log.getLogger().error(err_msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async Task<Result> tryLoadLandAuctionRegistryDoc(this LandAuction landAuction, META_ID landMetaId, LAND_AUCTION_NUMBER auctionNumber)
|
||||
{
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
var db_client = server_logic.getDynamoDbClient();
|
||||
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var registry_attribute = landAuction.getEntityAttribute<LandAuctionRegistryAttribute>();
|
||||
NullReferenceCheckHelper.throwIfNull(registry_attribute, () => $"registry_attribute is null !!! - landMetaId:{landMetaId}, auctionNumber:{auctionNumber}");
|
||||
|
||||
var auction_aution = landAuction.getEntityAction<LandAuctionAction>();
|
||||
NullReferenceCheckHelper.throwIfNull(auction_aution, () => $"auction_aution is null !!! - landMetaId:{landMetaId}, auctionNumber:{auctionNumber}");
|
||||
|
||||
(result, var found_registry_doc) = await readLandAuctionRegistryDocFromDb(landMetaId, auctionNumber);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to parse readLandAuctionRegistryDocFromDb() !!! : {result.toBasicString()} - landMetaId:{landMetaId}, auctionNumber:{auctionNumber}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return result;
|
||||
}
|
||||
NullReferenceCheckHelper.throwIfNull(found_registry_doc, () => $"found_registry_doc is null !!!");
|
||||
|
||||
result = await landAuction.copyDocToEntityAttributeForLandAuction(registry_attribute, found_registry_doc, false);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to copyDocToEntityAttributeForLandAuction() !!! : {result.toBasicString()} - landMetaId:{landMetaId}";
|
||||
Log.getLogger().error(err_msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async Task<(Result, bool)> tryLoadLandAuctionHighestBidUserDoc(this LandAuction landAuction, META_ID landMetaId, LAND_AUCTION_NUMBER auctionNumber)
|
||||
{
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
var db_client = server_logic.getDynamoDbClient();
|
||||
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var highest_bid_user_attribute = landAuction.getEntityAttribute<LandAuctionHighestBidUserAttribute>();
|
||||
NullReferenceCheckHelper.throwIfNull(highest_bid_user_attribute, () => $"highest_bid_user_attribute is null !!! - landMetaId:{landMetaId}, auctionNumber:{auctionNumber}");
|
||||
|
||||
(result, var found_highest_bid_user_doc) = await readLandAuctionHighestBidUserDocFromDb(landMetaId, auctionNumber);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to parse readLandAuctionHighestBidUserDocFromDb() !!! : {result.toBasicString()} - landMetaId:{landMetaId}, auctionNumber:{auctionNumber}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return (result, false);
|
||||
}
|
||||
|
||||
if (null != found_highest_bid_user_doc)
|
||||
{
|
||||
result = await landAuction.copyDocToEntityAttributeForLandAuction(highest_bid_user_attribute, found_highest_bid_user_doc, false);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to copyDocToEntityAttributeForLandAuction() !!! : {result.toBasicString()} - landMetaId:{landMetaId}";
|
||||
Log.getLogger().error(err_msg);
|
||||
return (result, false);
|
||||
}
|
||||
}
|
||||
|
||||
return (result, false);
|
||||
}
|
||||
|
||||
public static async Task<Result> tryFillupLandAuctionActivityFromDb(this LandAuction landAuction, META_ID landMetaId)
|
||||
{
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
var db_client = server_logic.getDynamoDbClient();
|
||||
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var activity_attribute = landAuction.getEntityAttribute<LandAuctionActivityAttribute>();
|
||||
NullReferenceCheckHelper.throwIfNull(activity_attribute, () => $"activity_attribute is null !!! - landMetaId:{landMetaId}");
|
||||
|
||||
(result, var found_activity_doc) = await readLandAuctionActivityDocFromDb(landMetaId);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to readLandAuctionActivityDocFromDb() !!! : {result.toBasicString()} - landMetaId:{landMetaId}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return result;
|
||||
}
|
||||
NullReferenceCheckHelper.throwIfNull(found_activity_doc, () => $"found_activity_doc is null !!!");
|
||||
|
||||
result = await landAuction.copyDocToEntityAttributeForLandAuction(activity_attribute, found_activity_doc, true);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to copyDocToEntityAttributeForLandAuction() !!! : {result.toBasicString()} - landMetaId:{landMetaId}";
|
||||
Log.getLogger().error(err_msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async Task<Result> tryFillupLandAuctionRegistryFromDb(this LandAuction landAuction, META_ID landMetaId, LAND_AUCTION_NUMBER auctionNumber)
|
||||
{
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
var db_client = server_logic.getDynamoDbClient();
|
||||
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
var registry_attribute = landAuction.getEntityAttribute<LandAuctionRegistryAttribute>();
|
||||
NullReferenceCheckHelper.throwIfNull(registry_attribute, () => $"land_auction_registry_attribute is null !!! - landMetaId:{landMetaId}, auctionNumber:{auctionNumber}");
|
||||
|
||||
(result, var found_registry_doc) = await readLandAuctionRegistryDocFromDb(landMetaId, auctionNumber);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to parse readLandAuctionRegistryDocFromDb() !!! : {result.toBasicString()} - landMetaId:{landMetaId}, auctionNumber:{auctionNumber}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return result;
|
||||
}
|
||||
NullReferenceCheckHelper.throwIfNull(found_registry_doc, () => $"found_registry_doc is null !!!");
|
||||
|
||||
result = await landAuction.copyDocToEntityAttributeForLandAuction(registry_attribute, found_registry_doc, true);
|
||||
if(result.isFail())
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async Task<(Result, List<LandAuctionActivityDoc>?)> readLandAuctionActivityDocsFromDb()
|
||||
{
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
var db_connector = server_logic.getDynamoDbClient();
|
||||
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
(result, var make_primary_key) = await DynamoDBDocBaseHelper.makePrimaryKey<LandAuctionActivityDoc>(DynamoDbClient.PK_GLOBAL);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to makePrimaryKey<LandAuctionActivityDoc>() !!! : {result.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
NullReferenceCheckHelper.throwIfNull(make_primary_key, () => $"make_primary_key is null !!!");
|
||||
|
||||
var query_config = db_connector.makeQueryConfigForReadByPKOnly(make_primary_key.PK);
|
||||
(result, var found_land_auction_activity_docs) = await db_connector.simpleQueryDocTypesWithQueryOperationConfig<LandAuctionActivityDoc>(query_config, false);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to simpleQueryDocTypesWithQueryOperationConfig<LandAuctionActivityDoc>() !!! : {result.toBasicString()}, {make_primary_key.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
NullReferenceCheckHelper.throwIfNull(found_land_auction_activity_docs, () => $"found_land_auction_activity_docs is null !!!");
|
||||
|
||||
return (result, found_land_auction_activity_docs);
|
||||
}
|
||||
|
||||
public static async Task<(Result, LandAuctionActivityDoc?)> readLandAuctionActivityDocFromDb(META_ID landMetaId, bool isFailOnEmptyDoc = true)
|
||||
{
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
var db_connector = server_logic.getDynamoDbClient();
|
||||
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
(result, var make_primary_key) = await DynamoDBDocBaseHelper.makePrimaryKey<LandAuctionActivityDoc>(DynamoDbClient.PK_GLOBAL, landMetaId.ToString());
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to makePrimaryKey<LandAuctionActivityDoc>() !!! : {result.toBasicString()} - landMetaId:{landMetaId}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
NullReferenceCheckHelper.throwIfNull(make_primary_key, () => $"make_primary_key is null !!!");
|
||||
|
||||
var query_config = db_connector.makeQueryConfigForReadByPKSK(make_primary_key.PK, make_primary_key.SK);
|
||||
(result, var found_land_auction_activity_doc) = await db_connector.simpleQueryDocTypeWithQueryOperationConfig<LandAuctionActivityDoc>(query_config, isFailOnEmptyDoc);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to simpleQueryDocTypeWithQueryOperationConfig<LandAuctionActivityDoc>() !!! : {result.toBasicString()}, {make_primary_key.toBasicString()} - landMetaId:{landMetaId}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
|
||||
return (result, found_land_auction_activity_doc);
|
||||
}
|
||||
|
||||
public static async Task<(Result, LandAuctionRegistryDoc?)> readLandAuctionRegistryDocFromDb(META_ID landMetaId, LAND_AUCTION_NUMBER auctionNumber, bool isFailOnEmptyDoc = true)
|
||||
{
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
var db_connector = server_logic.getDynamoDbClient();
|
||||
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
(result, var make_primary_key) = await DynamoDBDocBaseHelper.makePrimaryKey<LandAuctionRegistryDoc>( DynamoDbClient.PK_GLOBAL
|
||||
, LandAuctionRegistryDoc.makeCombinationKeyForSK(landMetaId, auctionNumber));
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to makePrimaryKey<LandAuctionRegistryDoc>() !!! : {result.toBasicString()} - landMetaId:{landMetaId}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
NullReferenceCheckHelper.throwIfNull(make_primary_key, () => $"make_primary_key is null !!!");
|
||||
|
||||
var query_config = db_connector.makeQueryConfigForReadByPKSK(make_primary_key.PK, make_primary_key.SK);
|
||||
(result, var found_land_auction_registry_doc) = await db_connector.simpleQueryDocTypeWithQueryOperationConfig<LandAuctionRegistryDoc>(query_config, isFailOnEmptyDoc);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to simpleQueryDocTypeWithQueryOperationConfig<LandAuctionRegistryDoc>() !!! : {result.toBasicString()}, {make_primary_key.toBasicString()} - landMetaId:{landMetaId}, auctionNumber:{auctionNumber}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
|
||||
return (result, found_land_auction_registry_doc);
|
||||
}
|
||||
|
||||
public static async Task<(Result, LandAuctionHighestBidUserDoc?)> readLandAuctionHighestBidUserDocFromDb(META_ID landMetaId, LAND_AUCTION_NUMBER auctionNumber)
|
||||
{
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
var db_connector = server_logic.getDynamoDbClient();
|
||||
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
(result, var make_primary_key) = await DynamoDBDocBaseHelper.makePrimaryKey<LandAuctionHighestBidUserDoc>( DynamoDbClient.PK_GLOBAL
|
||||
, LandAuctionHighestBidUserDoc.makeCombinationKeyForSK(landMetaId, auctionNumber) );
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to makePrimaryKey<LandAuctionHighestBidUserDoc>() !!! : {result.toBasicString()} - landMetaId:{landMetaId}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
NullReferenceCheckHelper.throwIfNull(make_primary_key, () => $"make_primary_key is null !!!");
|
||||
|
||||
var query_config = db_connector.makeQueryConfigForReadByPKSK(make_primary_key.PK, make_primary_key.SK);
|
||||
(result, var found_land_auction_highest_bid_user_doc) = await db_connector.simpleQueryDocTypeWithQueryOperationConfig<LandAuctionHighestBidUserDoc>(query_config, false);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to simpleQueryDocTypeWithQueryOperationConfig<LandAuctionHighestBidUserDoc>() !!! : {result.toBasicString()}, {make_primary_key.toBasicString()} - landMetaId:{landMetaId}, auctionNumber:{auctionNumber}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
|
||||
return (result, found_land_auction_highest_bid_user_doc);
|
||||
}
|
||||
|
||||
public static async Task<(Result, LandAuctionRefundBidPriceDoc?)> readLandAuctionRefundBidPriceDocFromDb( Player player
|
||||
, META_ID landMetaId, LAND_AUCTION_NUMBER auctionNumber )
|
||||
{
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
var db_connector = server_logic.getDynamoDbClient();
|
||||
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
(result, var found_refund_bid_price_doc) = await readLandAuctionRefundBidPriceDocFromDb( player.getUserGuid()
|
||||
, landMetaId, auctionNumber );
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to readLandAuctionRefundBidPriceDocFromDb() !!! : {result.toBasicString()}, landMetaId:{landMetaId}, auctionNumber:{auctionNumber} - {player.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
|
||||
return (result, found_refund_bid_price_doc);
|
||||
}
|
||||
|
||||
public static async Task<(Result, LandAuctionRefundBidPriceDoc?)> readLandAuctionRefundBidPriceDocFromDb( USER_GUID userGuid
|
||||
, META_ID landMetaId, LAND_AUCTION_NUMBER auctionNumber )
|
||||
{
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
var db_connector = server_logic.getDynamoDbClient();
|
||||
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
(result, var make_primary_key) = await DynamoDBDocBaseHelper.makePrimaryKey<LandAuctionRefundBidPriceDoc>(userGuid, LandAuctionRefundBidPriceDoc.makeCombinationKeyForSK(landMetaId, auctionNumber));
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to makePrimaryKey<LandAuctionRefundBidPriceDoc>() !!! : {result.toBasicString()} - userGuid:{userGuid}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
NullReferenceCheckHelper.throwIfNull(make_primary_key, () => $"make_primary_key is null !!!");
|
||||
|
||||
var query_config = db_connector.makeQueryConfigForReadByPKSK(make_primary_key.PK, make_primary_key.SK);
|
||||
(result, var found_refund_bid_price_doc) = await db_connector.simpleQueryDocTypeWithQueryOperationConfig<LandAuctionRefundBidPriceDoc>(query_config);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to simpleQueryDocTypesWithQueryOperationConfig<LandAuctionRefundBidPriceDoc>() !!! : {result.toBasicString()}, {make_primary_key.toBasicString()} - userGuid:{userGuid}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
|
||||
return (result, found_refund_bid_price_doc);
|
||||
}
|
||||
|
||||
public static async Task<(Result, List<LandAuctionRefundBidPriceDoc>?)> readLandAuctionRefundBidPriceDocsFromDb(Player player)
|
||||
{
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
var db_connector = server_logic.getDynamoDbClient();
|
||||
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
(result, var make_primary_key) = await DynamoDBDocBaseHelper.makePrimaryKey<LandAuctionRefundBidPriceDoc>(player.getUserGuid());
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to makePrimaryKey<LandAuctionRefundBidPriceDoc>() !!! : {result.toBasicString()} - {player.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
NullReferenceCheckHelper.throwIfNull(make_primary_key, () => $"make_primary_key is null !!!");
|
||||
|
||||
var query_config = db_connector.makeQueryConfigForReadByPKOnly(make_primary_key.PK);
|
||||
(result, var found_land_auction_bid_price_docs) = await db_connector.simpleQueryDocTypesWithQueryOperationConfig<LandAuctionRefundBidPriceDoc>(query_config);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to simpleQueryDocTypesWithQueryOperationConfig<LandAuctionRefundBidPriceDoc>() !!! : {result.toBasicString()}, {make_primary_key.toBasicString()} - {player.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
NullReferenceCheckHelper.throwIfNull(found_land_auction_bid_price_docs, () => $"found_land_auction_bid_price_docs is null !!! - {player.toBasicString()}");
|
||||
|
||||
return (result, found_land_auction_bid_price_docs);
|
||||
}
|
||||
|
||||
public static async Task<(Result, List<LandAuctionRecordDoc>?)> readLandAuctionRecordDocsFromDb()
|
||||
{
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
var db_connector = server_logic.getDynamoDbClient();
|
||||
|
||||
var result = new Result();
|
||||
var err_msg = string.Empty;
|
||||
|
||||
(result, var make_primary_key) = await DynamoDBDocBaseHelper.makePrimaryKey<LandAuctionRecordDoc>(DynamoDbClient.PK_GLOBAL);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to makePrimaryKey<LandAuctionRecordDoc>() !!! : {result.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
NullReferenceCheckHelper.throwIfNull(make_primary_key, () => $"make_primary_key is null !!!");
|
||||
|
||||
var query_config = db_connector.makeQueryConfigForReadByPKOnly(make_primary_key.PK);
|
||||
(result, var found_land_auction_record_docs) = await db_connector.simpleQueryDocTypesWithQueryOperationConfig<LandAuctionRecordDoc>(query_config);
|
||||
if (result.isFail())
|
||||
{
|
||||
err_msg = $"Failed to simpleQueryDocTypesWithQueryOperationConfig<LandAuctionRecordDoc>() !!! : {result.toBasicString()}, {make_primary_key.toBasicString()}";
|
||||
Log.getLogger().error(err_msg);
|
||||
|
||||
return (result, null);
|
||||
}
|
||||
NullReferenceCheckHelper.throwIfNull(found_land_auction_record_docs, () => $"found_docs is null !!!");
|
||||
|
||||
return (result, found_land_auction_record_docs);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user