chore: fix problem of transcation beeing commited throw update the "
category variant
This commit is contained in:
@@ -1720,10 +1720,8 @@ class OrderItemRepo extends BaseRepository<IOrderItem> {
|
||||
async getDailyShipmentSalesReport() {
|
||||
const today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
console.log(today);
|
||||
const startOfDay = new Date(today.getFullYear(), today.getMonth(), today.getDate());
|
||||
const endOfDay = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59, 999);
|
||||
console.log({ today, startOfDay, endOfDay });
|
||||
const salesData = await this.model.aggregate([
|
||||
{
|
||||
$match: {
|
||||
@@ -1752,7 +1750,6 @@ class OrderItemRepo extends BaseRepository<IOrderItem> {
|
||||
itemsSold: 0,
|
||||
totalOrders: 0,
|
||||
};
|
||||
console.log(salesData);
|
||||
return salesData.length > 0 ? salesData[0] : defaultData;
|
||||
}
|
||||
|
||||
@@ -1763,7 +1760,6 @@ class OrderItemRepo extends BaseRepository<IOrderItem> {
|
||||
startOfWeek.setDate(today.getDate() - 6); // 7 days ago
|
||||
const endOfWeek = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59, 999);
|
||||
|
||||
console.log({ today, startOfWeek, endOfWeek });
|
||||
const salesData = await this.model.aggregate([
|
||||
{
|
||||
$match: {
|
||||
@@ -1792,7 +1788,6 @@ class OrderItemRepo extends BaseRepository<IOrderItem> {
|
||||
itemsSold: 0,
|
||||
totalOrders: 0,
|
||||
};
|
||||
console.log(salesData);
|
||||
return salesData.length > 0 ? salesData[0] : defaultData;
|
||||
}
|
||||
|
||||
@@ -1801,7 +1796,6 @@ class OrderItemRepo extends BaseRepository<IOrderItem> {
|
||||
const startOfMonth = new Date(today.getFullYear(), today.getMonth(), 1);
|
||||
const endOfMonth = new Date(today.getFullYear(), today.getMonth() + 1, 1);
|
||||
|
||||
console.log({ today, startOfMonth, endOfMonth });
|
||||
const salesData = await this.model.aggregate([
|
||||
{
|
||||
$match: {
|
||||
@@ -1830,7 +1824,6 @@ class OrderItemRepo extends BaseRepository<IOrderItem> {
|
||||
itemsSold: 0,
|
||||
totalOrders: 0,
|
||||
};
|
||||
console.log(salesData);
|
||||
return salesData.length > 0 ? salesData[0] : defaultData;
|
||||
}
|
||||
|
||||
@@ -1839,7 +1832,6 @@ class OrderItemRepo extends BaseRepository<IOrderItem> {
|
||||
const startOfYear = new Date(today.getFullYear(), 0, 1);
|
||||
const endOfYear = new Date(today.getFullYear() + 1, 0, 1);
|
||||
|
||||
console.log({ today, startOfYear, endOfYear });
|
||||
const salesData = await this.model.aggregate([
|
||||
{
|
||||
$match: {
|
||||
@@ -1868,17 +1860,14 @@ class OrderItemRepo extends BaseRepository<IOrderItem> {
|
||||
itemsSold: 0,
|
||||
totalOrders: 0,
|
||||
};
|
||||
console.log(salesData);
|
||||
return salesData.length > 0 ? salesData[0] : defaultData;
|
||||
}
|
||||
|
||||
async getDailySalesReport() {
|
||||
const today = new Date();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
console.log(today);
|
||||
const startOfDay = new Date(today.getFullYear(), today.getMonth(), today.getDate());
|
||||
const endOfDay = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59, 999);
|
||||
console.log({ today, startOfDay, endOfDay });
|
||||
const salesData = await this.model.aggregate([
|
||||
{
|
||||
$match: {
|
||||
@@ -1909,7 +1898,6 @@ class OrderItemRepo extends BaseRepository<IOrderItem> {
|
||||
itemsSold: 0,
|
||||
totalOrders: 0,
|
||||
};
|
||||
console.log(salesData);
|
||||
return salesData.length > 0 ? salesData[0] : defaultData;
|
||||
}
|
||||
|
||||
@@ -1920,8 +1908,6 @@ class OrderItemRepo extends BaseRepository<IOrderItem> {
|
||||
startOfWeek.setDate(today.getDate() - 6); // 7 days ago
|
||||
const endOfWeek = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59, 999);
|
||||
|
||||
console.log({ today, startOfWeek, endOfWeek });
|
||||
|
||||
const salesData = await this.model.aggregate([
|
||||
{
|
||||
$match: {
|
||||
@@ -1952,7 +1938,6 @@ class OrderItemRepo extends BaseRepository<IOrderItem> {
|
||||
itemsSold: 0,
|
||||
totalOrders: 0,
|
||||
};
|
||||
console.log(salesData);
|
||||
return salesData.length > 0 ? salesData[0] : defaultData;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user