Files
klz-cables.com/.pnpm-store/v10/files/74/39b62d40afbd2a6ee129f76eb48ea0f8824092d4db335f53d93390b7cad5e77c37b249ca893c2bc30b3d9d80aa4cb9ae857624ecae12d9d6ee12be68276fd7
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

56 lines
1.8 KiB
Plaintext

import { handleSchedules } from '../operations/handleSchedules/index.js';
import { configHasJobs } from './run.js';
/**
* GET /api/payload-jobs/handle-schedules endpoint
*
* This endpoint is GET instead of POST to allow it to be used in a Vercel Cron.
*/ export const handleSchedulesJobsEndpoint = {
handler: async (req)=>{
const jobsConfig = req.payload.config.jobs;
if (!configHasJobs(jobsConfig)) {
return Response.json({
message: 'No jobs to schedule.'
}, {
status: 200
});
}
const accessFn = jobsConfig.access?.run ?? (()=>true);
const hasAccess = await accessFn({
req
});
if (!hasAccess) {
return Response.json({
message: req.i18n.t('error:unauthorized')
}, {
status: 401
});
}
if (!jobsConfig.scheduling) {
// There is no reason to call the handleSchedules endpoint if the stats global is not enabled (= no schedules defined)
return Response.json({
message: 'Cannot handle schedules because no tasks or workflows with schedules are defined.'
}, {
status: 500
});
}
const { allQueues, queue } = req.query;
const runAllQueues = allQueues && !(typeof allQueues === 'string' && allQueues === 'false');
const { errored, queued, skipped } = await handleSchedules({
allQueues: runAllQueues,
queue,
req
});
return Response.json({
errored,
message: req.i18n.t('general:success'),
queued,
skipped
}, {
status: 200
});
},
method: 'get',
path: '/handle-schedules'
};
//# sourceMappingURL=handleSchedules.js.map