Duffer Derek
import Podio from "@phasesdk/api-client-for-podio";
import Log from "../configs/logger.js";
import { appAuthentication } from "../services/podio/podio.js";
import { getFilesForApp } from "../services/podio/syncPodioData.js";
import { deleteFiles } from "../services/fileUpload.js";
export default {
getCurrentTime: async (req, res, next) => {
try {
const currentDate = new Date();
const yesterdayDate = new Date(currentDate - 86400000);
const yesterdayFormattedDate = yesterdayDate
.toISOString()
.replace("T", " ")
.replace(/\.\d{3}Z$/, "");
res.status(200).json({
status: 200,
message: "Partner sync completed",
time: yesterdayFormattedDate,
});
} catch (error) {
Log.error(error);
next(error);
}
},
deleteFile: async (req, res, next) => {
try {
const { item_id } = req.body;
console.log(item_id);
deleteFiles(item_id, "customer_image");
res.status(200).json({
status: 200,
message: "Partner sync completed",
});
} catch (error) {
Log.error(error);
next(error);
}
},
addComment: async (req, res, next) => {
try {
const auth = await appAuthentication(
process.env.TASK_APP_ID,
process.env.TASK_APP_TOKEN
);
let attributes = {
value: "hey test @[Aswathi Jayaram MN](user:4335670)",
};
await Podio.api.comment(auth).create("item", 2743819776, attributes);
res.status(200).json({
status: 200,
message: "Comment added successfully",
});
} catch (error) {
Log.error(error);
next(error);
}
},
};
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists