From 6ea7307f3e343596655477737c983ce60c0a9f7d Mon Sep 17 00:00:00 2001 From: Kosta <68782786+KostaD02@users.noreply.github.com> Date: Tue, 12 Sep 2023 13:18:33 +0400 Subject: [PATCH] fix(products): isNumber validator causing error (#26) * fix(auth): added sameSite attribute * chore(release): 0.0.5 * chore(release): 0.0.6 * fix(products): isNumber validator causing error * chore(release): 0.0.7 --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- src/modules/shop/dtos/create-product.dto.ts | 2 +- src/modules/shop/dtos/product-category.dto.ts | 2 -- tools/product-builder/main.js | 3 ++- 6 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0de8d18..f4da65e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [0.0.7](https://github.com/educata/everrest/compare/v0.0.6...v0.0.7) (2023-09-12) + + +### Bug Fixes + +* **products:** isNumber validator causing error ([fa9f2aa](https://github.com/educata/everrest/commit/fa9f2aa0bb9ac5f045f1c097df8d85d9ed99cf83)) + ### 0.0.6 (2023-09-12) diff --git a/package-lock.json b/package-lock.json index 59981c5..fd11496 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "everrest", - "version": "0.0.6", + "version": "0.0.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "everrest", - "version": "0.0.6", + "version": "0.0.7", "license": "UNLICENSED", "dependencies": { "@nestjs-modules/mailer": "^1.9.1", diff --git a/package.json b/package.json index e14e9dc..9489e2e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "everrest", - "version": "0.0.6", + "version": "0.0.7", "description": "", "author": "", "private": true, diff --git a/src/modules/shop/dtos/create-product.dto.ts b/src/modules/shop/dtos/create-product.dto.ts index b0cdfa9..e6814b4 100644 --- a/src/modules/shop/dtos/create-product.dto.ts +++ b/src/modules/shop/dtos/create-product.dto.ts @@ -35,7 +35,7 @@ export class CreateProductDto { @Type(() => ProductCategoryDto) category: ProductCategory; - @IsNumber(null, { message: ProductExceptionKeys.WarrantyMustBeNumber }) + @IsNumber({}, { message: ProductExceptionKeys.WarrantyMustBeNumber }) @IsPositive({ message: ProductExceptionKeys.InvalidWarranty }) warranty: number; diff --git a/src/modules/shop/dtos/product-category.dto.ts b/src/modules/shop/dtos/product-category.dto.ts index dbb2ad3..f266c72 100644 --- a/src/modules/shop/dtos/product-category.dto.ts +++ b/src/modules/shop/dtos/product-category.dto.ts @@ -1,11 +1,9 @@ import { IsString, IsUrl } from 'class-validator'; import { ProductExceptionKeys } from 'src/enums'; import { ProductCategory } from 'src/interfaces'; -import { MongooseId } from 'src/shared'; export class ProductCategoryDto implements ProductCategory { @IsString() - @MongooseId() id: string; @IsString({ message: ProductExceptionKeys.InvalidCategoryName }) diff --git a/tools/product-builder/main.js b/tools/product-builder/main.js index 7604344..0bf612b 100644 --- a/tools/product-builder/main.js +++ b/tools/product-builder/main.js @@ -37,6 +37,7 @@ productForm.addEventListener('submit', function (event) { images.push(image.value); } }); + localStorage.setItem('data', JSON.stringify(data)); const data = { title: formData.get('title'), description: formData.get('title'), @@ -60,7 +61,7 @@ productForm.addEventListener('submit', function (event) { }, images, }; - console.log(data); + sendRequest('POST', `${baseURL}/shop/products`, data); }); imageAddBtn.addEventListener('click', () => {