add: order status in orders get

This commit is contained in:
morteza-mortezai
2025-10-31 17:36:12 +03:30
parent 88cc00ae6b
commit ddd662b3b6
4 changed files with 27 additions and 5 deletions
+1
View File
@@ -51,6 +51,7 @@ export type SellerOrdersQueries = {
limit: number; limit: number;
shipperId: string; shipperId: string;
status: string; status: string;
paymentStatus: string;
since: number; since: number;
maxPrice: number; maxPrice: number;
minPrice: number; minPrice: number;
@@ -159,7 +159,11 @@ export class AdminOrderController extends BaseController {
@ApiQuery("limit", "the limit of return data") @ApiQuery("limit", "the limit of return data")
@ApiQuery("page", "the page want to get") @ApiQuery("page", "the page want to get")
@ApiQuery("shipperId", "shipper id") @ApiQuery("shipperId", "shipper id")
@ApiQuery("status", "status of payment ==> value = Completed | Cancelled | Pending ") @ApiQuery(
"status",
"status of payment ==> value = wait_payment | process_by_sellers | shipped | cancelled_system | cancelled | Delivered",
)
@ApiQuery("paymentStatus", "status of order ==> value = Completed | Cancelled | Pending ")
@ApiQuery( @ApiQuery(
"since", "since",
"time of order created ==> value should be standard timestamp since that time user want like == > Date.now() - (7 * 24 * 60 * 60 * 1000) ==> this mean from a week ago till now ", "time of order created ==> value should be standard timestamp since that time user want like == > Date.now() - (7 * 24 * 60 * 60 * 1000) ==> this mean from a week ago till now ",
@@ -174,6 +178,7 @@ export class AdminOrderController extends BaseController {
@queryParam("page") page: string, @queryParam("page") page: string,
@queryParam("shipperId") shipperId: string, @queryParam("shipperId") shipperId: string,
@queryParam("status") status: string, @queryParam("status") status: string,
@queryParam("paymentStatus") paymentStatus: string,
@queryParam("since") since: string, @queryParam("since") since: string,
@queryParam("maxPrice") maxPrice: string, @queryParam("maxPrice") maxPrice: string,
@queryParam("minPrice") minPrice: string, @queryParam("minPrice") minPrice: string,
@@ -183,6 +188,7 @@ export class AdminOrderController extends BaseController {
page: parseInt(page), page: parseInt(page),
shipperId, shipperId,
status, status,
paymentStatus,
since: +since, since: +since,
maxPrice: +maxPrice, maxPrice: +maxPrice,
minPrice: +minPrice, minPrice: +minPrice,
@@ -198,7 +204,11 @@ export class AdminOrderController extends BaseController {
@ApiQuery("limit", "the limit of return data") @ApiQuery("limit", "the limit of return data")
@ApiQuery("page", "the page want to get") @ApiQuery("page", "the page want to get")
@ApiQuery("shipperId", "shipper id") @ApiQuery("shipperId", "shipper id")
@ApiQuery("status", "status of payment ==> value = Completed | Cancelled | Pending ") @ApiQuery(
"status",
"status of payment ==> value = wait_payment | process_by_sellers | shipped | cancelled_system | cancelled | Delivered",
)
@ApiQuery("paymentStatus", "status of order ==> value = Completed | Cancelled | Pending ")
@ApiQuery( @ApiQuery(
"since", "since",
"time of order created ==> value should be standard timestamp since that time user want like == > Date.now() - (7 * 24 * 60 * 60 * 1000) ==> this mean from a week ago till now ", "time of order created ==> value should be standard timestamp since that time user want like == > Date.now() - (7 * 24 * 60 * 60 * 1000) ==> this mean from a week ago till now ",
@@ -212,6 +222,7 @@ export class AdminOrderController extends BaseController {
@queryParam("page") page: string, @queryParam("page") page: string,
@queryParam("shipperId") shipperId: string, @queryParam("shipperId") shipperId: string,
@queryParam("status") status: string, @queryParam("status") status: string,
@queryParam("paymentStatus") paymentStatus: string,
@queryParam("since") since: string, @queryParam("since") since: string,
@queryParam("maxPrice") maxPrice: string, @queryParam("maxPrice") maxPrice: string,
@queryParam("minPrice") minPrice: string, @queryParam("minPrice") minPrice: string,
@@ -221,6 +232,7 @@ export class AdminOrderController extends BaseController {
page: parseInt(page), page: parseInt(page),
shipperId, shipperId,
status, status,
paymentStatus,
since: +since, since: +since,
maxPrice: +maxPrice, maxPrice: +maxPrice,
minPrice: +minPrice, minPrice: +minPrice,
+5 -2
View File
@@ -768,7 +768,10 @@ class OrderItemRepo extends BaseRepository<IOrderItem> {
{ {
$match: { $match: {
...(queries.status && { ...(queries.status && {
"order.payment.paymentStatus": queries.status, "order.orderStatus": queries.status,
}),
...(queries.paymentStatus && {
"order.payment.paymentStatus": queries.paymentStatus,
}), }),
...(queries.shipperId && { ...(queries.shipperId && {
shipper: +queries.shipperId, shipper: +queries.shipperId,
@@ -882,7 +885,7 @@ class OrderItemRepo extends BaseRepository<IOrderItem> {
}, },
{ {
$sort: { $sort: {
"order.createdAt": -1, createdAt: -1,
}, },
}, },
{ {
+7 -1
View File
@@ -75,7 +75,11 @@ class SellerController extends BaseController {
@ApiQuery("limit", "the limit of return data") @ApiQuery("limit", "the limit of return data")
@ApiQuery("page", "the page want to get") @ApiQuery("page", "the page want to get")
@ApiQuery("shipperId", "shipper id") @ApiQuery("shipperId", "shipper id")
@ApiQuery("status", "status of payment ==> value = Completed | Cancelled | Pending ") @ApiQuery(
"status",
"status of payment ==> value = wait_payment | process_by_sellers | shipped | cancelled_system | cancelled | Delivered",
)
@ApiQuery("paymentStatus", "status of order ==> value = Completed | Cancelled | Pending ")
@ApiQuery( @ApiQuery(
"since", "since",
"time of order created ==> value should be standard timestamp since that time user want like == > Date.now() - (7 * 24 * 60 * 60 * 1000) ==> this mean from a week ago till now ", "time of order created ==> value should be standard timestamp since that time user want like == > Date.now() - (7 * 24 * 60 * 60 * 1000) ==> this mean from a week ago till now ",
@@ -91,6 +95,7 @@ class SellerController extends BaseController {
@queryParam("page") page: string, @queryParam("page") page: string,
@queryParam("shipperId") shipperId: string, @queryParam("shipperId") shipperId: string,
@queryParam("status") status: string, @queryParam("status") status: string,
@queryParam("paymentStatus") paymentStatus: string,
@queryParam("since") since: string, @queryParam("since") since: string,
@queryParam("maxPrice") maxPrice: string, @queryParam("maxPrice") maxPrice: string,
@queryParam("minPrice") minPrice: string, @queryParam("minPrice") minPrice: string,
@@ -101,6 +106,7 @@ class SellerController extends BaseController {
page: parseInt(page), page: parseInt(page),
shipperId, shipperId,
status, status,
paymentStatus,
since: +since, since: +since,
maxPrice: +maxPrice, maxPrice: +maxPrice,
minPrice: +minPrice, minPrice: +minPrice,