refactor: optimize Firestore rules and meal cleanup

- Tighten Firestore validation rules (data size and limits)
- Pass context to `deletePhotoFile` for safer file management
- Cleanup unused dependencies in build configuration
- Update Robolectric SDK target for tests
This commit is contained in:
bleackstorm committed 2026-11-08 20:06:30 +01:00
1 parent 87bbb448c2
commit 79e04f64d8
28 files changed
+1606 -1230

No files matched your search

+4 -4
View File
@@ -34,10 +34,10 @@ service cloud.firestore {
data.mealTimestamp is int && data.mealTimestamp > 0 &&
data.hungerBefore is int && data.hungerBefore >= 1 && data.hungerBefore <= 10 &&
data.satietyAfter is int && data.satietyAfter >= 1 && data.satietyAfter <= 10 &&
(!('note' in data) || data.note == null || (data.note is string && data.note.size() <= 1000)) &&
(!('foodItemsSerialized' in data) || data.foodItemsSerialized == null || (data.foodItemsSerialized is list && data.foodItemsSerialized.size() <= 30 && (data.foodItemsSerialized.size() == 0 || data.foodItemsSerialized[0] is string))) &&
(!('photoUris' in data) || data.photoUris == null || (data.photoUris is list && data.photoUris.size() <= 6 && (data.photoUris.size() == 0 || data.photoUris[0] is string))) &&
(!('photosBase64' in data) || data.photosBase64 == null || (data.photosBase64 is list && data.photosBase64.size() <= 6 && (data.photosBase64.size() == 0 || data.photosBase64[0] is string))) &&
(!('note' in data) || data.note == null || (data.note is string && data.note.size() <= 500)) &&
(!('foodItemsSerialized' in data) || data.foodItemsSerialized == null || (data.foodItemsSerialized is list && data.foodItemsSerialized.size() <= 30 && (data.foodItemsSerialized.size() == 0 || (data.foodItemsSerialized[0] is string && data.foodItemsSerialized[0].size() <= 200)))) &&
(!('photoUris' in data) || data.photoUris == null || (data.photoUris is list && data.photoUris.size() <= 4 && (data.photoUris.size() == 0 || (data.photoUris[0] is string && data.photoUris[0].size() <= 500)))) &&
(!('photosBase64' in data) || data.photosBase64 == null || (data.photosBase64 is list && data.photosBase64.size() <= 4 && (data.photosBase64.size() == 0 || (data.photosBase64[0] is string && data.photosBase64[0].size() <= 200000)))) &&
(!('updatedAt' in data) || data.updatedAt == null || (data.updatedAt is timestamp && data.updatedAt <= request.time));
}