Repository navigation
feat (gql-server): Introduces graphql Type user_presenceLog to indicate users that have joined - #21457
Conversation
…joined in the meeting at some point.
subscription {
user_presenceLog {
extId
userId
currentlyInMeeting
isModerator
}
}
It is necessary to provide for the teacher the list of presence even after some users left.
WalkthroughThe pull request introduces extensive modifications to the SQL schema of the Several tables are modified, including the The Possibly related PRs
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
user_presenceLog to indicate users that joineduser_presenceLog to indicate users that have joined
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (11)
bbb-graphql-server/metadata/databases/BigBlueButton/tables/public_v_user_presenceLog.yaml (3)
1-8: LGTM! Consider adding a comment for clarity.The table definition and configuration look good. The naming convention is appropriate, and the custom name is well-chosen for GraphQL queries.
Consider adding a comment at the top of the file to briefly describe the purpose of this view, e.g.:
# View for tracking user presence in meetings, including users who have leftThis would enhance the file's readability and maintainability.
9-26: LGTM! Consider adding 'meetingId' to the allowed columns.The select permissions are well-defined and align with the PR objectives. The filter conditions ensure proper access control based on the meeting and user role.
For consistency and potential future use, consider adding 'meetingId' to the list of allowed columns:
columns: - currentlyInMeeting - extId - isModerator - userId + - meetingIdThis would allow clients to retrieve the meetingId if needed, which is already used in the filter conditions.
1-26: Great implementation of the user presence logging view!This YAML file successfully defines the
v_user_presenceLogview, which aligns perfectly with the PR objectives of introducing a GraphQL type for user presence logging. The implementation follows Hasura best practices and provides secure, role-based access to the necessary data.The view will enable teachers to track both current participants and those who have left the meeting, enhancing the functionality available to educators for monitoring user presence.
As this view is intended for use by plugins rather than direct client use, consider documenting this intended usage in a README file or in the project's API documentation. This will help future developers understand the purpose and proper utilization of this view.
bbb-graphql-server/metadata/databases/BigBlueButton/tables/tables.yaml (1)
Significant References to Removed Views Detected
Several removed views are still referenced in the codebase:
v_breakoutRoomv_breakoutRoom_assignedUserv_breakoutRoom_participantv_breakoutRoom_userv_captionv_caption_activeLocalesv_chatv_chat_message_privatev_chat_message_publicv_chat_message_reactionv_chat_userv_current_timev_externalVideov_layoutv_meetingv_meeting_breakoutPoliciesv_meeting_clientPluginSettingsv_meeting_clientSettingsv_meeting_componentsFlagsv_meeting_groupv_meeting_learningDashboardv_meeting_lockSettingsv_meeting_metadatav_meeting_recordingv_meeting_recordingPoliciesv_meeting_usersPoliciesv_meeting_voiceSettingsv_notificationv_pluginv_pluginDataChannelEntryv_pollv_poll_optionv_poll_responsev_poll_userv_poll_user_currentv_pres_annotation_currv_pres_annotation_history_currv_pres_pagev_pres_page_currv_pres_page_cursorv_pres_page_writersv_pres_presentationv_pres_presentation_uploadTokenv_screensharev_sharedNotesv_sharedNotes_diffv_sharedNotes_sessionv_timerv_userv_user_breakoutRoomv_user_camerav_user_clientSettingsv_user_connectionStatusv_user_connectionStatusReportv_user_currentv_user_guestv_user_lockSettingsv_user_metadatav_user_reactionv_user_refv_user_transcriptionErrorv_user_typing_privatev_user_typing_publicv_user_voicev_user_voice_activityv_user_welcomeMsgsRecommended Actions:
- Remove or update all lingering references to the removed views to prevent potential issues.
- Ensure that the GraphQL schema remains consistent and that no deprecated views are being utilized.
- Update relevant documentation and inform API consumers about these changes.
🔗 Analysis chain
Line range hint
1-58: Significant schema restructuring detected. Please provide additional context.The removal of numerous include statements suggests a major restructuring of the GraphQL schema. This change could have far-reaching implications for the existing API consumers.
- Can you provide more context on the motivation behind removing these views?
- How does this change impact existing queries and mutations?
- Is there a migration plan for API consumers who might be relying on the removed views?
- Have you updated the API documentation to reflect these changes?
To assess the impact, let's check for any remaining references to the removed views:
Also applies to: 60-68
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Search for references to removed views in the codebase # Expect: No output, indicating no lingering references removed_views=( "v_breakoutRoom" "v_breakoutRoom_assignedUser" "v_breakoutRoom_participant" "v_breakoutRoom_user" "v_caption" "v_caption_activeLocales" "v_chat" "v_chat_message_private" "v_chat_message_public" "v_chat_message_reaction" "v_chat_user" "v_current_time" "v_externalVideo" "v_layout" "v_meeting" "v_meeting_breakoutPolicies" "v_meeting_clientPluginSettings" "v_meeting_clientSettings" "v_meeting_componentsFlags" "v_meeting_group" "v_meeting_learningDashboard" "v_meeting_lockSettings" "v_meeting_metadata" "v_meeting_recording" "v_meeting_recordingPolicies" "v_meeting_usersPolicies" "v_meeting_voiceSettings" "v_notification" "v_plugin" "v_pluginDataChannelEntry" "v_poll" "v_poll_option" "v_poll_response" "v_poll_user" "v_poll_user_current" "v_pres_annotation_curr" "v_pres_annotation_history_curr" "v_pres_page" "v_pres_page_curr" "v_pres_page_cursor" "v_pres_page_writers" "v_pres_presentation" "v_pres_presentation_uploadToken" "v_screenshare" "v_sharedNotes" "v_sharedNotes_diff" "v_sharedNotes_session" "v_timer" "v_user" "v_user_breakoutRoom" "v_user_camera" "v_user_clientSettings" "v_user_connectionStatus" "v_user_connectionStatusReport" "v_user_current" "v_user_guest" "v_user_lockSettings" "v_user_metadata" "v_user_reaction" "v_user_ref" "v_user_transcriptionError" "v_user_typing_private" "v_user_typing_public" "v_user_voice" "v_user_voice_activity" "v_user_welcomeMsgs" ) for view in "${removed_views[@]}"; do rg -i "\b${view}\b" --type yaml --type typescript --type javascript doneLength of output: 11433
Script:
#!/bin/bash # Description: Search for references to removed views in the codebase without specifying unrecognized file types # Expect: No output, indicating no lingering references removed_views=( "v_breakoutRoom" "v_breakoutRoom_assignedUser" "v_breakoutRoom_participant" "v_breakoutRoom_user" "v_caption" "v_caption_activeLocales" "v_chat" "v_chat_message_private" "v_chat_message_public" "v_chat_message_reaction" "v_chat_user" "v_current_time" "v_externalVideo" "v_layout" "v_meeting" "v_meeting_breakoutPolicies" "v_meeting_clientPluginSettings" "v_meeting_clientSettings" "v_meeting_componentsFlags" "v_meeting_group" "v_meeting_learningDashboard" "v_meeting_lockSettings" "v_meeting_metadata" "v_meeting_recording" "v_meeting_recordingPolicies" "v_meeting_usersPolicies" "v_meeting_voiceSettings" "v_notification" "v_plugin" "v_pluginDataChannelEntry" "v_poll" "v_poll_option" "v_poll_response" "v_poll_user" "v_poll_user_current" "v_pres_annotation_curr" "v_pres_annotation_history_curr" "v_pres_page" "v_pres_page_curr" "v_pres_page_cursor" "v_pres_page_writers" "v_pres_presentation" "v_pres_presentation_uploadToken" "v_screenshare" "v_sharedNotes" "v_sharedNotes_diff" "v_sharedNotes_session" "v_timer" "v_user" "v_user_breakoutRoom" "v_user_camera" "v_user_clientSettings" "v_user_connectionStatus" "v_user_connectionStatusReport" "v_user_current" "v_user_guest" "v_user_lockSettings" "v_user_metadata" "v_user_reaction" "v_user_ref" "v_user_transcriptionError" "v_user_typing_private" "v_user_typing_public" "v_user_voice" "v_user_voice_activity" "v_user_welcomeMsgs" ) for view in "${removed_views[@]}"; do rg -i "\b${view}\b" -e "*.yaml" -e "*.ts" -e "*.tsx" -e "*.js" doneLength of output: 15261
Script:
#!/bin/bash # Description: Search for references to removed views in the codebase using correct rg flags # Expect: No output, indicating no lingering references removed_views=( "v_breakoutRoom" "v_breakoutRoom_assignedUser" "v_breakoutRoom_participant" "v_breakoutRoom_user" "v_caption" "v_caption_activeLocales" "v_chat" "v_chat_message_private" "v_chat_message_public" "v_chat_message_reaction" "v_chat_user" "v_current_time" "v_externalVideo" "v_layout" "v_meeting" "v_meeting_breakoutPolicies" "v_meeting_clientPluginSettings" "v_meeting_clientSettings" "v_meeting_componentsFlags" "v_meeting_group" "v_meeting_learningDashboard" "v_meeting_lockSettings" "v_meeting_metadata" "v_meeting_recording" "v_meeting_recordingPolicies" "v_meeting_usersPolicies" "v_meeting_voiceSettings" "v_notification" "v_plugin" "v_pluginDataChannelEntry" "v_poll" "v_poll_option" "v_poll_response" "v_poll_user" "v_poll_user_current" "v_pres_annotation_curr" "v_pres_annotation_history_curr" "v_pres_page" "v_pres_page_curr" "v_pres_page_cursor" "v_pres_page_writers" "v_pres_presentation" "v_pres_presentation_uploadToken" "v_screenshare" "v_sharedNotes" "v_sharedNotes_diff" "v_sharedNotes_session" "v_timer" "v_user" "v_user_breakoutRoom" "v_user_camera" "v_user_clientSettings" "v_user_connectionStatus" "v_user_connectionStatusReport" "v_user_current" "v_user_guest" "v_user_lockSettings" "v_user_metadata" "v_user_reaction" "v_user_ref" "v_user_transcriptionError" "v_user_typing_private" "v_user_typing_public" "v_user_voice" "v_user_voice_activity" "v_user_welcomeMsgs" ) for view in "${removed_views[@]}"; do rg -i "\b${view}\b" -g "*.yaml" -g "*.ts" -g "*.tsx" -g "*.js" doneLength of output: 25731
bbb-graphql-server/bbb_schema.sql (7)
Line range hint
1-22: LGTM! Consider refining the emoji removal function.The initial setup with the 'unaccent' extension and utility functions looks good. The 'immutable_lower_unaccent' function is well-optimized for text normalization.
For the 'remove_emojis' function, consider using a more specific regex to target only emoji characters, as the current regex might remove other valid non-UTF8 characters. For example:
regexp_replace(input_string, '[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}\u{1F680}-\u{1F6FF}\u{1F1E0}-\u{1F1FF}]', '', 'g')This regex specifically targets emoji Unicode ranges.
Line range hint
24-262: LGTM! Consider standardizing timestamp column names.The meeting-related tables and functions are well-structured with appropriate constraints and indexes. The use of generated columns for
createdAtandendedis a good optimization.For consistency, consider standardizing the naming convention for timestamp columns. For example:
createdTimein themeetingtable could be renamed tocreatedAtfor consistency with other tables.endedAtcould be used consistently instead ofendTimeorendedTimeacross all tables.This standardization would make querying and joining tables more intuitive.
Line range hint
264-532: LGTM! Consider adding a composite index for user lookup.The user-related tables and functions are well-designed, with good use of generated columns, triggers, and separate tables for different concerns. The extensive use of indexes should help with query performance.
To potentially improve performance further, consider adding a composite index on the
usertable for commonly used lookup patterns. For example:CREATE INDEX idx_user_lookup ON "user" ("meetingId", "extId", "role", "currentlyInMeeting");This index could help optimize queries that filter users based on these common criteria.
Also, ensure that the
user_graphqlConnectiontable has appropriate cleanup mechanisms to prevent it from growing indefinitely over time.
Line range hint
534-747: LGTM! Consider adding a full-text search index for message content.The chat-related tables and functions are well-structured with appropriate triggers and views. The separation of chat_message and chat_message_history is a good approach for managing message edits.
To improve message search capabilities, consider adding a full-text search index on the message content. This can be achieved using PostgreSQL's built-in full-text search:
ALTER TABLE chat_message ADD COLUMN message_tsvector tsvector; CREATE INDEX chat_message_fts_idx ON chat_message USING GIN (message_tsvector); CREATE TRIGGER chat_message_tsvector_update BEFORE INSERT OR UPDATE ON chat_message FOR EACH ROW EXECUTE FUNCTION tsvector_update_trigger(message_tsvector, 'pg_catalog.english', message);This will allow for efficient full-text search queries on chat messages.
Line range hint
749-1076: LGTM! Consider implementing pagination for large presentations.The presentation and annotation-related tables and functions are well-designed with appropriate triggers and views. The separation of concerns between presentations, pages, and annotations is good for modularity.
To improve performance and user experience when dealing with large presentations, consider implementing a pagination mechanism. This could involve:
- Adding a
pageSizeandpageNumbercolumn to thepres_presentationtable.- Modifying the
v_pres_pageview to include pagination information.- Creating a function to efficiently fetch paginated results:
CREATE OR REPLACE FUNCTION get_presentation_pages( p_presentation_id VARCHAR, p_page_size INTEGER, p_page_number INTEGER ) RETURNS TABLE ( -- return the same columns as v_pres_page ) AS $$ BEGIN RETURN QUERY SELECT * FROM v_pres_page WHERE "presentationId" = p_presentation_id ORDER BY num LIMIT p_page_size OFFSET (p_page_number - 1) * p_page_size; END; $$ LANGUAGE plpgsql;This approach would allow for more efficient loading of large presentations, especially in a web-based environment.
Line range hint
1078-1308: LGTM! Consider standardizing the naming convention for boolean columns.The tables and functions for polls, external videos, screenshare, and timers are well-structured with appropriate indexes and views. The separation of concerns between different features is good for modularity.
For improved consistency and readability, consider standardizing the naming convention for boolean columns across all tables. For example:
- In the
polltable:secret,multipleResponses,ended,published- In the
timertable:stopwatch,running,activeYou could adopt a prefix like
is_orhas_for all boolean columns:ALTER TABLE poll RENAME COLUMN secret TO is_secret; ALTER TABLE poll RENAME COLUMN multipleResponses TO has_multiple_responses; ALTER TABLE poll RENAME COLUMN ended TO is_ended; ALTER TABLE poll RENAME COLUMN published TO is_published; ALTER TABLE timer RENAME COLUMN stopwatch TO is_stopwatch; ALTER TABLE timer RENAME COLUMN running TO is_running; ALTER TABLE timer RENAME COLUMN active TO is_active;This would make the schema more consistent and self-documenting.
Line range hint
1310-1741: LGTM! Consider implementing a cleanup mechanism for plugin data.The tables and functions for breakout rooms, shared notes, captions, layouts, notifications, and plugins are well-designed with appropriate indexes and views. The schema demonstrates a comprehensive approach to managing various features of a video conferencing system.
To improve long-term performance and data management, consider implementing a cleanup mechanism for plugin data, especially for the
pluginDataChannelEntrytable. This table might accumulate a large amount of data over time. You could:
- Add a
retention_periodcolumn to theplugintable to specify how long data should be kept for each plugin.- Create a function to periodically clean up old data:
CREATE OR REPLACE FUNCTION cleanup_plugin_data() RETURNS void AS $$ BEGIN DELETE FROM pluginDataChannelEntry pde USING plugin p WHERE pde.meetingId = p.meetingId AND pde.pluginName = p.name AND pde.createdAt < (CURRENT_TIMESTAMP - p.retention_period::interval); END; $$ LANGUAGE plpgsql;
- Set up a scheduled job to run this function regularly.
This approach would help manage the growth of plugin-related data and maintain system performance over time.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
- bbb-graphql-server/bbb_schema.sql (3 hunks)
- bbb-graphql-server/metadata/databases/BigBlueButton/tables/public_v_user_presenceLog.yaml (1 hunks)
- bbb-graphql-server/metadata/databases/BigBlueButton/tables/tables.yaml (1 hunks)
🧰 Additional context used
🔇 Additional comments (2)
bbb-graphql-server/metadata/databases/BigBlueButton/tables/tables.yaml (1)
59-59: New user presence logging view added. Please provide implementation details.The addition of
public_v_user_presenceLog.yamlaligns with the PR objective to introduce user presence tracking. This is a positive change that enhances the system's capabilities for monitoring user attendance in meetings.To ensure a smooth integration of this new feature:
- Can you provide the implementation details of the
v_user_presenceLogview?- How does this view interact with existing user and meeting data?
- Are there any performance considerations for this new view, especially for large meetings?
- Have you added appropriate access controls and privacy measures for this potentially sensitive data?
Let's check the implementation of the new view:
✅ Verification successful
Implementation Details of
v_user_presenceLogView ProvidedThe
v_user_presenceLogview is defined inbbb-graphql-server/bbb_schema.sqlas follows:CREATE OR REPLACE VIEW "v_user_presenceLog" AS SELECT "user"."meetingId", "user"."userId", "user"."extId", CASE WHEN "user"."role" = 'MODERATOR' THEN true ELSE false END "isModerator", "user"."currentlyInMeeting" FROM "user" WHERE "firstJoinedAt" IS NOT NULL;
Interaction with Existing Data: The view interacts directly with the existing
usertable, filtering users who have afirstJoinedAttimestamp. It includes a derived columnisModeratorto indicate if a user has a moderator role.Performance Considerations: The view performs straightforward selections and a simple conditional check. Ensure that the
usertable has appropriate indexes onmeetingId,userId, androleto maintain optimal performance, especially for large meetings.Access Controls and Privacy Measures: Access to the view is restricted in
public_v_user_presenceLog.yaml, allowing thebbb_clientrole to access only specific columns (currentlyInMeeting,extId,isModerator,userId) and applying filters based onmeetingIdandisModerator. This ensures sensitive data is protected and only relevant information is exposed.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Display the contents of the new user presence log view # Expect: The SQL definition of the v_user_presenceLog view cat bbb-graphql-server/metadata/databases/BigBlueButton/tables/public_v_user_presenceLog.yamlLength of output: 685
Script:
#!/bin/bash # Description: Find the SQL definition of the v_user_presenceLog view # Expect: The file path(s) where v_user_presenceLog is defined rg -i "CREATE VIEW.*v_user_presenceLog" --type sqlLength of output: 52
Script:
#!/bin/bash # Description: Search for any references to v_user_presenceLog in SQL files # Expect: File paths and context where v_user_presenceLog is mentioned rg -i "v_user_presenceLog" --type sqlLength of output: 115
Script:
#!/bin/bash # Description: Extract the full SQL definition of the v_user_presenceLog view from bbb_schema.sql # Expect: The complete CREATE VIEW statement for v_user_presenceLog rg -i -A 50 'CREATE OR REPLACE VIEW "v_user_presenceLog"' bbb-graphql-server/bbb_schema.sqlLength of output: 1828
bbb-graphql-server/bbb_schema.sql (1)
Line range hint
1-1741: Excellent schema design with room for minor enhancements.The
bbb_schema.sqlfile presents a well-structured and comprehensive database schema for the BigBlueButton GraphQL server. It effectively covers all aspects of a modern video conferencing system, including user management, meetings, chat, polls, presentations, and various interactive features.Key strengths:
- Proper use of PostgreSQL features like generated columns, triggers, and views.
- Good indexing strategy for frequently queried columns.
- Effective balance between normalization and denormalization.
- Clear separation of concerns with modular table design.
Suggestions for improvement:
- Standardize naming conventions, especially for timestamp and boolean columns.
- Implement pagination for large datasets (e.g., presentations, chat messages).
- Add full-text search capabilities for relevant text fields.
- Develop a data retention and cleanup strategy, particularly for plugin data and historical information.
- Consider adding more composite indexes for common query patterns.
Overall, this schema provides a solid foundation for the BigBlueButton GraphQL server. Implementing the suggested improvements could further enhance performance, maintainability, and scalability.
Automated tests Summary✅ All the CI tests have passed! |



This PR adds the
user_presenceLogtype to the GraphQL schema, which will enable tracking of users' presence in the meeting, including those who have already exited the session. This functionality is essential for teachers to view a comprehensive list of attendees, including those no longer in the meeting.It is not intended to be used by the Client. But it will be useful for plugins.
It also adds a column
user.firstJoinedAtthat was necessary to track if the user has already joined in the meeting (in the past).This column is not being provided by any graphql Type, but it can easily be provided in the future if necessary.