ackStage Backword Compatible
This commit is contained in:
1 parent
78a2e5d106
commit
6457984dd4
5 files changed
+24
-13
No files matched your search
@@ -598,7 +598,6 @@ class NetworkService {
|
|||||||
if (config.ack !== undefined) params.append("ack", config.ack);
|
if (config.ack !== undefined) params.append("ack", config.ack);
|
||||||
if (config.page) params.append("page", config.page);
|
if (config.page) params.append("page", config.page);
|
||||||
if (config.rowsPerPage) params.append("rowsPerPage", config.rowsPerPage);
|
if (config.rowsPerPage) params.append("rowsPerPage", config.rowsPerPage);
|
||||||
if (config.status !== undefined) params.append("status", config.status);
|
|
||||||
return this.axiosInstance.get(`/checks/team?${params.toString()}`);
|
return this.axiosInstance.get(`/checks/team?${params.toString()}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -610,12 +609,12 @@ class NetworkService {
|
|||||||
* @async
|
* @async
|
||||||
* @param {Object} config - The configuration object.
|
* @param {Object} config - The configuration object.
|
||||||
* @param {string} config.checkId - The ID of the check to update.
|
* @param {string} config.checkId - The ID of the check to update.
|
||||||
* @param {boolean} config.status - The status to update the check to.
|
* @param {boolean} config.ack - The acknowledgment to update the check to.
|
||||||
* @returns {Promise<AxiosResponse>} The response from the axios PUT request.
|
* @returns {Promise<AxiosResponse>} The response from the axios PUT request.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
async updateCheckStatus(config) {
|
async updateCheckStatus(config) {
|
||||||
return this.axiosInstance.put(`/checks/${config.checkId}`, {
|
return this.axiosInstance.put(`/checks/check/${config.checkId}`, {
|
||||||
ack: config.ack,
|
ack: config.ack,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class CheckController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
let { sortOrder, dateRange, filter, ack, page, rowsPerPage, status } = req.query;
|
let { sortOrder, dateRange, filter, ack, page, rowsPerPage } = req.query;
|
||||||
const { teamId } = req.user;
|
const { teamId } = req.user;
|
||||||
|
|
||||||
const checkData = await this.db.getChecksByTeam({
|
const checkData = await this.db.getChecksByTeam({
|
||||||
@@ -101,7 +101,6 @@ class CheckController {
|
|||||||
page,
|
page,
|
||||||
rowsPerPage,
|
rowsPerPage,
|
||||||
teamId,
|
teamId,
|
||||||
status,
|
|
||||||
});
|
});
|
||||||
return res.success({
|
return res.success({
|
||||||
msg: this.stringService.checkGet,
|
msg: this.stringService.checkGet,
|
||||||
|
|||||||
@@ -72,11 +72,17 @@ const getChecksByMonitor = async ({
|
|||||||
status = status === "true" ? true : status === "false" ? false : undefined;
|
status = status === "true" ? true : status === "false" ? false : undefined;
|
||||||
page = parseInt(page);
|
page = parseInt(page);
|
||||||
rowsPerPage = parseInt(rowsPerPage);
|
rowsPerPage = parseInt(rowsPerPage);
|
||||||
|
|
||||||
|
const ackStage =
|
||||||
|
ack === "true"
|
||||||
|
? { ack: true }
|
||||||
|
: { $or: [{ ack: false }, { ack: { $exists: false } }] };
|
||||||
|
|
||||||
// Match
|
// Match
|
||||||
const matchStage = {
|
const matchStage = {
|
||||||
monitorId: ObjectId.createFromHexString(monitorId),
|
monitorId: ObjectId.createFromHexString(monitorId),
|
||||||
...(typeof status !== "undefined" && { status }),
|
...(typeof status !== "undefined" && { status }),
|
||||||
...(typeof ack !== "undefined" && { ack: ack === "true" }),
|
...(typeof ack !== "undefined" && ackStage),
|
||||||
...(dateRangeLookup[dateRange] && {
|
...(dateRangeLookup[dateRange] && {
|
||||||
createdAt: {
|
createdAt: {
|
||||||
$gte: dateRangeLookup[dateRange],
|
$gte: dateRangeLookup[dateRange],
|
||||||
@@ -159,16 +165,20 @@ const getChecksByTeam = async ({
|
|||||||
page,
|
page,
|
||||||
rowsPerPage,
|
rowsPerPage,
|
||||||
teamId,
|
teamId,
|
||||||
status,
|
|
||||||
}) => {
|
}) => {
|
||||||
try {
|
try {
|
||||||
status = status === "true";
|
|
||||||
page = parseInt(page);
|
page = parseInt(page);
|
||||||
rowsPerPage = parseInt(rowsPerPage);
|
rowsPerPage = parseInt(rowsPerPage);
|
||||||
|
|
||||||
|
const ackStage =
|
||||||
|
ack === "true"
|
||||||
|
? { ack: true }
|
||||||
|
: { $or: [{ ack: false }, { ack: { $exists: false } }] };
|
||||||
|
|
||||||
const matchStage = {
|
const matchStage = {
|
||||||
teamId: ObjectId.createFromHexString(teamId),
|
teamId: new ObjectId(teamId),
|
||||||
status: status,
|
status: false,
|
||||||
...(typeof ack !== "undefined" && { ack: ack === "true" }),
|
...(typeof ack !== "undefined" && ackStage),
|
||||||
...(dateRangeLookup[dateRange] && {
|
...(dateRangeLookup[dateRange] && {
|
||||||
createdAt: {
|
createdAt: {
|
||||||
$gte: dateRangeLookup[dateRange],
|
$gte: dateRangeLookup[dateRange],
|
||||||
|
|||||||
@@ -22,7 +22,11 @@ class CheckRoutes {
|
|||||||
|
|
||||||
this.router.get("/:monitorId", this.checkController.getChecksByMonitor);
|
this.router.get("/:monitorId", this.checkController.getChecksByMonitor);
|
||||||
|
|
||||||
this.router.put("/:checkId", verifyTeamAccess(Check, "checkId"), this.checkController.ackCheck);
|
this.router.put(
|
||||||
|
"/check/:checkId",
|
||||||
|
verifyTeamAccess(Check, "checkId"),
|
||||||
|
this.checkController.ackCheck
|
||||||
|
);
|
||||||
|
|
||||||
this.router.put("/:path/:monitorId?", this.checkController.ackAllChecks);
|
this.router.put("/:path/:monitorId?", this.checkController.ackAllChecks);
|
||||||
|
|
||||||
|
|||||||
@@ -328,7 +328,6 @@ const getTeamChecksQueryValidation = joi.object({
|
|||||||
ack: joi.boolean(),
|
ack: joi.boolean(),
|
||||||
page: joi.number(),
|
page: joi.number(),
|
||||||
rowsPerPage: joi.number(),
|
rowsPerPage: joi.number(),
|
||||||
status: joi.boolean(),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const deleteChecksParamValidation = joi.object({
|
const deleteChecksParamValidation = joi.object({
|
||||||
|
|||||||
Reference in new issue
Block a user