diff --git a/functions/src/functions/cron/donation-certificates/index.ts b/functions/src/functions/cron/donation-certificates/index.ts index e2714d4c6..acb9ae406 100644 --- a/functions/src/functions/cron/donation-certificates/index.ts +++ b/functions/src/functions/cron/donation-certificates/index.ts @@ -5,6 +5,6 @@ import { createDonationCertificates } from '../../../lib/donation-certificates'; export default onSchedule({ schedule: '0 0 2 1 *', memory: '4GiB' }, async () => { const now = DateTime.now(); - const msg = await createDonationCertificates({ year: now.year }); + const msg = await createDonationCertificates({ year: now.year - 1 }); logger.info(msg); }); diff --git a/functions/src/functions/webhooks/admin/donation-certificates/index.ts b/functions/src/functions/webhooks/admin/donation-certificates/index.ts index 03848db91..21e372b58 100644 --- a/functions/src/functions/webhooks/admin/donation-certificates/index.ts +++ b/functions/src/functions/webhooks/admin/donation-certificates/index.ts @@ -2,9 +2,15 @@ import { onCall } from 'firebase-functions/v2/https'; import { FirestoreAdmin } from '../../../../../../shared/src/firebase/admin/FirestoreAdmin'; import { createDonationCertificates, CreateDonationCertificatesProps } from '../../../../lib/donation-certificates'; -export default onCall>({ memory: '4GiB' }, async (request) => { - const firestoreAdmin = new FirestoreAdmin(); - await firestoreAdmin.assertGlobalAdmin(request.auth?.token?.email); +export default onCall>( + { + memory: '4GiB', + cors: true, + }, + async (request) => { + const firestoreAdmin = new FirestoreAdmin(); + await firestoreAdmin.assertGlobalAdmin(request.auth?.token?.email); - return await createDonationCertificates(request.data); -}); + return await createDonationCertificates(request.data); + }, +);