Commit aae8117a authored by nanahira's avatar nanahira

update pure nest as well

parent 64872701
Pipeline #14527 failed with stages
in 31 seconds
import { ApiProperty } from '@nestjs/swagger'; import { ApiProperty } from '@nestjs/swagger';
import { HttpException } from '@nestjs/common'; import { HttpException } from '@nestjs/common';
import { PageSettingsWise } from './PageSettings.dto';
export interface BlankReturnMessage { export interface BlankReturnMessage {
statusCode: number; statusCode: number;
...@@ -12,11 +13,11 @@ export interface ReturnMessage<T> extends BlankReturnMessage { ...@@ -12,11 +13,11 @@ export interface ReturnMessage<T> extends BlankReturnMessage {
} }
export class BlankReturnMessageDto implements BlankReturnMessage { export class BlankReturnMessageDto implements BlankReturnMessage {
@ApiProperty({ description: '返回状态' }) @ApiProperty({ description: 'Return code' })
statusCode: number; statusCode: number;
@ApiProperty({ description: '返回信息' }) @ApiProperty({ description: 'Return message' })
message: string; message: string;
@ApiProperty({ description: '是否成功' }) @ApiProperty({ description: 'Whether success.' })
success: boolean; success: boolean;
constructor(statusCode: number, message?: string) { constructor(statusCode: number, message?: string) {
this.statusCode = statusCode; this.statusCode = statusCode;
...@@ -48,9 +49,22 @@ export function ReturnMessageDto<T extends ClassOrArray>(type: T) { ...@@ -48,9 +49,22 @@ export function ReturnMessageDto<T extends ClassOrArray>(type: T) {
this.data = data; this.data = data;
} }
}; };
ApiProperty({ description: '返回数据', type })(cl.prototype, 'data'); ApiProperty({ description: 'Return data.', type })(cl.prototype, 'data');
Object.defineProperty(cl, 'name', { Object.defineProperty(cl, 'name', {
value: `${getClass(type).name}ReturnMessageDto`, value: `${getClass(type).name}ReturnMessageDto`,
}); });
return cl; return cl;
} }
export class StringReturnMessageDto
extends BlankReturnMessageDto
implements ReturnMessage<string>
{
@ApiProperty({ description: 'Return data.' })
data?: string;
constructor(statusCode: number, message?: string, data?: string) {
super(statusCode, message);
this.data = data;
}
}
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