Commit 7ad5408a authored by nanahira's avatar nanahira

new

parent 0966866f
Pipeline #14515 passed with stages
in 1 minute and 47 seconds
......@@ -36,6 +36,10 @@ export type ParseType<T extends ClassOrArray> = T extends [infer U]
? TypeFromClass<U>[]
: TypeFromClass<T>;
function getClass(o: ClassOrArray) {
return o instanceof Array ? o[0] : o;
}
export function ReturnMessageDto<T extends ClassOrArray>(type: T) {
const cl = class SpecificReturnMessage extends BlankReturnMessageDto {
data?: ParseType<T>;
......@@ -45,5 +49,8 @@ export function ReturnMessageDto<T extends ClassOrArray>(type: T) {
}
};
ApiProperty({ description: '返回数据', type })(cl.prototype, 'data');
Object.defineProperty(cl, 'name', {
value: `${getClass(type).name}ReturnMessageDto`,
});
return cl;
}
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