Skip to content

Commit 91c0983

Browse files
committed
fix: update res structure in export controller and handle unknown job type in email queue
1 parent 30e0182 commit 91c0983

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

apps/dashboard-api/src/controllers/dbExport.controller.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ module.exports.dbExportHandler = async (req, res, next) => {
5454
await exportQueue.add('export-database', { projectId, collectionName, userId, email });
5555

5656
return res.status(202).json({
57+
success: true,
58+
data: {},
5759
message: `Collection export request received. You will receive an email with a download link shortly. Usage today: ${newCount}/${maxExports}.`,
5860
});
5961

packages/common/src/queues/emailQueue.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const worker = new Worker('email-queue', async (job) => {
1919
}
2020
}
2121

22-
if (job.name === 'send-export-email') {
22+
else if (job.name === 'send-export-email') {
2323
const { email, downloadUrl, projectName } = job.data;
2424

2525
try {
@@ -30,6 +30,10 @@ const worker = new Worker('email-queue', async (job) => {
3030
console.error(`[EmailWorker] Failed to send export email to ${email}:`, error);
3131
throw error;
3232
}
33+
}
34+
35+
else {
36+
throw new Error(`[emailQueue] Unknown job type: ${job.name}`);
3337
}
3438

3539
}, {

0 commit comments

Comments
 (0)