diff --git a/.firebaserc b/.firebaserc index 74dd134..7ea5cba 100644 --- a/.firebaserc +++ b/.firebaserc @@ -2,6 +2,7 @@ "projects": { "debug": "fitlien-dev", "qa": "fitlien-qa", - "release": "fitlien" + "release": "fitlien", + "default": "fitlien-dev" } -} \ No newline at end of file +} diff --git a/firebase.json b/firebase.json index abf2c13..dd93bf2 100644 --- a/firebase.json +++ b/firebase.json @@ -14,8 +14,7 @@ "firebase-debug.*.log", "*.local" ], - "predeploy": [ - ] + "predeploy": [] } ], "storage": { diff --git a/firestore.indexes.json b/firestore.indexes.json index fe4aa78..8d0c63f 100644 --- a/firestore.indexes.json +++ b/firestore.indexes.json @@ -1,5 +1,33 @@ { "indexes": [ + { + "collectionGroup": "day_pass_bookings", + "queryScope": "COLLECTION", + "fields": [ + { + "fieldPath": "userId", + "order": "ASCENDING" + }, + { + "fieldPath": "createdAt", + "order": "DESCENDING" + } + ] + }, + { + "collectionGroup": "day_pass_entries", + "queryScope": "COLLECTION", + "fields": [ + { + "fieldPath": "bookingId", + "order": "ASCENDING" + }, + { + "fieldPath": "entryDate", + "order": "ASCENDING" + } + ] + }, { "collectionGroup": "gyms", "queryScope": "COLLECTION_GROUP", @@ -13,7 +41,145 @@ "order": "ASCENDING" } ] + }, + { + "collectionGroup": "gyms", + "queryScope": "COLLECTION", + "fields": [ + { + "fieldPath": "userId", + "order": "ASCENDING" + }, + { + "fieldPath": "name", + "order": "ASCENDING" + } + ] + }, + { + "collectionGroup": "memberships", + "queryScope": "COLLECTION", + "fields": [ + { + "fieldPath": "gymId", + "order": "ASCENDING" + }, + { + "fieldPath": "createdAt", + "order": "DESCENDING" + } + ] + }, + { + "collectionGroup": "notifications", + "queryScope": "COLLECTION", + "fields": [ + { + "fieldPath": "clientId", + "order": "ASCENDING" + }, + { + "fieldPath": "timestamp", + "order": "DESCENDING" + } + ] + }, + { + "collectionGroup": "notifications", + "queryScope": "COLLECTION", + "fields": [ + { + "fieldPath": "clientId", + "order": "ASCENDING" + }, + { + "fieldPath": "type", + "order": "ASCENDING" + }, + { + "fieldPath": "timestamp", + "order": "DESCENDING" + } + ] + }, + { + "collectionGroup": "notifications", + "queryScope": "COLLECTION", + "fields": [ + { + "fieldPath": "ownerId", + "order": "ASCENDING" + }, + { + "fieldPath": "timestamp", + "order": "DESCENDING" + } + ] + }, + { + "collectionGroup": "notifications", + "queryScope": "COLLECTION", + "fields": [ + { + "fieldPath": "ownerId", + "order": "ASCENDING" + }, + { + "fieldPath": "type", + "order": "ASCENDING" + }, + { + "fieldPath": "timestamp", + "order": "DESCENDING" + } + ] + }, + { + "collectionGroup": "notifications", + "queryScope": "COLLECTION", + "fields": [ + { + "fieldPath": "trainerId", + "order": "ASCENDING" + }, + { + "fieldPath": "timestamp", + "order": "DESCENDING" + } + ] + }, + { + "collectionGroup": "notifications", + "queryScope": "COLLECTION", + "fields": [ + { + "fieldPath": "type", + "order": "ASCENDING" + }, + { + "fieldPath": "userId", + "order": "ASCENDING" + }, + { + "fieldPath": "timestamp", + "order": "DESCENDING" + } + ] + }, + { + "collectionGroup": "terms_and_conditions", + "queryScope": "COLLECTION", + "fields": [ + { + "fieldPath": "normalizedName", + "order": "ASCENDING" + }, + { + "fieldPath": "userUid", + "order": "ASCENDING" + } + ] } ], "fieldOverrides": [] -} +} \ No newline at end of file diff --git a/firestore.rules b/firestore.rules index cf50f51..03eee86 100644 --- a/firestore.rules +++ b/firestore.rules @@ -1,19 +1,16 @@ rules_version = '2'; - service cloud.firestore { match /databases/{database}/documents { - - // This rule allows anyone with your Firestore database reference to view, edit, - // and delete all data in your Firestore database. It is useful for getting - // started, but it is configured to expire after 30 days because it - // leaves your app open to attackers. At that time, all client - // requests to your Firestore database will be denied. - // - // Make sure to write security rules for your app before that time, or else - // all client requests to your Firestore database will be denied until you Update - // your rules match /{document=**} { - allow read, write: if request.time < timestamp.date(2025, 1, 10); + allow read, write: if request.auth != null; + } + match /day_pass_bookings/{bookingId} { + allow read: if true; + allow write: if request.auth != null; + } + match /gyms/{gymId} { + allow read: if true; + allow write: if request.auth != null; } } } \ No newline at end of file diff --git a/functions/package-lock.json b/functions/package-lock.json index 8a295b3..fc5ea89 100644 --- a/functions/package-lock.json +++ b/functions/package-lock.json @@ -14,6 +14,7 @@ "firebase-admin": "^12.6.0", "firebase-functions": "^6.0.1", "form-data": "^4.0.1", + "functions": "file:", "html-to-text": "^9.0.5", "long": "^4.0.0", "mailgun.js": "^10.4.0", @@ -3084,6 +3085,10 @@ "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", "optional": true }, + "node_modules/functions": { + "resolved": "", + "link": true + }, "node_modules/gaxios": { "version": "6.7.1", "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-6.7.1.tgz", diff --git a/functions/package.json b/functions/package.json index 939628c..f593fbc 100644 --- a/functions/package.json +++ b/functions/package.json @@ -21,6 +21,7 @@ "firebase-admin": "^12.6.0", "firebase-functions": "^6.0.1", "form-data": "^4.0.1", + "functions": "file:", "html-to-text": "^9.0.5", "long": "^4.0.0", "mailgun.js": "^10.4.0",