- change status to product history status
This commit is contained in:
parent
b13a38590c
commit
25a48ff39f
|
@ -3,6 +3,7 @@ import { ProductSubCategories } from './product-sub-category.entity';
|
||||||
import { BaseModel } from '../../config/basemodel.entity';
|
import { BaseModel } from '../../config/basemodel.entity';
|
||||||
import { Supplier } from '../../users/entities/supplier.entity';
|
import { Supplier } from '../../users/entities/supplier.entity';
|
||||||
import { ProductHistoryPrice } from './product-history-price.entity';
|
import { ProductHistoryPrice } from './product-history-price.entity';
|
||||||
|
import {ProductHistoryStatus} from "./product-history-status.entity";
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class Product extends BaseModel {
|
export class Product extends BaseModel {
|
||||||
|
@ -53,6 +54,17 @@ export class Product extends BaseModel {
|
||||||
)
|
)
|
||||||
supplier: Supplier;
|
supplier: Supplier;
|
||||||
|
|
||||||
|
|
||||||
|
@OneToMany(
|
||||||
|
() => {
|
||||||
|
return ProductHistoryStatus;
|
||||||
|
},
|
||||||
|
(php) => {
|
||||||
|
return php.product;
|
||||||
|
},
|
||||||
|
)
|
||||||
|
statusHistory: ProductHistoryStatus;
|
||||||
|
|
||||||
@OneToMany(
|
@OneToMany(
|
||||||
() => {
|
() => {
|
||||||
return ProductHistoryPrice;
|
return ProductHistoryPrice;
|
||||||
|
|
|
@ -310,7 +310,7 @@ export class TransactionService {
|
||||||
'prepaid',
|
'prepaid',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!productData.status.includes('ACTIVE')) {
|
if (!productData.statusHistory.status.includes('ACTIVE')) {
|
||||||
throw new HttpException(
|
throw new HttpException(
|
||||||
{
|
{
|
||||||
statusCode: HttpStatus.INTERNAL_SERVER_ERROR,
|
statusCode: HttpStatus.INTERNAL_SERVER_ERROR,
|
||||||
|
@ -467,7 +467,7 @@ export class TransactionService {
|
||||||
'prepaid',
|
'prepaid',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!productData.status.includes('ACTIVE')) {
|
if (!productData.statusHistory.status.includes('ACTIVE')) {
|
||||||
throw new HttpException(
|
throw new HttpException(
|
||||||
{
|
{
|
||||||
statusCode: HttpStatus.INTERNAL_SERVER_ERROR,
|
statusCode: HttpStatus.INTERNAL_SERVER_ERROR,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user