Skip to content

Commit

Permalink
Functions: Fix CORS and date issue in donations certificates function
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Kündig committed Jan 24, 2025
1 parent 46f9b26 commit 2a4123c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Original file line number Diff line number Diff line change
Expand Up @@ -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<CreateDonationCertificatesProps, Promise<string>>({ memory: '4GiB' }, async (request) => {
const firestoreAdmin = new FirestoreAdmin();
await firestoreAdmin.assertGlobalAdmin(request.auth?.token?.email);
export default onCall<CreateDonationCertificatesProps, Promise<string>>(
{
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);
},
);

0 comments on commit 2a4123c

Please sign in to comment.