Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove new keyword for query parsers without specific parameter #1373

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 74 additions & 73 deletions src/endpoints/accounts/account.controller.ts

Large diffs are not rendered by default.

100 changes: 50 additions & 50 deletions src/endpoints/collections/collection.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ export class CollectionController {
@Query('type', new ParseEnumArrayPipe(NftType)) type?: NftType[],
@Query('subType', new ParseEnumArrayPipe(NftSubType)) subType?: NftSubType[],
@Query('creator', ParseAddressPipe) creator?: string,
@Query('before', new ParseIntPipe) before?: number,
@Query('after', new ParseIntPipe) after?: number,
@Query('canCreate', new ParseAddressPipe) canCreate?: string,
@Query('canBurn', new ParseAddressPipe) canBurn?: string,
@Query('canAddQuantity', new ParseAddressPipe) canAddQuantity?: string,
@Query('canUpdateAttributes', new ParseAddressPipe) canUpdateAttributes?: string,
@Query('canAddUri', new ParseAddressPipe) canAddUri?: string,
@Query('canTransferRole', new ParseAddressPipe) canTransferRole?: string,
@Query('excludeMetaESDT', new ParseBoolPipe) excludeMetaESDT?: boolean,
@Query('before', ParseIntPipe) before?: number,
@Query('after', ParseIntPipe) after?: number,
@Query('canCreate', ParseAddressPipe) canCreate?: string,
@Query('canBurn', ParseAddressPipe) canBurn?: string,
@Query('canAddQuantity', ParseAddressPipe) canAddQuantity?: string,
@Query('canUpdateAttributes', ParseAddressPipe) canUpdateAttributes?: string,
@Query('canAddUri', ParseAddressPipe) canAddUri?: string,
@Query('canTransferRole', ParseAddressPipe) canTransferRole?: string,
@Query('excludeMetaESDT', ParseBoolPipe) excludeMetaESDT?: boolean,
@Query('sort', new ParseEnumPipe(SortCollections)) sort?: SortCollections,
@Query('order', new ParseEnumPipe(SortOrder)) order?: SortOrder,
): Promise<NftCollection[]> {
Expand Down Expand Up @@ -117,15 +117,15 @@ export class CollectionController {
@Query('type', new ParseEnumArrayPipe(NftType)) type?: NftType[],
@Query('subType', new ParseEnumArrayPipe(NftSubType)) subType?: NftSubType[],
@Query('creator', ParseAddressPipe) creator?: string,
@Query('before', new ParseIntPipe) before?: number,
@Query('after', new ParseIntPipe) after?: number,
@Query('canCreate', new ParseAddressPipe) canCreate?: string,
@Query('canBurn', new ParseAddressPipe) canBurn?: string,
@Query('canAddQuantity', new ParseAddressPipe) canAddQuantity?: string,
@Query('canUpdateAttributes', new ParseAddressPipe) canUpdateAttributes?: string,
@Query('canAddUri', new ParseAddressPipe) canAddUri?: string,
@Query('canTransferRole', new ParseAddressPipe) canTransferRole?: string,
@Query('excludeMetaESDT', new ParseBoolPipe) excludeMetaESDT?: boolean,
@Query('before', ParseIntPipe) before?: number,
@Query('after', ParseIntPipe) after?: number,
@Query('canCreate', ParseAddressPipe) canCreate?: string,
@Query('canBurn', ParseAddressPipe) canBurn?: string,
@Query('canAddQuantity', ParseAddressPipe) canAddQuantity?: string,
@Query('canUpdateAttributes', ParseAddressPipe) canUpdateAttributes?: string,
@Query('canAddUri', ParseAddressPipe) canAddUri?: string,
@Query('canTransferRole', ParseAddressPipe) canTransferRole?: string,
@Query('excludeMetaESDT', ParseBoolPipe) excludeMetaESDT?: boolean,
): Promise<number> {
return await this.collectionService.getNftCollectionCount(new CollectionFilter({
search,
Expand All @@ -149,15 +149,15 @@ export class CollectionController {
@Query('search') search?: string,
@Query('type', new ParseEnumArrayPipe(NftType)) type?: NftType[],
@Query('creator', ParseAddressPipe) creator?: string,
@Query('before', new ParseIntPipe) before?: number,
@Query('after', new ParseIntPipe) after?: number,
@Query('canCreate', new ParseAddressPipe) canCreate?: string,
@Query('canBurn', new ParseAddressPipe) canBurn?: string,
@Query('canAddQuantity', new ParseAddressPipe) canAddQuantity?: string,
@Query('canUpdateAttributes', new ParseAddressPipe) canUpdateAttributes?: string,
@Query('canAddUri', new ParseAddressPipe) canAddUri?: string,
@Query('canTransferRole', new ParseAddressPipe) canTransferRole?: string,
@Query('excludeMetaESDT', new ParseBoolPipe) excludeMetaESDT?: boolean,
@Query('before', ParseIntPipe) before?: number,
@Query('after', ParseIntPipe) after?: number,
@Query('canCreate', ParseAddressPipe) canCreate?: string,
@Query('canBurn', ParseAddressPipe) canBurn?: string,
@Query('canAddQuantity', ParseAddressPipe) canAddQuantity?: string,
@Query('canUpdateAttributes', ParseAddressPipe) canUpdateAttributes?: string,
@Query('canAddUri', ParseAddressPipe) canAddUri?: string,
@Query('canTransferRole', ParseAddressPipe) canTransferRole?: string,
@Query('excludeMetaESDT', ParseBoolPipe) excludeMetaESDT?: boolean,
): Promise<number> {
return await this.collectionService.getNftCollectionCount(new CollectionFilter({
search,
Expand Down Expand Up @@ -235,14 +235,14 @@ export class CollectionController {
@Query('name') name?: string,
@Query('tags', ParseArrayPipe) tags?: string[],
@Query('creator', ParseAddressPipe) creator?: string,
@Query('isWhitelistedStorage', new ParseBoolPipe) isWhitelistedStorage?: boolean,
@Query('hasUris', new ParseBoolPipe) hasUris?: boolean,
@Query('isNsfw', new ParseBoolPipe) isNsfw?: boolean,
@Query('traits', new ParseRecordPipe) traits?: Record<string, string>,
@Query('nonceBefore', new ParseIntPipe) nonceBefore?: number,
@Query('nonceAfter', new ParseIntPipe) nonceAfter?: number,
@Query('withOwner', new ParseBoolPipe) withOwner?: boolean,
@Query('withSupply', new ParseBoolPipe) withSupply?: boolean,
@Query('isWhitelistedStorage', ParseBoolPipe) isWhitelistedStorage?: boolean,
@Query('hasUris', ParseBoolPipe) hasUris?: boolean,
@Query('isNsfw', ParseBoolPipe) isNsfw?: boolean,
@Query('traits', ParseRecordPipe) traits?: Record<string, string>,
@Query('nonceBefore', ParseIntPipe) nonceBefore?: number,
@Query('nonceAfter', ParseIntPipe) nonceAfter?: number,
@Query('withOwner', ParseBoolPipe) withOwner?: boolean,
@Query('withSupply', ParseBoolPipe) withSupply?: boolean,
@Query('sort', new ParseEnumPipe(SortCollectionNfts)) sort?: SortCollectionNfts,
@Query('order', new ParseEnumPipe(SortOrder)) order?: SortOrder,
): Promise<Nft[]> {
Expand Down Expand Up @@ -279,11 +279,11 @@ export class CollectionController {
@Query('name') name?: string,
@Query('tags', ParseArrayPipe) tags?: string[],
@Query('creator', ParseAddressPipe) creator?: string,
@Query('isWhitelistedStorage', new ParseBoolPipe) isWhitelistedStorage?: boolean,
@Query('hasUris', new ParseBoolPipe) hasUris?: boolean,
@Query('traits', new ParseRecordPipe) traits?: Record<string, string>,
@Query('nonceBefore', new ParseIntPipe) nonceBefore?: number,
@Query('nonceAfter', new ParseIntPipe) nonceAfter?: number,
@Query('isWhitelistedStorage', ParseBoolPipe) isWhitelistedStorage?: boolean,
@Query('hasUris', ParseBoolPipe) hasUris?: boolean,
@Query('traits', ParseRecordPipe) traits?: Record<string, string>,
@Query('nonceBefore', ParseIntPipe) nonceBefore?: number,
@Query('nonceAfter', ParseIntPipe) nonceAfter?: number,
): Promise<number> {
const isCollection = await this.collectionService.isCollection(collection);
if (!isCollection) {
Expand Down Expand Up @@ -353,11 +353,11 @@ export class CollectionController {
@Query('after', ParseIntPipe) after?: number,
@Query('round', ParseIntPipe) round?: number,
@Query('order', new ParseEnumPipe(SortOrder)) order?: SortOrder,
@Query('withScResults', new ParseBoolPipe) withScResults?: boolean,
@Query('withOperations', new ParseBoolPipe) withOperations?: boolean,
@Query('withLogs', new ParseBoolPipe) withLogs?: boolean,
@Query('withScamInfo', new ParseBoolPipe) withScamInfo?: boolean,
@Query('withUsername', new ParseBoolPipe) withUsername?: boolean,
@Query('withScResults', ParseBoolPipe) withScResults?: boolean,
@Query('withOperations', ParseBoolPipe) withOperations?: boolean,
@Query('withLogs', ParseBoolPipe) withLogs?: boolean,
@Query('withScamInfo', ParseBoolPipe) withScamInfo?: boolean,
@Query('withUsername', ParseBoolPipe) withUsername?: boolean,
@Query('withRelayedScresults', ParseBoolPipe) withRelayedScresults?: boolean,
) {
const options = TransactionQueryOptions.applyDefaultOptions(size, { withScResults, withOperations, withLogs, withScamInfo, withUsername });
Expand Down Expand Up @@ -478,11 +478,11 @@ export class CollectionController {
@Query('after', ParseIntPipe) after?: number,
@Query('round', ParseIntPipe) round?: number,
@Query('order', new ParseEnumPipe(SortOrder)) order?: SortOrder,
@Query('withScResults', new ParseBoolPipe) withScResults?: boolean,
@Query('withOperations', new ParseBoolPipe) withOperations?: boolean,
@Query('withLogs', new ParseBoolPipe) withLogs?: boolean,
@Query('withScamInfo', new ParseBoolPipe) withScamInfo?: boolean,
@Query('withUsername', new ParseBoolPipe) withUsername?: boolean,
@Query('withScResults', ParseBoolPipe) withScResults?: boolean,
@Query('withOperations', ParseBoolPipe) withOperations?: boolean,
@Query('withLogs', ParseBoolPipe) withLogs?: boolean,
@Query('withScamInfo', ParseBoolPipe) withScamInfo?: boolean,
@Query('withUsername', ParseBoolPipe) withUsername?: boolean,
) {
const options = TransactionQueryOptions.applyDefaultOptions(size, { withScResults, withOperations, withLogs, withScamInfo, withUsername });

Expand Down
67 changes: 34 additions & 33 deletions src/endpoints/nfts/nft.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ export class NftController {
@Query('name') name?: string,
@Query('tags', ParseArrayPipe) tags?: string[],
@Query('creator', ParseAddressPipe) creator?: string,
@Query('isWhitelistedStorage', new ParseBoolPipe) isWhitelistedStorage?: boolean,
@Query('hasUris', new ParseBoolPipe) hasUris?: boolean,
@Query('isNsfw', new ParseBoolPipe) isNsfw?: boolean,
@Query('isScam', new ParseBoolPipe) isScam?: boolean,
@Query('isWhitelistedStorage', ParseBoolPipe) isWhitelistedStorage?: boolean,
@Query('hasUris', ParseBoolPipe) hasUris?: boolean,
@Query('isNsfw', ParseBoolPipe) isNsfw?: boolean,
@Query('isScam', ParseBoolPipe) isScam?: boolean,
@Query('scamType', new ParseEnumPipe(ScamType)) scamType?: ScamType,
@Query('traits', new ParseRecordPipe) traits?: Record<string, string>,
@Query('before', new ParseIntPipe) before?: number,
@Query('after', new ParseIntPipe) after?: number,
@Query('withOwner', new ParseBoolPipe) withOwner?: boolean,
@Query('withSupply', new ParseBoolPipe) withSupply?: boolean,
@Query('traits', ParseRecordPipe) traits?: Record<string, string>,
@Query('before', ParseIntPipe) before?: number,
@Query('after', ParseIntPipe) after?: number,
@Query('withOwner', ParseBoolPipe) withOwner?: boolean,
@Query('withSupply', ParseBoolPipe) withSupply?: boolean,
): Promise<Nft[]> {
return await this.nftService.getNfts(
new QueryPagination({ from, size }),
Expand Down Expand Up @@ -134,13 +134,13 @@ export class NftController {
@Query('name') name?: string,
@Query('tags', ParseArrayPipe) tags?: string[],
@Query('creator', ParseAddressPipe) creator?: string,
@Query('isWhitelistedStorage', new ParseBoolPipe) isWhitelistedStorage?: boolean,
@Query('hasUris', new ParseBoolPipe) hasUris?: boolean,
@Query('isNsfw', new ParseBoolPipe) isNsfw?: boolean,
@Query('traits', new ParseRecordPipe) traits?: Record<string, string>,
@Query('before', new ParseIntPipe) before?: number,
@Query('after', new ParseIntPipe) after?: number,
@Query('isScam', new ParseBoolPipe) isScam?: boolean,
@Query('isWhitelistedStorage', ParseBoolPipe) isWhitelistedStorage?: boolean,
@Query('hasUris', ParseBoolPipe) hasUris?: boolean,
@Query('isNsfw', ParseBoolPipe) isNsfw?: boolean,
@Query('traits', ParseRecordPipe) traits?: Record<string, string>,
@Query('before', ParseIntPipe) before?: number,
@Query('after', ParseIntPipe) after?: number,
@Query('isScam', ParseBoolPipe) isScam?: boolean,
@Query('scamType', new ParseEnumPipe(ScamType)) scamType?: ScamType,
): Promise<number> {
return await this.nftService.getNftCount(
Expand Down Expand Up @@ -177,13 +177,13 @@ export class NftController {
@Query('name') name?: string,
@Query('tags', ParseArrayPipe) tags?: string[],
@Query('creator', ParseAddressPipe) creator?: string,
@Query('isWhitelistedStorage', new ParseBoolPipe) isWhitelistedStorage?: boolean,
@Query('hasUris', new ParseBoolPipe) hasUris?: boolean,
@Query('isNsfw', new ParseBoolPipe) isNsfw?: boolean,
@Query('traits', new ParseRecordPipe) traits?: Record<string, string>,
@Query('before', new ParseIntPipe) before?: number,
@Query('after', new ParseIntPipe) after?: number,
@Query('isScam', new ParseBoolPipe) isScam?: boolean,
@Query('isWhitelistedStorage', ParseBoolPipe) isWhitelistedStorage?: boolean,
@Query('hasUris', ParseBoolPipe) hasUris?: boolean,
@Query('isNsfw', ParseBoolPipe) isNsfw?: boolean,
@Query('traits', ParseRecordPipe) traits?: Record<string, string>,
@Query('before', ParseIntPipe) before?: number,
@Query('after', ParseIntPipe) after?: number,
@Query('isScam', ParseBoolPipe) isScam?: boolean,
@Query('scamType', new ParseEnumPipe(ScamType)) scamType?: ScamType,
): Promise<number> {
return await this.nftService.getNftCount(new NftFilter({ search, identifiers, type, subType, collection, collections, name, tags, creator, isWhitelistedStorage, hasUris, isNsfw, traits, before, after, isScam, scamType }));
Expand Down Expand Up @@ -313,11 +313,12 @@ export class NftController {
@Query('before', ParseIntPipe) before?: number,
@Query('after', ParseIntPipe) after?: number,
@Query('order', new ParseEnumPipe(SortOrder)) order?: SortOrder,
@Query('withScResults', new ParseBoolPipe) withScResults?: boolean,
@Query('withOperations', new ParseBoolPipe) withOperations?: boolean,
@Query('withLogs', new ParseBoolPipe) withLogs?: boolean,
@Query('withScamInfo', new ParseBoolPipe) withScamInfo?: boolean,
@Query('withUsername', new ParseBoolPipe) withUsername?: boolean,

@Query('withScResults', ParseBoolPipe) withScResults?: boolean,
@Query('withOperations', ParseBoolPipe) withOperations?: boolean,
@Query('withLogs', ParseBoolPipe) withLogs?: boolean,
@Query('withScamInfo', ParseBoolPipe) withScamInfo?: boolean,
@Query('withUsername', ParseBoolPipe) withUsername?: boolean,
@Query('withRelayedScresults', ParseBoolPipe) withRelayedScresults?: boolean,
) {
const options = TransactionQueryOptions.applyDefaultOptions(size, { withScResults, withOperations, withLogs, withScamInfo, withUsername });
Expand Down Expand Up @@ -423,11 +424,11 @@ export class NftController {
@Query('before', ParseIntPipe) before?: number,
@Query('after', ParseIntPipe) after?: number,
@Query('order', new ParseEnumPipe(SortOrder)) order?: SortOrder,
@Query('withScResults', new ParseBoolPipe) withScResults?: boolean,
@Query('withOperations', new ParseBoolPipe) withOperations?: boolean,
@Query('withLogs', new ParseBoolPipe) withLogs?: boolean,
@Query('withScamInfo', new ParseBoolPipe) withScamInfo?: boolean,
@Query('withUsername', new ParseBoolPipe) withUsername?: boolean,
@Query('withScResults', ParseBoolPipe) withScResults?: boolean,
@Query('withOperations', ParseBoolPipe) withOperations?: boolean,
@Query('withLogs', ParseBoolPipe) withLogs?: boolean,
@Query('withScamInfo', ParseBoolPipe) withScamInfo?: boolean,
@Query('withUsername', ParseBoolPipe) withUsername?: boolean,
) {
const options = TransactionQueryOptions.applyDefaultOptions(size, { withScResults, withOperations, withLogs, withScamInfo, withUsername });

Expand Down
2 changes: 1 addition & 1 deletion src/endpoints/nodes/node.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class NodeController {
@Query('fullHistory', ParseBoolPipe) fullHistory?: boolean,
@Query('sort', new ParseEnumPipe(NodeSort)) sort?: NodeSort,
@Query('order', new ParseEnumPipe(SortOrder)) order?: SortOrder,
@Query('withIdentityInfo', new ParseBoolPipe) withIdentityInfo?: boolean,
@Query('withIdentityInfo', ParseBoolPipe) withIdentityInfo?: boolean,
@Query('isQualified', ParseBoolPipe) isQualified?: boolean,
@Query('isAuctioned', ParseBoolPipe) isAuctioned?: boolean,
@Query('isAuctionDangerZone', ParseBoolPipe) isAuctionDangerZone?: boolean,
Expand Down
4 changes: 2 additions & 2 deletions src/endpoints/providers/provider.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export class ProviderController {
@Query('identity') identity?: string,
@Query('owner', ParseAddressPipe) owner?: string,
@Query('providers', ParseAddressArrayPipe) providers?: string[],
@Query('withIdentityInfo', new ParseBoolPipe) withIdentityInfo?: boolean,
@Query('withLatestInfo', new ParseBoolPipe) withLatestInfo?: boolean,
@Query('withIdentityInfo', ParseBoolPipe) withIdentityInfo?: boolean,
@Query('withLatestInfo', ParseBoolPipe) withLatestInfo?: boolean,
): Promise<Provider[]> {
const options = ProviderQueryOptions.applyDefaultOptions(owner, { withIdentityInfo, withLatestInfo });

Expand Down
12 changes: 6 additions & 6 deletions src/endpoints/rounds/round.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export class RoundController {
@Query("size", new DefaultValuePipe(25), ParseIntPipe) size: number,
@Query("validator", ParseBlsHashPipe) validator?: string,
@Query('condition', new ParseEnumPipe(QueryConditionOptions)) condition?: QueryConditionOptions,
@Query("shard", new ParseIntPipe) shard?: number,
@Query("epoch", new ParseIntPipe) epoch?: number,
@Query("shard", ParseIntPipe) shard?: number,
@Query("epoch", ParseIntPipe) epoch?: number,
): Promise<Round[]> {
return this.roundService.getRounds(new RoundFilter({ from, size, condition, validator, shard, epoch }));
}
Expand All @@ -42,8 +42,8 @@ export class RoundController {
getRoundCount(
@Query("validator", ParseBlsHashPipe) validator?: string,
@Query('condition', new ParseEnumPipe(QueryConditionOptions)) condition?: QueryConditionOptions,
@Query("shard", new ParseIntPipe) shard?: number,
@Query("epoch", new ParseIntPipe) epoch?: number,
@Query("shard", ParseIntPipe) shard?: number,
@Query("epoch", ParseIntPipe) epoch?: number,
): Promise<number> {
return this.roundService.getRoundCount(new RoundFilter({ condition, validator, shard, epoch }));
}
Expand All @@ -53,8 +53,8 @@ export class RoundController {
getRoundCountAlternative(
@Query("validator", ParseBlsHashPipe) validator?: string,
@Query('condition', new ParseEnumPipe(QueryConditionOptions)) condition?: QueryConditionOptions,
@Query("shard", new ParseIntPipe) shard?: number,
@Query("epoch", new ParseIntPipe) epoch?: number,
@Query("shard", ParseIntPipe) shard?: number,
@Query("epoch", ParseIntPipe) epoch?: number,
): Promise<number> {
return this.roundService.getRoundCount(new RoundFilter({ condition, validator, shard, epoch }));
}
Expand Down
Loading
Loading