@@ -5,13 +5,23 @@ import {
55 UseGuards ,
66 Query ,
77 UseFilters ,
8+ UseInterceptors ,
89} from '@nestjs/common' ;
910import { StatusService } from './status.service' ;
1011
11- import { ApiBearerAuth , ApiParam , ApiQuery , ApiTags } from '@nestjs/swagger' ;
12+ import {
13+ ApiBearerAuth ,
14+ ApiParam ,
15+ ApiQuery ,
16+ ApiResponse ,
17+ ApiTags ,
18+ } from '@nestjs/swagger' ;
1219import { AuthGuard } from '@nestjs/passport' ;
1320import { PaginationDto } from 'src/utils/pagination.dto' ;
1421import { AllExceptionsFilter } from 'src/utils/utils' ;
22+ import { RegistrationStatus } from './schema/status.schema' ;
23+ import { RegistrationStatusList } from './dto/registration-status.response.dto' ;
24+ import { RegistrationStatusInterceptor } from './transformer/staus-response.interceptor' ;
1525@UseFilters ( AllExceptionsFilter )
1626@ApiTags ( 'Status' )
1727@ApiBearerAuth ( 'Authorization' )
@@ -21,6 +31,10 @@ export class StatusController {
2131 constructor ( private readonly statusService : StatusService ) { }
2232
2333 @Get ( 'ssi/:id' )
34+ @ApiResponse ( {
35+ description : 'List of the txns' ,
36+ type : RegistrationStatusList ,
37+ } )
2438 @ApiQuery ( {
2539 name : 'page' ,
2640 description : 'Page value' ,
@@ -35,11 +49,19 @@ export class StatusController {
3549 name : 'id' ,
3650 description : 'Enter didId or vcId or schemaId' ,
3751 } )
38- getStatus ( @Param ( 'id' ) id : string , @Query ( ) pagination : PaginationDto ) {
52+ @UseInterceptors ( RegistrationStatusInterceptor )
53+ getStatus (
54+ @Param ( 'id' ) id : string ,
55+ @Query ( ) pagination : PaginationDto ,
56+ ) : Promise < RegistrationStatusList > {
3957 return this . statusService . findBySsiId ( id , pagination ) ;
4058 }
4159
4260 @Get ( 'transaction/:transactionHash' )
61+ @ApiResponse ( {
62+ description : 'List of the txns' ,
63+ type : RegistrationStatusList ,
64+ } )
4365 @ApiQuery ( {
4466 name : 'page' ,
4567 description : 'Page value' ,
@@ -54,10 +76,11 @@ export class StatusController {
5476 name : 'transactionHash' ,
5577 description : 'Enter transactionHash' ,
5678 } )
79+ @UseInterceptors ( RegistrationStatusInterceptor )
5780 getStatusByTransactionHash (
5881 @Param ( 'transactionHash' ) transactionHash : string ,
5982 @Query ( ) pagination : PaginationDto ,
60- ) {
83+ ) : Promise < RegistrationStatusList > {
6184 return this . statusService . findByTxnId ( transactionHash , pagination ) ;
6285 }
6386}
0 commit comments