mirror of
https://github.com/ershisan99/flashcards-api.git
synced 2025-12-27 12:34:10 +00:00
add scalar api reference
This commit is contained in:
@@ -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' })
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user