fix: fix product upload
This commit is contained in:
parent
ad71d81b4e
commit
f5b510d75b
|
@ -84,28 +84,22 @@ export class ProductService {
|
||||||
where: {
|
where: {
|
||||||
product: productData.id,
|
product: productData.id,
|
||||||
partner: partnerData.id,
|
partner: partnerData.id,
|
||||||
|
endDate: IsNull(),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
dataHistoryPrice = await this.productHistoryPrice.findOne({
|
dataHistoryPrice = await this.productHistoryPrice.findOne({
|
||||||
product: productData,
|
product: productData,
|
||||||
partner: IsNull(),
|
partner: IsNull(),
|
||||||
|
endDate: IsNull(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dataHistoryPrice) {
|
if (dataHistoryPrice) {
|
||||||
await this.productHistoryPrice.insert({
|
await this.productHistoryPrice.update(dataHistoryPrice.id, {
|
||||||
product: productData,
|
endDate: new Date(),
|
||||||
mark_up_price: it[4],
|
|
||||||
price: it[3],
|
|
||||||
type: productType.NORMAL,
|
|
||||||
startDate: new Date(),
|
|
||||||
partner: it[6] != '-' ? partnerData : null,
|
|
||||||
});
|
});
|
||||||
} else {
|
}
|
||||||
dataHistoryPrice.endDate = new Date();
|
|
||||||
await this.productHistoryPrice.save(dataHistoryPrice);
|
|
||||||
|
|
||||||
await this.productHistoryPrice.insert({
|
await this.productHistoryPrice.insert({
|
||||||
product: productData,
|
product: productData,
|
||||||
|
@ -115,7 +109,6 @@ export class ProductService {
|
||||||
startDate: new Date(),
|
startDate: new Date(),
|
||||||
partner: it[6] != '-' ? partnerData : null,
|
partner: it[6] != '-' ? partnerData : null,
|
||||||
});
|
});
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
let partnerData;
|
let partnerData;
|
||||||
if (it[6] != '-' && it[6] != '') {
|
if (it[6] != '-' && it[6] != '') {
|
||||||
|
|
|
@ -1062,7 +1062,7 @@ export class TransactionService {
|
||||||
'status',
|
'status',
|
||||||
'userData.name',
|
'userData.name',
|
||||||
])
|
])
|
||||||
.orderBy('transaction.created_at','DESC');
|
.orderBy('transaction.created_at', 'DESC');
|
||||||
|
|
||||||
if (startDate && endDate) {
|
if (startDate && endDate) {
|
||||||
baseQuery.andWhere(
|
baseQuery.andWhere(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user