Merge pull request #3412 from bluewave-labs/fix/queueController-types

fix: QueueController Types
This commit is contained in:
Alexander Holliday authored and GitHub committed 2026-03-11 14:10:26 -07:00
commit a6b92d3c51
2 files changed
+3 -29

No files matched your search

+3 -27
View File
@@ -1,11 +1,12 @@
import { ISuperSimpleQueue } from "@/service/index.js";
import { Request, Response, NextFunction } from "express";
const SERVICE_NAME = "JobQueueController";
class JobQueueController {
static SERVICE_NAME = SERVICE_NAME;
private jobQueue: any;
constructor(jobQueue: any) {
private jobQueue: ISuperSimpleQueue;
constructor(jobQueue: ISuperSimpleQueue) {
this.jobQueue = jobQueue;
}
@@ -53,18 +54,6 @@ class JobQueueController {
}
};
addJob = async (req: Request, res: Response, next: NextFunction) => {
try {
await this.jobQueue.addJob(Math.random().toString(36).substring(7));
return res.status(200).json({
success: true,
msg: "Job added to queue successfully",
});
} catch (error) {
next(error);
}
};
flushQueue = async (req: Request, res: Response, next: NextFunction) => {
try {
const result = await this.jobQueue.flushQueues();
@@ -77,18 +66,5 @@ class JobQueueController {
next(error);
}
};
checkQueueHealth = async (req: Request, res: Response, next: NextFunction) => {
try {
const stuckQueues = await this.jobQueue.checkQueueHealth();
return res.status(200).json({
success: true,
msg: "Queue health checked successfully",
data: stuckQueues,
});
} catch (error) {
next(error);
}
};
}
export default JobQueueController;
-2
View File
@@ -11,10 +11,8 @@ class QueueRoutes {
}
initRoutes() {
this.router.get("/jobs", isAllowed(["admin", "superadmin"]), this.queueController.getJobs);
this.router.post("/jobs", isAllowed(["admin", "superadmin"]), this.queueController.addJob);
this.router.get("/metrics", isAllowed(["admin", "superadmin"]), this.queueController.getMetrics);
this.router.get("/health", isAllowed(["admin", "superadmin"]), this.queueController.checkQueueHealth);
this.router.get("/all-metrics", isAllowed(["admin", "superadmin"]), this.queueController.getAllMetrics);
this.router.post("/flush", isAllowed(["admin", "superadmin"]), this.queueController.flushQueue);
}