Compare commits
No commits in common. 'f190090be164a24362fea323091128126de50b6a' and '6945420e27b8a2313e9f39821e52cb0a4f3589b9' have entirely different histories.
f190090be1
...
6945420e27
8 changed files with 65 additions and 288 deletions
@ -1,65 +0,0 @@ |
||||
'use strict'; |
||||
|
||||
module.exports = { |
||||
up: async (queryInterface, Sequelize) => { |
||||
await queryInterface.createTable('Products', { |
||||
id: { |
||||
type: Sequelize.INTEGER, |
||||
allowNull: false, |
||||
autoIncrement: true, |
||||
primaryKey: true, |
||||
}, |
||||
name: { |
||||
type: Sequelize.STRING, |
||||
allowNull: false, |
||||
}, |
||||
description: { |
||||
type: Sequelize.STRING, |
||||
allowNull: false, |
||||
}, |
||||
price: { |
||||
type: Sequelize.DECIMAL(10, 2), |
||||
allowNull: false, |
||||
}, |
||||
imageUrl: { |
||||
type: Sequelize.STRING, |
||||
allowNull: true, |
||||
}, |
||||
tags: { |
||||
type: Sequelize.ARRAY(Sequelize.STRING), |
||||
allowNull: true, |
||||
}, |
||||
quantity: { |
||||
type: Sequelize.INTEGER, |
||||
allowNull: false, |
||||
defaultValue: 0, |
||||
}, |
||||
brand: { |
||||
type: Sequelize.STRING, |
||||
allowNull: true, |
||||
}, |
||||
color: { |
||||
type: Sequelize.STRING, |
||||
allowNull: true, |
||||
}, |
||||
category: { |
||||
type: Sequelize.STRING, |
||||
allowNull: false, |
||||
}, |
||||
createdAt: { |
||||
type: Sequelize.DATE, |
||||
allowNull: false, |
||||
defaultValue: Sequelize.NOW, |
||||
}, |
||||
updatedAt: { |
||||
type: Sequelize.DATE, |
||||
allowNull: false, |
||||
defaultValue: Sequelize.NOW, |
||||
}, |
||||
}); |
||||
}, |
||||
|
||||
down: async (queryInterface, Sequelize) => { |
||||
await queryInterface.dropTable('Products'); |
||||
}, |
||||
}; |
@ -1,41 +0,0 @@ |
||||
import { IsString, IsNumber, IsOptional, IsNotEmpty, IsArray } from 'class-validator'; |
||||
|
||||
export class CreateProductDto { |
||||
@IsString() |
||||
@IsNotEmpty() |
||||
name: string; |
||||
|
||||
@IsString() |
||||
@IsNotEmpty() |
||||
description: string; |
||||
|
||||
@IsNumber() |
||||
@IsNotEmpty() |
||||
price: number; |
||||
|
||||
@IsOptional() |
||||
@IsString() |
||||
imageUrl?: string; |
||||
|
||||
@IsOptional() |
||||
@IsArray() |
||||
@IsString({ each: true }) |
||||
tags?: string[]; |
||||
|
||||
@IsOptional() |
||||
@IsNumber() |
||||
@IsNotEmpty() |
||||
quantity?: number; |
||||
|
||||
@IsOptional() |
||||
@IsString() |
||||
brand?: string; |
||||
|
||||
@IsOptional() |
||||
@IsString() |
||||
color?: string; |
||||
|
||||
@IsString() |
||||
@IsNotEmpty() |
||||
category: string; |
||||
} |
@ -1,40 +0,0 @@ |
||||
import { IsString, IsNumber, IsOptional, IsArray } from 'class-validator'; |
||||
|
||||
export class UpdateProductDto { |
||||
@IsOptional() |
||||
@IsString() |
||||
name?: string; |
||||
|
||||
@IsOptional() |
||||
@IsString() |
||||
description?: string; |
||||
|
||||
@IsOptional() |
||||
@IsNumber() |
||||
price?: number; |
||||
|
||||
@IsOptional() |
||||
@IsString() |
||||
imageUrl?: string; |
||||
|
||||
@IsOptional() |
||||
@IsArray() |
||||
@IsString({ each: true }) |
||||
tags?: string[]; |
||||
|
||||
@IsOptional() |
||||
@IsNumber() |
||||
quantity?: number; |
||||
|
||||
@IsOptional() |
||||
@IsString() |
||||
brand?: string; |
||||
|
||||
@IsOptional() |
||||
@IsString() |
||||
color?: string; |
||||
|
||||
@IsOptional() |
||||
@IsString() |
||||
category?: string; |
||||
} |
Loading…
Reference in new issue