dto work
- vscode쪽에서 강제로 내는 에러 - .vscode/settings.json 에서 "js/ts.implicitProjectConfig.experimentalDecorators": true 필요
This commit is contained in:
@@ -1,21 +1,10 @@
|
||||
import {
|
||||
validate,
|
||||
validateOrReject,
|
||||
Contains,
|
||||
IsInt,
|
||||
Length,
|
||||
IsEmail,
|
||||
IsFQDN,
|
||||
IsDate,
|
||||
Min,
|
||||
Max,
|
||||
IsString,
|
||||
} from 'class-validator';
|
||||
|
||||
export class BasicQueryDTO {
|
||||
@IsInt()
|
||||
generalID!: number;
|
||||
|
||||
@IsString()
|
||||
command!: string;
|
||||
}
|
||||
+13
-4
@@ -1,11 +1,20 @@
|
||||
//import 'reflect-metadata';
|
||||
//import { BasicQueryDTO } from './api';
|
||||
import 'reflect-metadata';
|
||||
import { BasicQueryDTO } from './api/index.js';
|
||||
import { validate } from 'class-validator';
|
||||
|
||||
export function test(){
|
||||
export async function test(){
|
||||
console.log("Hello World!");
|
||||
|
||||
const dto = new BasicQueryDTO();
|
||||
dto.command = 'None';
|
||||
dto.generalID = 1.1;
|
||||
|
||||
const result = await validate(dto);
|
||||
console.log(result);
|
||||
//must be integer가 나타나야함
|
||||
}
|
||||
|
||||
|
||||
test();
|
||||
await test();
|
||||
|
||||
export default {};
|
||||
Reference in New Issue
Block a user