using ServerBase; namespace BrokerApiCore; public static class EntityHelper { public static async Task<(Result, TDoc?)> findDocByPk(string pk, EntityBase owner, DynamoDbClient dynamoDbClient) where TDoc : DynamoDbDocBase, new() { ArgumentNullException.ThrowIfNull(owner, $"owner is null !!!"); var (result, user_primary_key) = await DynamoDBDocBaseHelper.makePrimaryKey(pk); if (result.isFail()) { return (result, null); } ArgumentNullException.ThrowIfNull(user_primary_key, $"user_primary_key is null !!! - {owner.toBasicString()}"); var query_config = dynamoDbClient.makeQueryConfigForReadByPKSK(user_primary_key.PK); (result, var found_doc) = await dynamoDbClient.simpleQueryDocTypeWithQueryOperationConfig(query_config, false); if (result.isFail()) { return (result, null); } return (result, found_doc); } }