-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add transfer type filter for address transfers BFF API (#195)
# What ❔ Add filter by transfer type to the address transfers endpoint ## Why ❔ It is useful to be able to get a list of transfers of certain type for address. For example get list of withdrawals.
- Loading branch information
Showing
10 changed files
with
101 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
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
13 changes: 13 additions & 0 deletions
13
packages/api/src/address/dtos/filterAddressTransfersOptions.dto.ts
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,13 @@ | ||
import { ApiPropertyOptional } from "@nestjs/swagger"; | ||
import { IsOptional } from "class-validator"; | ||
import { TransferType } from "../../transfer/transfer.entity"; | ||
|
||
export class FilterAddressTransfersOptionsDto { | ||
@ApiPropertyOptional({ | ||
description: "Transfer type to filter transfers by", | ||
example: TransferType.Transfer, | ||
enum: TransferType, | ||
}) | ||
@IsOptional() | ||
public readonly type?: TransferType; | ||
} |
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from "./account.dto"; | ||
export * from "./baseAddress.dto"; | ||
export * from "./contract.dto"; | ||
export * from "./filterAddressTransfersOptions.dto"; |
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
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
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
23 changes: 23 additions & 0 deletions
23
packages/worker/src/migrations/1709722093204-AddAddressTransferType.ts
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,23 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
|
||
export class AddAddressTransferType1709722093204 implements MigrationInterface { | ||
name = "AddAddressTransferType1709722093204"; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`CREATE TYPE "public"."addressTransfers_type_enum" AS ENUM('deposit', 'transfer', 'withdrawal', 'fee', 'mint', 'refund')` | ||
); | ||
await queryRunner.query( | ||
`ALTER TABLE "addressTransfers" ADD "type" "public"."addressTransfers_type_enum" NOT NULL DEFAULT 'transfer'` | ||
); | ||
await queryRunner.query( | ||
`CREATE INDEX "IDX_aa5a147f1f6a4acde1a13de594" ON "addressTransfers" ("address", "type", "timestamp", "logIndex") ` | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`DROP INDEX "public"."IDX_aa5a147f1f6a4acde1a13de594"`); | ||
await queryRunner.query(`ALTER TABLE "addressTransfers" DROP COLUMN "type"`); | ||
await queryRunner.query(`DROP TYPE "public"."addressTransfers_type_enum"`); | ||
} | ||
} |