Commit 3de1715c authored by nanahira's avatar nanahira

add ApiTypeResponse and ApiBlankResponse

parent 04b49f1c
import { BlankReturnMessageDto } from './return-message'; import { BlankReturnMessageDto, ReturnMessageDto } from './return-message';
import { ApiResponse } from '@nestjs/swagger'; import { ApiResponse, ApiResponseOptions } from '@nestjs/swagger';
import { ClassOrArray } from './insert-field';
export const ApiTypeResponse = (
// eslint-disable-next-line @typescript-eslint/ban-types
type: ClassOrArray,
options: ApiResponseOptions = {},
) =>
ApiResponse({
status: 200,
type: ReturnMessageDto(type),
...options,
});
export const ApiBlankResponse = (options: ApiResponseOptions = {}) =>
ApiResponse({
status: 200,
type: BlankReturnMessageDto,
...options,
});
export const ApiError = (status: number, description: string) => export const ApiError = (status: number, description: string) =>
ApiResponse({ status, type: BlankReturnMessageDto, description }); ApiBlankResponse({ status, description });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment