26 lines
658 B
TypeScript
26 lines
658 B
TypeScript
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;
|
|
});
|