I have an AdminController with a lot of backend API endpoints and there is an auxiliar function that one of the API depends upon. I need to call this auxiliar function from a Task File that runs every day in the morning. I tried exporting an object using module.exports = { AdminController, createReportAux } but that did not seem to work. How can I achieve this? Am I doing the import or export wrong?
class AdminController {
// backend API endpoint methods
async deleteProgram({ request, params, response }) {
}
async addProgram({ auth, request, response }) {
}
//I could call this but cannot pass auth information from the task file as it is not available there
async createReport({ auth, params, response }) {
createReportAux(requestInfo, auth.user.email)
}
}
//function that I need to call which is outside AdminController class
const createReportAux = async (requestInfo, email) => {
}
module.exports = AdminController
const AdminController = use("App/Controllers/Http/AdminController")
class GetScheduledEmailForTheDay extends Task {
static get schedule() {
}
await AdminController.createReportAux(requestInfo, individualEmailToSend.receiver_email)
}
Please suggest a solution, I have been stuck at it for a while. Exporting as an object seems to work but the API methods are not accessible that way.