- Add cron service to Docker container for automated email sending - Create /api/send-scheduled-emails endpoint for cron job calls - Modify prayer submission to store user reminder preferences instead of sending immediate emails - Update Firestore rules to allow server-side API access for scheduled emails - Add userId to prayers for proper user association - Cron runs every 5 minutes to check and send scheduled reminders
34 lines
953 B
Plaintext
34 lines
953 B
Plaintext
rules_version = '2';
|
|
service cloud.firestore {
|
|
match /databases/{database}/documents {
|
|
// Allow authenticated users to read/write their own data
|
|
match /users/{userId} {
|
|
allow read, write: if request.auth != null && request.auth.uid == userId;
|
|
}
|
|
|
|
// Allow authenticated users to read/write prayers
|
|
match /prayers/{prayerId} {
|
|
allow read, write: if request.auth != null;
|
|
}
|
|
|
|
// Allow server-side API access for scheduled emails (no auth required for GET)
|
|
match /prayers {
|
|
allow read: if true;
|
|
}
|
|
|
|
// Allow server-side API access for scheduled emails
|
|
match /users {
|
|
allow read: if true;
|
|
}
|
|
|
|
// Allow authenticated users to read/write config (for admin settings)
|
|
match /config/{configId} {
|
|
allow read, write: if request.auth != null;
|
|
}
|
|
|
|
// Allow anyone to read public data (if needed in future)
|
|
match /public/{document} {
|
|
allow read: if true;
|
|
}
|
|
}
|
|
} |