From a261b45e5de4dd9d62b0a9b54a029bb89b4b275c Mon Sep 17 00:00:00 2001 From: Hide_D Date: Fri, 4 Aug 2023 17:33:16 +0000 Subject: [PATCH] =?UTF-8?q?dto=20work=20-=20vscode=EC=AA=BD=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EA=B0=95=EC=A0=9C=EB=A1=9C=20=EB=82=B4=EB=8A=94=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20-=20.vscode/settings.json=20=EC=97=90?= =?UTF-8?q?=EC=84=9C=20"js/ts.implicitProjectConfig.experimentalDecorators?= =?UTF-8?q?":=20true=20=ED=95=84=EC=9A=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .nvmrc | 1 + server/api/index.ts | 11 ----------- server/index.ts | 17 +++++++++++++---- 3 files changed, 14 insertions(+), 15 deletions(-) create mode 100644 .nvmrc diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..2edeafb --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +20 \ No newline at end of file diff --git a/server/api/index.ts b/server/api/index.ts index 1dc743a..8e8a213 100644 --- a/server/api/index.ts +++ b/server/api/index.ts @@ -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; } \ No newline at end of file diff --git a/server/index.ts b/server/index.ts index 0cb6ca1..1dda256 100644 --- a/server/index.ts +++ b/server/index.ts @@ -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 {}; \ No newline at end of file