From ec28ea0c85e92f9fdc256d1c37ede4c66c63db8a Mon Sep 17 00:00:00 2001 From: MohammadHoseinPaymard Date: Tue, 7 Jan 2025 10:33:37 +0330 Subject: [PATCH] add readme --- README.md | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..771fa1a --- /dev/null +++ b/README.md @@ -0,0 +1,63 @@ +Convert Schema to Model in Nestjs + +``` sh + node index.js +``` + +just copy schema to ##schema.txt like this: +``` js +{ + // category: 'اطلاعات هویتی' + username: { + type: this.DataTypes.STRING(50), + allowNull: true, + desc: "نام کاربری", + category: "اطلاعات هویتی", + regex: "[^a-zA-Z0-9@_./-]+", + }, + password: { + type: this.DataTypes.TEXT, + allowNull: true, + desc: "کلمه‌ی عبور", + }, + firstName: { + type: this.DataTypes.STRING, + allowNull: true, + desc: "نام", + category: "اطلاعات هویتی", + regex: "[^ آابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهیئ]+", + readOnly: true, + } +} +``` + +and when index.js is executed, result will be: +``` js +@Column({ + type:DataType.STRING, + allowNull:true, + desc:"نام کاربری", + category:"اطلاعات هویتی", + regex:"[^a-zA-Z0-9@_./-]+", + validate:{is:/[^a-zA-Z0-9@_./-]+}/}, +}) +username:string; + +@Column({ + type:DataType.TEXT, + allowNull:true, + desc:"کلمه‌ی عبور", +}) +password:string; + +@Column({ + type:DataType.STRING, + allowNull:true, + desc:"نام", + category:"اطلاعات هویتی", + regex:"[^ آابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهیئ]+", + validate:{is:/[^ آابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهیئ]+}/}, + readOnly:true, +}) +firstName:string; +``` \ No newline at end of file