Added netlify hook

This commit is contained in:
NunoSempere 2021-04-09 00:01:50 +02:00
parent d15a234399
commit b86d95778c
3 changed files with 15 additions and 7 deletions

View File

@ -18,20 +18,19 @@ import {smarkets} from "./platforms/smarkets-fetch.js"
import {williamhill} from "./platforms/williamhill-fetch.js" import {williamhill} from "./platforms/williamhill-fetch.js"
import {mergeEverything} from "./utils/mergeEverything.js" import {mergeEverything} from "./utils/mergeEverything.js"
import {rebuildNetlifySiteWithNewData} from "./utils/rebuildNetliftySiteWithNewData.js"
import {doEverything, tryCatchTryAgain} from "./utils/doEverything.js" import {doEverything, tryCatchTryAgain} from "./utils/doEverything.js"
/* Definitions */
/* Support functions */ /* Support functions */
let functions = [csetforetell, elicit, /* estimize, */ fantasyscotus, foretold, goodjudgment, goodjudgmentopen, hypermind, ladbrokes, metaculus, polymarket, predictit, omen, smarkets, williamhill, mergeEverything, doEverything] let functions = [csetforetell, elicit, /* estimize, */ fantasyscotus, foretold, goodjudgment, goodjudgmentopen, hypermind, ladbrokes, metaculus, polymarket, predictit, omen, smarkets, williamhill, mergeEverything, rebuildNetlifySiteWithNewData, doEverything]
let functionNames = functions.map(fun => fun.name) let functionNames = functions.map(fun => fun.name)
let whattodoMessage = functionNames let whattodoMessage = functionNames
.slice(0,functionNames.length-2) .slice(0,functionNames.length-2)
.map((functionName,i) => `[${i}]: Download predictions from ${functionName}`) .map((functionName,i) => `[${i}]: Download predictions from ${functionName}`)
.join('\n') + .join('\n') +
`\n[${functionNames.length-2}]: Merge jsons them into one big json` + `\n[${functionNames.length-3}]: Merge jsons them into one big json (and push it to mongodb database)` +
`\n[${functionNames.length-2}]: Rebuild netlify site with new data` +
// `\n[${functionNames.length-1}]: Add to history` + // `\n[${functionNames.length-1}]: Add to history` +
`\n[${functionNames.length-1}]: All of the above` + `\n[${functionNames.length-1}]: All of the above` +
`\nChoose one option, wisely: #` `\nChoose one option, wisely: #`

View File

@ -13,7 +13,7 @@ import {predictit} from "../platforms/predictit-fetch.js"
import {omen} from "../platforms/omen-fetch.js" import {omen} from "../platforms/omen-fetch.js"
import {smarkets} from "../platforms/smarkets-fetch.js" import {smarkets} from "../platforms/smarkets-fetch.js"
import {williamhill} from "../platforms/williamhill-fetch.js" import {williamhill} from "../platforms/williamhill-fetch.js"
import {rebuildNetlifySiteWithNewData} from "./rebuildNetliftySiteWithNewData.js"
import {mergeEverything} from "./mergeEverything.js" import {mergeEverything} from "./mergeEverything.js"
/* Do everything */ /* Do everything */
@ -33,7 +33,7 @@ export async function tryCatchTryAgain (fun) {
} }
} }
export async function doEverything(){ export async function doEverything(){
let functions = [csetforetell, elicit, /* estimize, */ fantasyscotus, foretold, goodjudgment, goodjudgmentopen, hypermind, ladbrokes, metaculus, polymarket, predictit, omen, smarkets, williamhill, mergeEverything] let functions = [csetforetell, elicit, /* estimize, */ fantasyscotus, foretold, goodjudgment, goodjudgmentopen, hypermind, ladbrokes, metaculus, polymarket, predictit, omen, smarkets, williamhill, mergeEverything, rebuildNetlifySiteWithNewData]
console.log("") console.log("")
console.log("") console.log("")

View File

@ -0,0 +1,9 @@
import axios from "axios"
export async function rebuildNetlifySiteWithNewData(){
let rebuildNetlifyHookUrl = process.env.REBUIDNETLIFYHOOKURL;
let payload = ({});
let response = await axios.post(rebuildNetlifyHookUrl, payload);
let data = response.data;
console.log(data);
}