Skip to content

SampleData: Added Memberships #3456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

JaiPannu-IITI
Copy link

@JaiPannu-IITI JaiPannu-IITI commented Apr 17, 2025

Overview

This PR adds missing organization memberships for admins which were missed when new organizations were created.

Archived Issue: #3403

Summary by CodeRabbit

  • Chores
    • Expanded sample data for organization memberships by adding new administrator role entries for various organizations.

Copy link

coderabbitai bot commented Apr 17, 2025

Walkthrough

The change expands the sample data for organization memberships by adding several new entries at the beginning of the JSON file. These new entries assign administrator roles to specific members for various organizations, including relevant metadata such as creation timestamps and creator IDs. The original entries, primarily representing regular roles, remain in the file but are now listed after the newly added administrator entries. No code or exported entities were modified.

Changes

File(s) Change Summary
scripts/dbManagement/sample_data/organization_memberships.json Added multiple new administrator membership entries at the start of the array; existing entries unchanged but shifted down.

Possibly related PRs

Suggested labels

ignore-sensitive-files-pr

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0fac5c2 and a7b8c4f.

📒 Files selected for processing (1)
  • scripts/dbManagement/sample_data/organization_memberships.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Run tests for talawa api
  • GitHub Check: Analyse Code With CodeQL (typescript)
🔇 Additional comments (2)
scripts/dbManagement/sample_data/organization_memberships.json (2)

2-128: Approve addition of administrator roles in sample data

The new entries correctly seed administrator memberships across all organizations for both the global admin (memberId: 0194e194-c6b3-7802-b074-362efea24dbc) and the individual organization creators (65378abd-8500-8f17-1cf2-990d00000002, 66378abd-8500-8f17-1cf2-990d00000003, 67378abd-8500-8f17-1cf2-990d00000004). All objects conform to the established schema (fields: createdAt, creatorId, memberId, organizationId, role, updatedAt, updaterId), and there are no duplicate memberId/organizationId pairs. This effectively addresses the missing admin memberships as outlined in PR #3456.


2-128:

✅ Verification successful

Verify referential integrity of IDs

Please ensure that every organizationId and memberId in these new entries corresponds to a valid record in your sample data (e.g., organizations.json, users.json). Verifying this upfront will prevent orphaned references during seed/migration runs.


🏁 Script executed:

#!/bin/bash
# Verify that all organizationId values in memberships exist in organizations.json
ORG_FILE=$(fd --exact-name organizations.json scripts/dbManagement/sample_data | head -n 1)
MEMBERSHIP_FILE="scripts/dbManagement/sample_data/organization_memberships.json"

if [ -f "$ORG_FILE" ]; then
  missing=$(jq -r '.[].organizationId' "$MEMBERSHIP_FILE" | sort -u | while read id; do
    jq -e --arg id "$id" 'any(.[]; .id == $id)' "$ORG_FILE" >/dev/null || echo "$id"
  done)
  if [ -n "$missing" ]; then
    echo "Missing organization IDs in $ORG_FILE:"; echo "$missing"; exit 1
  fi
else
  echo "Error: organizations.json not found"; exit 1
fi

Length of output: 494


I’ve updated the verification script to reliably locate both organizations.json and users.json and then check all organizationId and memberId values. Please run the following:


🏁 Script executed:

#!/bin/bash
set -e

DATA_DIR="scripts/dbManagement/sample_data"
ORG_FILE=$(find "$DATA_DIR" -type f -name organizations.json | head -n1)
USER_FILE=$(find "$DATA_DIR" -type f -name users.json        | head -n1)
MEMBERSHIP_FILE="$DATA_DIR/organization_memberships.json"

# Ensure sample files exist
if [ ! -f "$ORG_FILE" ]; then
  echo "Error: organizations.json not found under $DATA_DIR" >&2
  exit 1
fi
if [ ! -f "$USER_FILE" ]; then
  echo "Error: users.json not found under $DATA_DIR" >&2
  exit 1
fi

# Check organization IDs
missing_orgs=$(jq -r '.[].organizationId' "$MEMBERSHIP_FILE" | sort -u | \
  while read id; do
    jq -e --arg id "$id" 'any(.[]; .id == $id)' "$ORG_FILE" >/dev/null || echo "$id"
  done)

# Check member IDs
missing_users=$(jq -r '.[].memberId' "$MEMBERSHIP_FILE" | sort -u | \
  while read id; do
    jq -e --arg id "$id" 'any(.[]; .id == $id)' "$USER_FILE" >/dev/null || echo "$id"
  done)

if [ -n "$missing_orgs" ]; then
  echo "Missing organization IDs in organizations.json:" 
  echo "$missing_orgs"
  exit 1
fi

if [ -n "$missing_users" ]; then
  echo "Missing user IDs in users.json:" 
  echo "$missing_users"
  exit 1
fi

echo "✅ All organizationId and memberId references are valid."

Length of output: 4502


Referential integrity verified

All organizationId and memberId entries in scripts/dbManagement/sample_data/organization_memberships.json exist in organizations.json and users.json. No orphaned references detected—good to merge.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Our Pull Request Approval Process

Thanks for contributing!

Testing Your Code

Remember, your PRs won't be reviewed until these criteria are met:

  1. We don't merge PRs with poor code quality.
    1. Follow coding best practices such that CodeRabbit.ai approves your PR.
  2. We don't merge PRs with failed tests.
    1. When tests fail, click on the Details link to learn more.
    2. Write sufficient tests for your changes (CodeCov Patch Test). Your testing level must be better than the target threshold of the repository
    3. Tests may fail if you edit sensitive files. Ask to add the ignore-sensitive-files-pr label if the edits are necessary.
  3. We cannot merge PRs with conflicting files. These must be fixed.

Our policies make our code better.

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR or
  2. our slack channel

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

CONTRIBUTING.md

Read our CONTRIBUTING.md file. Most importantly:

  1. PRs with issues not assigned to you will be closed by the reviewer
  2. Fix the first comment in the PR so that each issue listed automatically closes

Other

  1. 🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.
  2. Read the CONTRIBUTING.md file make

Copy link

codecov bot commented Apr 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.60%. Comparing base (0fac5c2) to head (a7b8c4f).
Report is 1 commits behind head on develop-postgres.

Additional details and impacted files
@@                Coverage Diff                @@
##           develop-postgres    #3456   +/-   ##
=================================================
  Coverage             59.60%   59.60%           
=================================================
  Files                   523      523           
  Lines                 40782    40782           
  Branches               1786     1786           
=================================================
  Hits                  24307    24307           
  Misses                16464    16464           
  Partials                 11       11           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JaiPannu-IITI
Copy link
Author

@palisadoes Sir PR is ready for review.

@JaiPannu-IITI
Copy link
Author

JaiPannu-IITI commented Apr 17, 2025

I Apologise for this problem, I shouldn't have missed these in my last PR. Will take more care in future.

@gautam-divyanshu gautam-divyanshu self-requested a review April 18, 2025 11:02
@gautam-divyanshu gautam-divyanshu merged commit 7c11b3b into PalisadoesFoundation:develop-postgres Apr 18, 2025
19 checks passed
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.

2 participants