add scalar api reference

This commit is contained in:
2024-04-12 21:20:28 +02:00
parent 78d77ffd05
commit 616626b4ce
23 changed files with 2428 additions and 23 deletions

View File

@@ -15,6 +15,7 @@ import {
import { CommandBus } from '@nestjs/cqrs'
import { FileFieldsInterceptor } from '@nestjs/platform-express'
import {
ApiBearerAuth,
ApiConsumes,
ApiNoContentResponse,
ApiNotFoundResponse,
@@ -38,6 +39,7 @@ export class CardsController {
@ApiOperation({ summary: 'Get card by id', description: 'Get card by id' })
@ApiUnauthorizedResponse({ description: 'Unauthorized' })
@ApiNotFoundResponse({ description: 'Card not found' })
@ApiBearerAuth()
@Get(':id')
findOne(@Param('id') id: string): Promise<CardWithGrade> {
return this.commandBus.execute(new GetDeckByIdCommand(id))
@@ -48,6 +50,7 @@ export class CardsController {
@ApiUnauthorizedResponse({ description: 'Unauthorized' })
@ApiNotFoundResponse({ description: 'Card not found' })
@UseGuards(JwtAuthGuard)
@ApiBearerAuth()
@UseInterceptors(
FileFieldsInterceptor([
{ name: 'questionImg', maxCount: 1 },
@@ -69,6 +72,7 @@ export class CardsController {
@UseGuards(JwtAuthGuard)
@Delete(':id')
@ApiBearerAuth()
@ApiOperation({ summary: 'Delete card by id', description: 'Delete card by id' })
@ApiNoContentResponse({ description: 'New tokens generated successfully' })
@ApiUnauthorizedResponse({ description: 'Unauthorized' })

View File

@@ -1,5 +1,8 @@
import { IsOptional, Length } from 'class-validator'
import { ApiSchema } from '../../../infrastructure/common/helpers/api-schema'
@ApiSchema({ name: 'CreateCardRequest' })
export class CreateCardDto {
@Length(3, 500)
question: string

View File

@@ -2,8 +2,11 @@ import { PartialType } from '@nestjs/mapped-types'
import { ApiProperty } from '@nestjs/swagger'
import { IsOptional, Length } from 'class-validator'
import { ApiSchema } from '../../../infrastructure/common/helpers/api-schema'
import { CreateCardDto } from './create-card.dto'
@ApiSchema({ name: 'UpdateCardRequest' })
export class UpdateCardDto extends PartialType(CreateCardDto) {
@IsOptional()
@Length(3, 500)