import { Body, Controller, Get, Post, Query } from '@nestjs/common'; import { PowService } from './pow.service'; import { ApiBody, ApiQuery, ApiTags } from '@nestjs/swagger'; @ApiTags('pow') @Controller('pow') export class PowController { constructor( private readonly powService: PowService, ) { } @Get('challenge') async generateChallenge() { return this.powService.generateChallenge(); } @Post('challenge') @ApiBody({ schema: { properties: { challenge: { type: 'string' }, proof: { type: 'string' } } } }) async verifyChallenge(@Body() body: { challenge: string, proof: string }) { return this.powService.verifyChallenge(body.challenge, body.proof); } @Post('challenge/complete') @ApiBody({ schema: { properties: { challenge: { type: 'string' } } } }) async markChallengeAsComplete(@Body() body: { challenge: string }) { return this.powService.markChallengeAsComplete(body.challenge); } }