21 lines
580 B
TypeScript
21 lines
580 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 = y;
|
|
fmfilt.isAnniversary = false;
|
|
} else {
|
|
fmfilt.keythatdoesntexist = {
|
|
$exists: true,
|
|
};
|
|
}
|
|
let ficmasarray_raw = await Ficmas.find(fmfilt);
|
|
event.context.ficmasarray_raw = ficmasarray_raw;
|
|
});
|