From 752f009a25b2efd828219ee99e04422acda0550d Mon Sep 17 00:00:00 2001 From: Juan X Gomez Date: Sat, 27 Feb 2021 15:59:41 -0500 Subject: [PATCH] clean up firebase configs --- firebase.json | 3 +- firebase/firestore.indexes.json | 61 +++++++++++++++++++++++++++++++-- firebase/firestore.rules | 24 ------------- 3 files changed, 60 insertions(+), 28 deletions(-) delete mode 100644 firebase/firestore.rules diff --git a/firebase.json b/firebase.json index 8861376..f19efdc 100644 --- a/firebase.json +++ b/firebase.json @@ -1,6 +1,5 @@ { "firestore": { - "rules": "./firebase/firestore.rules", "indexes": "./firebase/firestore.indexes.json" }, "hosting": { @@ -20,4 +19,4 @@ "storage": { "rules": "./firebase/storage.rules" } -} \ No newline at end of file +} diff --git a/firebase/firestore.indexes.json b/firebase/firestore.indexes.json index 2ddb5ce..e46a2e5 100644 --- a/firebase/firestore.indexes.json +++ b/firebase/firestore.indexes.json @@ -1,4 +1,61 @@ { - "indexes": [], + "indexes": [ + { + "collectionGroup": "posts", + "queryScope": "COLLECTION", + "fields": [ + { + "fieldPath": "interests", + "order": "ASCENDING" + }, + { + "fieldPath": "createdAt", + "order": "DESCENDING" + } + ] + }, + { + "collectionGroup": "posts", + "queryScope": "COLLECTION", + "fields": [ + { + "fieldPath": "interests", + "arrayConfig": "CONTAINS" + }, + { + "fieldPath": "createdAt", + "order": "DESCENDING" + } + ] + }, + { + "collectionGroup": "posts", + "queryScope": "COLLECTION", + "fields": [ + { + "fieldPath": "userId", + "order": "ASCENDING" + }, + { + "fieldPath": "createdAt", + "order": "ASCENDING" + } + ] + }, + { + "collectionGroup": "posts", + "queryScope": "COLLECTION", + "fields": [ + { + "fieldPath": "userId", + "order": "ASCENDING" + }, + { + "fieldPath": "createdAt", + "order": "DESCENDING" + } + ] + } + ], "fieldOverrides": [] -} \ No newline at end of file +} diff --git a/firebase/firestore.rules b/firebase/firestore.rules deleted file mode 100644 index 3580246..0000000 --- a/firebase/firestore.rules +++ /dev/null @@ -1,24 +0,0 @@ -service cloud.firestore { - match /databases/{database}/documents { - match /posts/{postId} { - allow create: if request.auth != null; - allow update: - if (request.auth != null && request.auth.uid == resource.data.userId) - || (request.resource.data.diff(resource.data).affectedKeys().hasOnly(['likeCount'])); - allow read; - allow delete: if false; - } - match /users/{userId} { - allow update: if request.auth != null && request.auth.uid == userId; - allow read: if request.auth != null; - allow create; - allow delete: if false; - } - match /usernames/{username} { - allow delete: if false; - allow update: if false; - allow create; - allow read; - } - } -}