Import finalized Olist production orders

This commit is contained in:
Cauê Faleiros
2026-08-12 10:57:18 -03:00
parent 42d64447d5
commit 6d3a1d6b1a
10 changed files with 494 additions and 7 deletions

View File

@@ -9,6 +9,7 @@ const {
requestOlistSyncStop,
startOlistSync
} = require('../services/olistService');
const { importFinalizedProductionOrderCsv, listProductionOrderImportData } = require('../services/productionOrderCsvImportService');
const router = express.Router();
@@ -48,6 +49,22 @@ router.post('/olist/sync/stop', verifySuperAdmin, async (req, res, next) => {
}
});
router.get('/olist/production-order-imports', verifySuperAdmin, async (req, res, next) => {
try {
res.json(await listProductionOrderImportData());
} catch (error) {
next(error);
}
});
router.post('/olist/production-order-imports', verifySuperAdmin, async (req, res, next) => {
try {
res.status(201).json(await importFinalizedProductionOrderCsv(req.body || {}));
} catch (error) {
next(error);
}
});
router.get('/olist/runs/:runId', verifySuperAdmin, async (req, res, next) => {
try {
res.json(await getOlistRunDetails(req.params.runId, {