Compare commits
4 Commits
5ae75e2349
...
714beb92c3
| Author | SHA1 | Date | |
|---|---|---|---|
| 714beb92c3 | |||
| 2e42e82587 | |||
| 809da986d0 | |||
| bf7aa2fb61 |
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
IsDate,
|
||||
IsDateString,
|
||||
IsDecimal,
|
||||
IsInt,
|
||||
@@ -6,9 +7,9 @@ import {
|
||||
IsNumber,
|
||||
IsOptional,
|
||||
IsPositive,
|
||||
isString,
|
||||
IsString,
|
||||
} from 'class-validator';
|
||||
import { Column } from 'typeorm';
|
||||
|
||||
export class CreateInwardEntryDto {
|
||||
@IsNotEmpty()
|
||||
@@ -41,6 +42,7 @@ export class CreateInwardEntryDto {
|
||||
|
||||
@IsString()
|
||||
company_name: string;
|
||||
|
||||
@IsDateString()
|
||||
manufacuting_date: string;
|
||||
manufacturing_date: string;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import { CreateInwardEntryDto } from './create-inward-entry.dto';
|
||||
export class CreateInwardDto {
|
||||
@IsUUID()
|
||||
@IsNotEmpty()
|
||||
vendorId: string;
|
||||
vendorId: string;
|
||||
|
||||
@IsInt()
|
||||
@IsNotEmpty()
|
||||
|
||||
@@ -88,8 +88,11 @@ export class InventoryService {
|
||||
const savedInward = await this.inwardRepository.save(inward);
|
||||
|
||||
for (const entry of dto.entries) {
|
||||
const { manufacturing_date, ...data } = entry;
|
||||
console.log('manu date', manufacturing_date);
|
||||
const inwardEntry = this.inwardEntryRepository.create({
|
||||
...entry,
|
||||
...data,
|
||||
manufacuting_date: new Date(entry.manufacturing_date),
|
||||
inward: savedInward,
|
||||
});
|
||||
await this.inwardEntryRepository.save(inwardEntry);
|
||||
|
||||
Reference in New Issue
Block a user