|
@@ -113,11 +113,14 @@ export const GET = withAuth(async (request) => {
|
|
case "reason":
|
|
case "reason":
|
|
searchQuery.reason = { $regex: value, $options: "i" };
|
|
searchQuery.reason = { $regex: value, $options: "i" };
|
|
break;
|
|
break;
|
|
- case "dateRange":
|
|
|
|
- const [startDate, endDate] = value.split(",");
|
|
|
|
|
|
+ case "startExchangeTime":
|
|
searchQuery.createdAt = {
|
|
searchQuery.createdAt = {
|
|
- $gte: new Date(startDate),
|
|
|
|
- $lte: new Date(endDate),
|
|
|
|
|
|
+ $gte: new Date(value),
|
|
|
|
+ };
|
|
|
|
+ break;
|
|
|
|
+ case "endExchangeTime":
|
|
|
|
+ searchQuery.createdAt = {
|
|
|
|
+ $lte: new Date(value),
|
|
};
|
|
};
|
|
break;
|
|
break;
|
|
case "id":
|
|
case "id":
|
|
@@ -126,8 +129,6 @@ export const GET = withAuth(async (request) => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- console.log("Search Query:", searchQuery);
|
|
|
|
-
|
|
|
|
const total = await PointHistory.countDocuments(searchQuery);
|
|
const total = await PointHistory.countDocuments(searchQuery);
|
|
const history = await PointHistory.find(searchQuery)
|
|
const history = await PointHistory.find(searchQuery)
|
|
.sort({ createdAt: -1 })
|
|
.sort({ createdAt: -1 })
|