import { Strapi } from "@strapi/strapi"; export default ({ strapi }: { strapi: Strapi }) => ({ async syncRetailers(ctx) { try { await strapi .plugin("dutchie-plus") .service("inventory") .cleanupStaleInventories(); const result = await strapi .plugin("dutchie-plus") .service("retailer") .syncRetailers(); ctx.body = result; } catch (e) { console.error(e); ctx.body = { error: e.message }; } }, async syncRetailer(ctx) { try { const result = await strapi .plugin("dutchie-plus") .service("inventory") .syncRetailer(ctx.params); ctx.body = result; } catch (e) { console.error(e); ctx.body = { error: e.message }; } }, async syncMeilisearch(ctx) { try { const result = await strapi .plugin("dutchie-plus") .service("meilisearch") .syncRetailer(ctx.params); ctx.body = result; } catch (e) { console.error(e); ctx.body = { error: e.message }; } }, });