|
| 1 | +import { |
| 2 | + Controller, |
| 3 | + Get, |
| 4 | + Param, |
| 5 | + UseGuards, |
| 6 | + Query, |
| 7 | + UseFilters, |
| 8 | +} from '@nestjs/common'; |
| 9 | +import { StatusService } from './status.service'; |
| 10 | + |
| 11 | +import { ApiBearerAuth, ApiParam, ApiQuery, ApiTags } from '@nestjs/swagger'; |
| 12 | +import { AuthGuard } from '@nestjs/passport'; |
| 13 | +import { PaginationDto } from 'src/utils/pagination.dto'; |
| 14 | +import { AllExceptionsFilter } from 'src/utils/utils'; |
| 15 | +@UseFilters(AllExceptionsFilter) |
| 16 | +@ApiTags('Status') |
| 17 | +@ApiBearerAuth('Authorization') |
| 18 | +@Controller('status') |
| 19 | +@UseGuards(AuthGuard('jwt')) |
| 20 | +export class StatusController { |
| 21 | + constructor(private readonly statusService: StatusService) {} |
| 22 | + |
| 23 | + @Get('ssi/:id') |
| 24 | + @ApiQuery({ |
| 25 | + name: 'page', |
| 26 | + description: 'Page value', |
| 27 | + required: false, |
| 28 | + }) |
| 29 | + @ApiQuery({ |
| 30 | + name: 'limit', |
| 31 | + description: 'Fetch limited list of data', |
| 32 | + required: false, |
| 33 | + }) |
| 34 | + @ApiParam({ |
| 35 | + name: 'id', |
| 36 | + description: 'Enter didId or vcId or schemaId', |
| 37 | + }) |
| 38 | + getStatus(@Param('id') id: string, @Query() pagination: PaginationDto) { |
| 39 | + return this.statusService.findBySsiId(id, pagination); |
| 40 | + } |
| 41 | + |
| 42 | + @Get('transaction/:transactionHash') |
| 43 | + @ApiQuery({ |
| 44 | + name: 'page', |
| 45 | + description: 'Page value', |
| 46 | + required: false, |
| 47 | + }) |
| 48 | + @ApiQuery({ |
| 49 | + name: 'limit', |
| 50 | + description: 'Fetch limited list of data', |
| 51 | + required: false, |
| 52 | + }) |
| 53 | + @ApiParam({ |
| 54 | + name: 'transactionHash', |
| 55 | + description: 'Enter transactionHash', |
| 56 | + }) |
| 57 | + getStatusByTransactionHash( |
| 58 | + @Param('transactionHash') transactionHash: string, |
| 59 | + @Query() pagination: PaginationDto, |
| 60 | + ) { |
| 61 | + return this.statusService.findByTxnId(transactionHash, pagination); |
| 62 | + } |
| 63 | +} |
0 commit comments