BLUE
PHP 7.4.33
Path:
/var/www/web-koncept/server/src/controllers
Run
Logout
Edit File
Size: 2.53 KB
Close
/var/www/web-koncept/server/src/controllers/cronSyncController.js
Text
Base64
import podio from "@phasesdk/api-client-for-podio"; import { appAuthentication } from "../services/podio/podioAuth.js"; import { findOrCreateSale, leadSync, modeBookerSync, salesSync, } from "../services/syncPodioData.js"; import { getFormatedSalesFields } from "../services/salesServices.js"; export default { syncLeadApp: async (req, res, next) => { try { const syncType = req.query.type; const isInitialSync = syncType === "initial"; await leadSync(process.env.LEADS_APP_ID, isInitialSync); res.status(200).json({ status: 200, message: "Lead sync completed", }); } catch (error) { res.status(500).json({ status: 500, message: "An error occurred while syncing leads.", error: error.message, }); next(error); } }, syncSalesApp: async (req, res, next) => { try { const syncType = req.query.type; const isInitialSync = syncType === "initial"; await salesSync(process.env.SALES_APP_ID, isInitialSync); res.status(200).json({ status: 200, message: "Sales Rep sync completed", }); } catch (error) { res.status(500).json({ status: 500, message: "An error occurred while syncing sales.", error: error.message, }); next(error); } }, syncModeBooker: async (req, res, next) => { try { const syncType = req.query.type; const isInitialSync = syncType === "initial"; await modeBookerSync(process.env.MODE_BOOKER_APP_ID, isInitialSync); res.status(200).json({ status: 200, message: "Meeting bookers sync completed", }); } catch (error) { res.status(500).json({ status: 500, message: "An error occurred while syncing meeting bookers.", error: error.message, }); next(error); } }, syncTest: async (req, res) => { try { const auth = await appAuthentication( process.env.SALES_APP_ID, process.env.SALES_APP_TOKEN ); const resp = await podio.api.item(auth).get(2919501593); const item = resp.data; const formattedField = await getFormatedSalesFields( item.fields, item.item_id ); await findOrCreateSale(formattedField); res.status(200).json({ status: 200, message: "SUccess", }); } catch (error) { res.status(500).json({ status: 500, message: "An error occurred while syncing meeting bookers.", error: error.message, }); } }, };
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 6
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
apiController.js
7.24 KB
lrw-r--r--
2024-11-06 12:06:11
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
authController.js
3.40 KB
lrw-r--r--
2024-11-06 12:06:11
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
cronSyncController.js
2.53 KB
lrw-r--r--
2024-11-05 04:29:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
hookController.js
8.74 KB
lrw-r--r--
2024-11-05 04:29:08
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
initialSynController.js
1.01 KB
lrw-r--r--
2024-11-04 12:03:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
testController.js
7.53 KB
lrw-r--r--
2024-11-04 12:03:48
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).