-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: extend irec claim data (#3336)
- Loading branch information
Showing
52 changed files
with
3,068 additions
and
979 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,6 +70,10 @@ common/autoinstallers/*/.npmrc | |
# Vscode | ||
.vscode | ||
|
||
# Emacs | ||
.#* | ||
#* | ||
|
||
# !Ignore | ||
!.env.example | ||
!.env.test | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
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
36 changes: 2 additions & 34 deletions
36
packages/traceability/issuer-irec-api/src/pods/certificate/certificate.controller.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 |
---|---|---|
@@ -1,52 +1,20 @@ | ||
import { ApiBearerAuth, ApiBody, ApiResponse, ApiTags } from '@nestjs/swagger'; | ||
import { AuthGuard } from '@nestjs/passport'; | ||
import { ApiBearerAuth, ApiTags } from '@nestjs/swagger'; | ||
import { | ||
Body, | ||
Controller, | ||
HttpStatus, | ||
Param, | ||
ParseIntPipe, | ||
Put, | ||
UseGuards, | ||
UseInterceptors, | ||
UsePipes, | ||
ValidationPipe | ||
} from '@nestjs/common'; | ||
|
||
import { | ||
ActiveUserGuard, | ||
BlockchainAccountGuard, | ||
ExceptionInterceptor, | ||
UserDecorator | ||
} from '@energyweb/origin-backend-utils'; | ||
import { CertificateController, TxHashDTO } from '@energyweb/issuer-api'; | ||
import { ClaimIrecCertificateDTO } from './dto/claim-irec-certificate.dto'; | ||
import { ILoggedInUser } from '@energyweb/origin-backend-core'; | ||
import { ClaimIRECCertificateCommand } from './command'; | ||
import { CertificateController } from '@energyweb/issuer-api'; | ||
|
||
@ApiTags('irec-certificates') | ||
@ApiBearerAuth('access-token') | ||
@Controller('/irec/certificate') | ||
@UseInterceptors(ExceptionInterceptor) | ||
@UsePipes(ValidationPipe) | ||
export class IrecCertificateController extends CertificateController { | ||
@Put('/:id/claim') | ||
@UseGuards(AuthGuard(), ActiveUserGuard, BlockchainAccountGuard) | ||
@ApiBody({ type: ClaimIrecCertificateDTO }) | ||
@ApiResponse({ | ||
status: HttpStatus.OK, | ||
type: TxHashDTO, | ||
description: 'Returns whether the claim succeeded' | ||
}) | ||
public async claimIREC( | ||
@UserDecorator() user: ILoggedInUser, | ||
@Param('id', new ParseIntPipe()) certificateId: number, | ||
@Body() dto: ClaimIrecCertificateDTO | ||
): Promise<TxHashDTO> { | ||
const tx = await this.commandBus.execute( | ||
new ClaimIRECCertificateCommand(user, certificateId, dto.claimData) | ||
); | ||
|
||
return { txHash: tx.hash }; | ||
} | ||
} |
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
12 changes: 0 additions & 12 deletions
12
...aceability/issuer-irec-api/src/pods/certificate/command/claim-irec-certificate.command.ts
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
packages/traceability/issuer-irec-api/src/pods/certificate/command/index.ts
This file was deleted.
Oops, something went wrong.
45 changes: 0 additions & 45 deletions
45
packages/traceability/issuer-irec-api/src/pods/certificate/dto/claim-irec-certificate.dto.ts
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
packages/traceability/issuer-irec-api/src/pods/certificate/dto/index.ts
This file was deleted.
Oops, something went wrong.
41 changes: 0 additions & 41 deletions
41
...aceability/issuer-irec-api/src/pods/certificate/handler/claim-irec-certificate.handler.ts
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
packages/traceability/issuer-irec-api/src/pods/certificate/handler/index.ts
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.