@@ -1955,15 +1955,6 @@
|
||||
"length": 26,
|
||||
"mappedType": "character"
|
||||
},
|
||||
"quantity": {
|
||||
"name": "quantity",
|
||||
"type": "int",
|
||||
"unsigned": false,
|
||||
"autoincrement": false,
|
||||
"primary": false,
|
||||
"nullable": false,
|
||||
"mappedType": "integer"
|
||||
},
|
||||
"description": {
|
||||
"name": "description",
|
||||
"type": "text",
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Migration } from '@mikro-orm/migrations';
|
||||
|
||||
export class Migration20260626160000 extends Migration {
|
||||
|
||||
override async up(): Promise<void> {
|
||||
this.addSql(`alter table "request_items" drop column "quantity";`);
|
||||
}
|
||||
|
||||
override async down(): Promise<void> {
|
||||
this.addSql(`alter table "request_items" add column "quantity" int not null default 1;`);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,9 @@
|
||||
import {
|
||||
IsString,
|
||||
IsArray,
|
||||
IsNumber,
|
||||
IsNotEmpty,
|
||||
ArrayMinSize,
|
||||
IsOptional,
|
||||
Min,
|
||||
ValidateNested,
|
||||
} from 'class-validator';
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
@@ -36,11 +34,6 @@ export class CreateRequestItemDto {
|
||||
@ApiProperty()
|
||||
productId: string;
|
||||
|
||||
@IsNumber()
|
||||
@Min(1, { message: 'Quantity must be at least 1' })
|
||||
@ApiProperty({ minimum: 1 })
|
||||
quantity: number;
|
||||
|
||||
@ApiPropertyOptional({ type: [RequestItemDto], description: 'Product attribute field values' })
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@@ -69,7 +62,6 @@ export class CreateRequestDto {
|
||||
example: [
|
||||
{
|
||||
productId: '01ARZ3NDEKTSV4RRFFQ69G5FAV',
|
||||
quantity: 100,
|
||||
attributes: [{ fieldId: 'field_01', value: 'blue' }],
|
||||
attachments: [{ type: 'image', url: 'https://example.com/photo.jpg' }],
|
||||
description: 'توضیحات',
|
||||
|
||||
@@ -18,9 +18,6 @@ export class RequestItem extends BaseEntity {
|
||||
@ManyToOne(() => Request)
|
||||
request!: Request;
|
||||
|
||||
@Property({ type: 'int' })
|
||||
quantity!: number;
|
||||
|
||||
@Property({ type: 'text', nullable: true })
|
||||
description?: string;
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@ export class RequestService {
|
||||
const requestItem = em.create(RequestItem, {
|
||||
request,
|
||||
product,
|
||||
quantity: item.quantity,
|
||||
attributes: item.attributes,
|
||||
description: item.description,
|
||||
attachments: item.attachments,
|
||||
@@ -143,7 +142,6 @@ export class RequestService {
|
||||
const requestItem = em.create(RequestItem, {
|
||||
request,
|
||||
product,
|
||||
quantity: item.quantity,
|
||||
attributes: item.attributes,
|
||||
description: item.description,
|
||||
attachments: item.attachments,
|
||||
@@ -179,7 +177,6 @@ export class RequestService {
|
||||
const requestItem = em.create(RequestItem, {
|
||||
request,
|
||||
product,
|
||||
quantity: item.quantity,
|
||||
attributes: item.attributes,
|
||||
description: item.description,
|
||||
attachments: item.attachments,
|
||||
|
||||
Reference in New Issue
Block a user