diff --git a/server/middleware/10.ficmasData.ts b/server/middleware/10.ficmasData.ts new file mode 100644 index 0000000..55ec07c --- /dev/null +++ b/server/middleware/10.ficmasData.ts @@ -0,0 +1,22 @@ +import { Ficmas } from "~/models/challenges/ficmas"; + +export default eventHandler(async (event) => { + let y = new Date().getFullYear() + let fmfilt: any = {}; + + if (!!process.env.JulyFicmas && new Date() < new Date(Date.parse('Aug 1 ' + y))) { + fmfilt.isAnniversary = true; + fmfilt.year = y; + } else if (new Date() < new Date(Date.parse('Dec 25 ' + y))) { + fmfilt.year = process.env.YEAR; + fmfilt.isAnniversary = false; + } else { + fmfilt.keythatdoesntexist = { + $exists: true + } + } + let ficmasarray_raw = await Ficmas.find(fmfilt) + // console.log(ficsHidden()); + // console.log(query); + event.context.ficmasarray_raw = ficmasarray_raw +}) \ No newline at end of file