-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from gradido/fix_inMemoryFindAllPagination
Fix in memory find all pagination
- Loading branch information
Showing
6 changed files
with
160 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
include/gradido_blockchain/interaction/toJson/FilterRole.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#ifndef __GRADIDO_BLOCKCHAIN_INTERACTION_TO_JSON_FILTER_ROLE_H | ||
#define __GRADIDO_BLOCKCHAIN_INTERACTION_TO_JSON_FILTER_ROLE_H | ||
|
||
#include "gradido_blockchain/blockchain/Filter.h" | ||
#include "AbstractRole.h" | ||
|
||
namespace gradido { | ||
namespace interaction { | ||
namespace toJson { | ||
class FilterRole : public AbstractRole | ||
{ | ||
public: | ||
FilterRole(const blockchain::Filter& filter) | ||
: mFilter(filter) {} | ||
|
||
rapidjson::Value composeJson(rapidjson::Document& rootDocument) const; | ||
|
||
protected: | ||
const blockchain::Filter& mFilter; | ||
}; | ||
} | ||
} | ||
} | ||
|
||
#endif //__GRADIDO_BLOCKCHAIN_INTERACTION_TO_JSON_FILTER_ROLE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#include "gradido_blockchain/interaction/toJson/FilterRole.h" | ||
#include "gradido_blockchain/lib/DataTypeConverter.h" | ||
|
||
#include "magic_enum/magic_enum.hpp" | ||
|
||
using namespace rapidjson; | ||
using namespace magic_enum; | ||
|
||
namespace gradido { | ||
namespace interaction { | ||
namespace toJson { | ||
Value FilterRole::composeJson(rapidjson::Document& rootDocument) const | ||
{ | ||
Value d(kObjectType); | ||
auto& alloc = rootDocument.GetAllocator(); | ||
d.AddMember("minTransactionNr", mFilter.minTransactionNr, alloc); | ||
d.AddMember("maxTransactionNr", mFilter.maxTransactionNr, alloc); | ||
if(mFilter.involvedPublicKey) { | ||
d.AddMember("involvedPublicKey", Value(mFilter.involvedPublicKey->convertToHex().data(), alloc), alloc); | ||
} | ||
d.AddMember("searchDirection", Value(enum_name(mFilter.searchDirection).data(), alloc), alloc); | ||
Value pagination(kObjectType); | ||
pagination.AddMember("size", mFilter.pagination.size, alloc); | ||
pagination.AddMember("page", mFilter.pagination.page, alloc); | ||
d.AddMember("pagination", pagination, alloc); | ||
d.AddMember("coinCommunityId", Value(mFilter.coinCommunityId.data(), alloc), alloc); | ||
|
||
Value timepointInterval(kObjectType); | ||
timepointInterval.AddMember( | ||
"startDate", | ||
Value(DataTypeConverter::timePointToString(mFilter.timepointInterval.getStartDate()).data(), alloc), | ||
alloc | ||
); | ||
timepointInterval.AddMember( | ||
"endDate", | ||
Value(DataTypeConverter::timePointToString(mFilter.timepointInterval.getEndDate()).data(), alloc), | ||
alloc | ||
); | ||
d.AddMember("timepointInterval", timepointInterval, alloc); | ||
d.AddMember("transactionType", Value(enum_name(mFilter.transactionType).data(), alloc), alloc); | ||
|
||
return d; | ||
} | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters