Skip to content

Commit

Permalink
Merge branch 'main' into docs-per-env
Browse files Browse the repository at this point in the history
  • Loading branch information
vasyl-ivanchuk committed Oct 30, 2023
2 parents d12434b + fd5249c commit a72ae88
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 9 deletions.
3 changes: 2 additions & 1 deletion packages/api/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ METRICS_PORT=3005
COLLECT_DB_CONNECTION_POOL_METRICS_INTERVAL=10000
PORT=3020
LOG_LEVEL=debug
LIMITED_PAGINATION_MAX_ITEMS=100000
LIMITED_PAGINATION_MAX_ITEMS=10000
API_LIMITED_PAGINATION_MAX_ITEMS=1000
DISABLE_API_SCHEMA_DOCS=false
DISABLE_BFF_API_SCHEMA_DOCS=false
DISABLE_EXTERNAL_API=false
Expand Down
1 change: 1 addition & 0 deletions packages/api/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ DATABASE_URL='postgres://postgres:postgres@localhost:5432/block-explorer-e2e'
METRICS_PORT=3005
PORT=3007
LIMITED_PAGINATION_MAX_ITEMS=15
API_LIMITED_PAGINATION_MAX_ITEMS=15
CONTRACT_VERIFICATION_API_URL=http://verification.api
2 changes: 1 addition & 1 deletion packages/api/src/api/dtos/common/pagingOptions.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class PagingOptionsDto {
@ApiPropertyOptional({
type: "integer",
minimum: 1,
maximum: 10000,
maximum: 100,
default: 10,
description: "The number of items returned per page",
example: 10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { PagingOptionsDto } from "./pagingOptions.dto";
import { config } from "dotenv";
config();

const maxItemsLimit = parseInt(process.env.LIMITED_PAGINATION_MAX_ITEMS, 10) || 10000;
const maxItemsLimit = parseInt(process.env.API_LIMITED_PAGINATION_MAX_ITEMS, 10) || 1000;

export class PagingOptionsWithMaxItemsLimitDto extends PagingOptionsDto {
@ApiPropertyOptional({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,5 @@ export class ContractAbiResponseDto extends ResponseBaseDto {
},
]),
})
public readonly result: any;
public readonly result: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ export class TransactionReceiptStatusResponseDto extends ResponseBaseDto {
status: "0",
},
})
public readonly result: { status: "0" | "1" | "" } | string;
public readonly result: { status: string } | string;
}
7 changes: 4 additions & 3 deletions packages/api/src/api/transaction/transaction.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { TransactionReceiptService } from "../../transaction/transactionReceipt.
import { TransactionStatus } from "../../transaction/entities/transaction.entity";
import { ParseTransactionHashPipe } from "../../common/pipes/parseTransactionHash.pipe";
import { ResponseStatus, ResponseMessage } from "../dtos/common/responseBase.dto";
import { ContractAbiResponseDto } from "../dtos/contract/contractAbiResponse.dto";
import { TransactionStatusResponseDto } from "../dtos/transaction/transactionStatusResponse.dto";
import { TransactionReceiptStatusResponseDto } from "../dtos/transaction/transactionReceiptStatusResponse.dto";
import { ApiExceptionFilter } from "../exceptionFilter";

const entityName = "transaction";
Expand All @@ -27,7 +28,7 @@ export class TransactionController {
@Get("/getstatus")
public async getTransactionStatus(
@Query("txhash", new ParseTransactionHashPipe()) transactionHash: string
): Promise<ContractAbiResponseDto> {
): Promise<TransactionStatusResponseDto> {
const transaction = await this.transactionService.findOne(transactionHash);
const hasError = transaction?.status === TransactionStatus.Failed;
return {
Expand All @@ -43,7 +44,7 @@ export class TransactionController {
@Get("/gettxreceiptstatus")
public async getTransactionReceiptStatus(
@Query("txhash", new ParseTransactionHashPipe()) transactionHash: string
): Promise<ContractAbiResponseDto> {
): Promise<TransactionReceiptStatusResponseDto> {
const transactionReceipt = await this.transactionReceiptService.findOne(transactionHash, ["status"]);
const status = transactionReceipt?.status.toString() || "";
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { PagingOptionsDto } from "./pagingOptions.dto";
import { config } from "dotenv";
config();

const maxItemsLimit = parseInt(process.env.LIMITED_PAGINATION_MAX_ITEMS, 10) || 100000;
const maxItemsLimit = parseInt(process.env.LIMITED_PAGINATION_MAX_ITEMS, 10) || 10000;

export class PagingOptionsWithMaxItemsLimitDto extends PagingOptionsDto {
@ApiPropertyOptional({
Expand Down

0 comments on commit a72ae88

Please sign in to comment.