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

Implement GET /v1/accounts/:address #1706

Merged
merged 2 commits into from
Jul 1, 2024
Merged

Implement GET /v1/accounts/:address #1706

merged 2 commits into from
Jul 1, 2024

Conversation

hectorgomezv
Copy link
Member

Summary

This PR adds the endpoint:

GET /v1/accounts/:address
  • The endpoint expects an address in the request path, targeting the Ethereum address associated with the account.
  • The endpoint is authenticated using SIWE, so an accessToken associated with the address needs to be provided. Otherwise, a 403 status will be returned.

Changes

  • The endpoint GET /v1/accounts/:address was added to AccountsController, protected by AuthGuard.
  • Associated tests and domain classes were added.

@hectorgomezv hectorgomezv self-assigned this Jul 1, 2024
@hectorgomezv hectorgomezv requested a review from a team as a code owner July 1, 2024 08:25
@coveralls
Copy link

coveralls commented Jul 1, 2024

Pull Request Test Coverage Report for Build 9741903979

Details

  • 1 of 19 (5.26%) changed or added relevant lines in 3 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.05%) to 48.646%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/routes/accounts/accounts.controller.ts 1 3 33.33%
src/routes/accounts/accounts.service.ts 0 4 0.0%
src/domain/accounts/accounts.repository.ts 0 12 0.0%
Files with Coverage Reduction New Missed Lines %
src/domain/accounts/accounts.repository.ts 2 22.73%
Totals Coverage Status
Change from base Build 9715533245: -0.05%
Covered Lines: 4202
Relevant Lines: 6970

💛 - Coveralls

@hectorgomezv hectorgomezv merged commit 7ff0f18 into main Jul 1, 2024
16 checks passed
@hectorgomezv hectorgomezv deleted the get-accounts branch July 1, 2024 10:31
Comment on lines +43 to +48
@UseGuards(AuthGuard)
async getAccount(
@Param('address', new ValidationPipe(AddressSchema)) address: `0x${string}`,
@Req() request: Request,
): Promise<Account> {
const auth = request.accessToken;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the AuthGuard, we will already have access to the AuthPayload here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened a PR changing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants