Skip to content

Fix Firestore rules validation for raphcon creation#41

Open
Copilot wants to merge 24 commits intomasterfrom
copilot/fix-firestore-permission-error
Open

Fix Firestore rules validation for raphcon creation#41
Copilot wants to merge 24 commits intomasterfrom
copilot/fix-firestore-permission-error

Conversation

Copy link
Contributor

Copilot AI commented Dec 15, 2025

Raphcon creation was failing with "Missing or insufficient permissions" because the Firestore rules validation function only checked for 3 fields while the application sends 5 required fields plus 1 optional field.

Changes

  • Updated isValidRaphcon() in firestore.rules to validate all fields sent by RaphconModel.toMap():
    • Added type (string, required)
    • Added isActive (boolean, required)
    • Added comment (string, optional)

Before

function isValidRaphcon(data) {
  return data.keys().hasAll(['userId', 'createdAt', 'createdBy']) &&
         data.userId is string &&
         data.createdAt is timestamp &&
         data.createdBy == request.auth.uid;
}

After

function isValidRaphcon(data) {
  return data.keys().hasAll(['userId', 'createdAt', 'createdBy', 'type', 'isActive']) &&
         data.userId is string &&
         data.createdAt is timestamp &&
         data.createdBy == request.auth.uid &&
         data.type is string &&
         data.isActive is bool &&
         (!data.keys().hasAny(['comment']) || data.comment is string);
}
Original prompt

This section details on the original issue you should resolve

<issue_title>Fix Firestore permission error when adding raphcons</issue_title>
<issue_description>When trying to add a raphcon, the operation fails due to missing or insufficient permissions in Firestore.

Error message:

Firestore permission error screenshot

Ich glaube, dass eine Firestore-Regel angepasst werden muss, um das Hinzufügen von raphcons zu ermöglichen.

Steps to Reproduce:

  1. Versuche, einen raphcon hinzuzufügen.
  2. Die Fehlermeldung erscheint.

Expected behavior:

  • Raphcons sollten ohne Permission Error hinzugefügt werden können.

Possible solution:

  • Überprüfe Firestore-Regeln und passe sie ggf. an, damit das Hinzufügen der raphcons möglich ist.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 8 commits December 15, 2025 03:05
Co-authored-by: tujii <8914318+tujii@users.noreply.github.com>
Co-authored-by: tujii <8914318+tujii@users.noreply.github.com>
Co-authored-by: tujii <8914318+tujii@users.noreply.github.com>
Co-authored-by: tujii <8914318+tujii@users.noreply.github.com>
Co-authored-by: tujii <8914318+tujii@users.noreply.github.com>
Co-authored-by: tujii <8914318+tujii@users.noreply.github.com>
@tujii tujii marked this pull request as ready for review December 15, 2025 12:47
@github-actions
Copy link

github-actions bot commented Dec 15, 2025

Visit the preview URL for this PR (updated for commit 53468d1):

https://angryraphi--pr41-copilot-fix-firestor-leg0ew4e.web.app

(expires Mon, 22 Dec 2025 23:49:40 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: a0d0f39c5de51b5f0e7b4994943c4eea410f181e

Co-authored-by: tujii <8914318+tujii@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Firestore permission error when adding raphcons Fix Firestore rules validation for raphcon creation Dec 15, 2025
Copilot AI requested a review from tujii December 15, 2025 12:52
tujii added 11 commits December 15, 2025 13:53
- Implement tests for AdminRepositoryImpl covering addAdmin, removeAdmin, and checkAdminStatus methods.
- Create mocks for AdminRemoteDataSource and NetworkInfo using Mockito.
- Add tests for AddAdmin use case to validate repository interactions and handle different failure scenarios.
- Ensure proper verification of method calls and expected outcomes in all tests.
…e user use cases by removing unnecessary await, and improve import organization across various files. Update UI components for consistency and clarity, including widget styling and layout adjustments. Enhance test cases for better coverage and accuracy, ensuring proper handling of user ranking logic and badge display. Fix import order and redundant code in multiple test files to maintain code quality and readability.
…ate test cases for better accuracy and readability
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
36.6% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix Firestore permission error when adding raphcons

2 participants