-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add fees route and get total count by chain * feat: add chains endpoint to get chain config data * test: collect coverage from unit tests rather than e2e tests * feat: add get fees route with pagination * test: add e2e tests for querying collected fees
- Loading branch information
1 parent
19b0345
commit b925e1f
Showing
47 changed files
with
17,559 additions
and
60 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export const QUERY_EVENT_DELAY_IN_MILLISECONDS: number = 100; // 100 milliseconds | ||
export const QUERY_EVENT_DELAY_IN_MILLISECONDS: number = 500; // 500 milliseconds |
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 +1,2 @@ | ||
export const FEE_PAGINATION_MAX_LIMIT: number = 25; | ||
export const QUERY_EVENT_MAX_LIMIT: number = 100; |
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,4 +1,6 @@ | ||
enum APIPathEnum { | ||
Chains = 'chains', | ||
Fees = 'fees', | ||
Versions = 'versions', | ||
} | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Controller, Get } from '@nestjs/common'; | ||
|
||
// configs | ||
import { chains } from '@app/configs'; | ||
|
||
// enums | ||
import { APIPathEnum } from '@app/enums'; | ||
|
||
// types | ||
import type { IChainResponseBody } from '@app/types'; | ||
|
||
// utils | ||
import mapChainConfigToChainResponseBody from '@app/utils/mapChainConfigToChainResponseBody'; | ||
|
||
@Controller(APIPathEnum.Chains) | ||
export default class ChainsController { | ||
@Get() | ||
public async get(): Promise<IChainResponseBody[]> { | ||
return chains.map(mapChainConfigToChainResponseBody); | ||
} | ||
} |
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,31 @@ | ||
import { HttpStatus } from '@nestjs/common'; | ||
import { agent as request, Response, Agent } from 'supertest'; | ||
|
||
// configs | ||
import { chains } from '@app/configs'; | ||
|
||
// enums | ||
import { APIPathEnum } from '@app/enums'; | ||
|
||
// utils | ||
import mapChainConfigToChainResponseBody from '@app/utils/mapChainConfigToChainResponseBody'; | ||
|
||
describe(`/${APIPathEnum.Chains}`, () => { | ||
let agent: Agent; | ||
|
||
beforeAll(async () => { | ||
agent = request(`http://127.0.0.1:3000`); | ||
}); | ||
|
||
describe(`GET /${APIPathEnum.Chains}`, () => { | ||
it('should return the chain configuration', async () => { | ||
const response: Response = await agent | ||
.get(`/${APIPathEnum.Chains}`) | ||
.expect(HttpStatus.OK); | ||
|
||
expect(response.body).toEqual( | ||
chains.map(mapChainConfigToChainResponseBody) | ||
); | ||
}); | ||
}); | ||
}); |
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,9 @@ | ||
import { Module } from '@nestjs/common'; | ||
|
||
// controllers | ||
import ChainsController from './controller'; | ||
|
||
@Module({ | ||
controllers: [ChainsController], | ||
}) | ||
export default class ChainsModule {} |
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,17 @@ | ||
interface IProps { | ||
chainId: string; | ||
limit?: number; | ||
page?: number; | ||
} | ||
|
||
export default class FindByPageDTO { | ||
public readonly chainId: string; | ||
public readonly limit?: number; | ||
public readonly page?: number; | ||
|
||
constructor({ chainId, limit, page }: IProps) { | ||
this.chainId = chainId; | ||
this.limit = limit; | ||
this.page = page; | ||
} | ||
} |
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 +1,2 @@ | ||
export { default as CreateDTO } from './CreateDTO'; | ||
export { default as FindByPageDTO } from './FindByPageDTO'; |
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,2 +1,3 @@ | ||
export { default as FeeRepositoryService } from './service'; | ||
export * from './dtos'; | ||
export * from './types'; |
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
9 changes: 9 additions & 0 deletions
9
src/modules/fee-repository/types/IFindByPageAggregateResult.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,9 @@ | ||
// types | ||
import type { IFeeDocument } from '@app/types'; | ||
|
||
interface IFindByPageAggregateResult { | ||
data: IFeeDocument[]; | ||
metadata: Record<'total', number>; | ||
} | ||
|
||
export default IFindByPageAggregateResult; |
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,11 @@ | ||
// types | ||
import type { IFeeDocument } from '@app/types'; | ||
|
||
interface IFindByPageResult { | ||
data: IFeeDocument[]; | ||
limit: number; | ||
page: number; | ||
total: number; | ||
} | ||
|
||
export default IFindByPageResult; |
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,2 @@ | ||
export { default as IFindByPageAggregateResult } from './IFindByPageAggregateResult'; | ||
export { default as IFindByPageResult } from './IFindByPageResult'; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.