From c318994f43d27f224acca32f86c8052e2d4e4d13 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Tue, 17 Sep 2024 02:00:59 +0300 Subject: [PATCH] more fix --- src/helpers/calendar.js | 128 ++++++++++++++++++++-------------------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/src/helpers/calendar.js b/src/helpers/calendar.js index 3cfe8d4..5dce984 100644 --- a/src/helpers/calendar.js +++ b/src/helpers/calendar.js @@ -174,76 +174,76 @@ const GenerateICS = function (shifts) { // const TOKEN_PATH = path.join(process.cwd(), 'content/token.json'); // const CREDENTIALS_PATH = path.join(process.cwd(), 'content/client_secret_926212607479-d3m8hm8f8esp3rf1639prskn445sa01v.apps.googleusercontent.com.json'); -createEvent = async function createEvent(id) { - // var eventTest2 = { - // 'summary': 'Google I/O 2015', - // 'location': '800 Howard St., San Francisco, CA 94103', - // 'description': 'A chance to hear more about Google\'s developer products.', - // 'start': { - // 'dateTime': '2015-05-28T09:00:00-07:00', - // 'timeZone': 'America/Los_Angeles', - // }, - // 'end': { - // 'dateTime': '2015-05-28T17:00:00-07:00', - // 'timeZone': 'America/Los_Angeles', - // }, - // 'recurrence': [ - // 'RRULE:FREQ=DAILY;COUNT=2' - // ], - // 'attendees': [ - // { 'email': '' }, +// const createEvent = async function createEvent(id) { +// // var eventTest2 = { +// // 'summary': 'Google I/O 2015', +// // 'location': '800 Howard St., San Francisco, CA 94103', +// // 'description': 'A chance to hear more about Google\'s developer products.', +// // 'start': { +// // 'dateTime': '2015-05-28T09:00:00-07:00', +// // 'timeZone': 'America/Los_Angeles', +// // }, +// // 'end': { +// // 'dateTime': '2015-05-28T17:00:00-07:00', +// // 'timeZone': 'America/Los_Angeles', +// // }, +// // 'recurrence': [ +// // 'RRULE:FREQ=DAILY;COUNT=2' +// // ], +// // 'attendees': [ +// // { 'email': '' }, - // ], - // 'reminders': { - // 'useDefault': false, - // 'overrides': [ - // { 'method': 'email', 'minutes': 24 * 60 }, - // { 'method': 'popup', 'minutes': 10 }, - // ], - // }, - // }; - // var errors; - // var auth = await exports.authorize().then((auth) => { +// // ], +// // 'reminders': { +// // 'useDefault': false, +// // 'overrides': [ +// // { 'method': 'email', 'minutes': 24 * 60 }, +// // { 'method': 'popup', 'minutes': 10 }, +// // ], +// // }, +// // }; +// // var errors; +// // var auth = await exports.authorize().then((auth) => { - // const calendar = google.calendar({ version: 'v3', auth }); - // const res = calendar.events.insert({ - // calendarId: 'primary', - // resource: eventTest, +// // const calendar = google.calendar({ version: 'v3', auth }); +// // const res = calendar.events.insert({ +// // calendarId: 'primary', +// // resource: eventTest, - // }, (err, event) => { - // if (err) { - // console.log(`There was an error creating the event: ${err}`); - // return; - // } - // console.log(`Event created: ${event.data.htmlLink}`); - // }); - // }).catch(console.error).then((err) => { - // errors = err; - // }); - // return errors; - // } +// // }, (err, event) => { +// // if (err) { +// // console.log(`There was an error creating the event: ${err}`); +// // return; +// // } +// // console.log(`Event created: ${event.data.htmlLink}`); +// // }); +// // }).catch(console.error).then((err) => { +// // errors = err; +// // }); +// // return errors; +// // } - // authorizeNew = async function authorizeNew() { - // let client = await loadSavedCredentialsIfExist(); - // if (client) { - // return client; - // } - // // Set up the Google Calendar API client - // const calendar = google.calendar({ version: 'v3', auth }); +// // authorizeNew = async function authorizeNew() { +// // let client = await loadSavedCredentialsIfExist(); +// // if (client) { +// // return client; +// // } +// // // Set up the Google Calendar API client +// // const calendar = google.calendar({ version: 'v3', auth }); - // // Load the client secrets from a JSON file +// // // Load the client secrets from a JSON file - fs.readFile("./path/to/client_secret.json", (err, content) => { - if (err) return console.error("Error loading client secret file:", err); +// fs.readFile("./path/to/client_secret.json", (err, content) => { +// if (err) return console.error("Error loading client secret file:", err); - // Authorize a client with the loaded credentials - authorizeOA(JSON.parse(content), calendar.calendarList.list); - }); - if (client.credentials) { - await saveCredentials(client); - } - return client; -}; +// // Authorize a client with the loaded credentials +// authorizeOA(JSON.parse(content), calendar.calendarList.list); +// }); +// if (client.credentials) { +// await saveCredentials(client); +// } +// return client; +// }; // var googletoken = axiosInstance.get("/content/google_token.json"); // console.log("googletoken: " + googletoken); @@ -372,7 +372,7 @@ async function importModules() { }; } -createEvent = async (event) => { +const createEvent = async (event) => { const { open, getPort } = await importModules();