Add Olist sync logs and stop control
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 47s

This commit is contained in:
Cauê Faleiros
2026-08-10 14:25:38 -03:00
parent 944f3a58d0
commit f836319041
6 changed files with 393 additions and 39 deletions

View File

@@ -4,7 +4,9 @@ const {
completeAuthorization,
createAuthorizationUrl,
getOlistFrontendRedirect,
getOlistRunDetails,
getOlistStatus,
requestOlistSyncStop,
startOlistSync
} = require('../services/olistService');
@@ -38,6 +40,25 @@ router.post('/olist/sync', verifySuperAdmin, async (req, res, next) => {
}
});
router.post('/olist/sync/stop', verifySuperAdmin, async (req, res, next) => {
try {
res.status(202).json(await requestOlistSyncStop());
} catch (error) {
next(error);
}
});
router.get('/olist/runs/:runId', verifySuperAdmin, async (req, res, next) => {
try {
res.json(await getOlistRunDetails(req.params.runId, {
eventsPage: req.query.eventsPage,
productsPage: req.query.productsPage
}));
} catch (error) {
next(error);
}
});
router.get('/olist/oauth/callback', async (req, res) => {
try {
if (req.query.error || !req.query.code || !req.query.state) {