Merge branch 'pull-17124' into apollo-client

This commit is contained in:
Tainan Felipe 2023-04-19 11:31:48 -03:00
commit 94be8f5ebb
8 changed files with 204 additions and 5 deletions

View File

@ -18,6 +18,7 @@ import AnnotationsHistory from "./AnnotationsHistory";
import CursorsStream from "./CursorsStream";
import CursorsAll from "./CursorsAll";
import TalkingStream from "./TalkingStream";
import MyInfo from "./MyInfo";
function App() {
@ -97,6 +98,8 @@ function App() {
Who am I? {userName} ({userId})
<MeetingInfo />
<br />
<MyInfo />
<br />
<UserList userId={userId} />
<br />
<ChatsInfo />

View File

@ -24,6 +24,9 @@ export default function MeetingInfo() {
return !loading && !error &&
(<table border="1">
<thead>
<tr>
<th colSpan={3}>Meeting Info</th>
</tr>
<tr>
{/*<th>Id</th>*/}
<th>Name</th>

View File

@ -0,0 +1,43 @@
import {gql, useQuery} from '@apollo/client';
export default function MyInfo() {
const { loading, error, data } = useQuery(
gql`query {
user_current {
userId
name
meeting {
name
}
}
}`
);
return !loading && !error &&
(<table border="1">
<thead>
<tr>
<th colSpan={3}>My info</th>
</tr>
<tr>
{/*<th>Id</th>*/}
<th>userId</th>
<th>name</th>
<th>Meeting</th>
</tr>
</thead>
<tbody>
{data.user_current.map((curr) => {
console.log('meeting', curr);
return (
<tr key={curr.userId}>
<td>{curr.userId}</td>
<td>{curr.name}</td>
<td>{curr.meeting.name}</td>
</tr>
);
})}
</tbody>
</table>);
}

View File

@ -23,6 +23,7 @@ DROP VIEW IF EXISTS "v_user_voice";
--DROP VIEW IF EXISTS "v_user_whiteboard";
DROP VIEW IF EXISTS "v_user_breakoutRoom";
DROP VIEW IF EXISTS "v_user";
DROP VIEW IF EXISTS "v_user_current";
DROP VIEW IF EXISTS "v_user_ref";
DROP TABLE IF EXISTS "user_camera";
DROP TABLE IF EXISTS "user_voice";
@ -32,6 +33,7 @@ DROP TABLE IF EXISTS "user_connectionStatus";
DROP TABLE IF EXISTS "user";
drop view if exists "v_meeting_lockSettings";
drop view if exists "v_meeting_showUserlist";
drop view if exists "v_meeting_usersPolicies";
drop table if exists "meeting_breakout";
drop table if exists "meeting_recording";
@ -169,6 +171,14 @@ FROM meeting m
JOIN "meeting_lockSettings" mls ON mls."meetingId" = m."meetingId"
JOIN "meeting_usersPolicies" mup ON mup."meetingId" = m."meetingId";
CREATE OR REPLACE VIEW "v_meeting_showUserlist" AS
SELECT "meetingId"
FROM "meeting_lockSettings"
WHERE "hideUserList" IS FALSE;
CREATE INDEX "idx_meeting_lockSettings_hideUserList_false" ON "meeting_lockSettings"("meetingId") WHERE "hideUserList" IS FALSE;
create table "meeting_group" (
"meetingId" varchar(100) references "meeting"("meetingId") ON DELETE CASCADE,
"groupId" varchar(100),
@ -244,6 +254,31 @@ AS SELECT "user"."userId",
CREATE INDEX "idx_v_user_meetingId" ON "user"("meetingId") where "user"."loggedOut" IS FALSE and "user"."joined" IS TRUE;
CREATE INDEX "idx_v_user_meetingId_orderByColumns" ON "user"("meetingId","role","name","userId") where "user"."loggedOut" IS FALSE and "user"."joined" IS TRUE;
CREATE OR REPLACE VIEW "v_user_current"
AS SELECT "user"."userId",
"user"."extId",
"user"."meetingId",
"user"."name",
"user"."avatar",
"user"."color",
"user"."emoji",
"user"."guest",
"user"."guestStatus",
"user"."mobile",
"user"."clientType",
"user"."role",
"user"."authed",
"user"."joined",
"user"."leftFlag",
"user"."banned",
"user"."loggedOut",
"user"."registeredOn",
"user"."presenter",
"user"."pinned",
"user"."locked",
CASE WHEN "user"."role" = 'MODERATOR' THEN true ELSE false END "isModerator"
FROM "user";
--v_user_ref will be used only as foreign key (not possible to fetch this table directly through graphql)
--it is necessary because v_user has some conditions like "lockSettings-hideUserList"
--but viewers still needs to query this users as foreign key of chat, cameras, etc
@ -333,7 +368,7 @@ JOIN "user" u ON u."userId" = "user_breakoutRoom"."userId";
CREATE TABLE "user_connectionStatus" (
"userId" varchar(50) PRIMARY KEY REFERENCES "user"("userId") ON DELETE CASCADE,
"meetingId" varchar(100) REFERENCES meeting("meetingId"),
"meetingId" varchar(100) REFERENCES "meeting"("meetingId") ON DELETE CASCADE,
"status" varchar(15),
"statusUpdatedAt" timestamp,
"connectionAliveAt" timestamp

View File

@ -0,0 +1,3 @@
table:
name: v_meeting_showUserlist
schema: public

View File

@ -101,7 +101,11 @@ select_permissions:
_eq: true
- meetingId:
_neq: X-Hasura-LockedInMeeting
- meeting:
lockSettings:
hideUserList:
_eq: false
- _exists:
_table:
name: v_meeting_showUserlist
schema: public
_where:
meetingId:
_eq: X-Hasura-MeetingId
allow_aggregations: true

View File

@ -0,0 +1,106 @@
table:
name: v_user_current
schema: public
configuration:
column_config: {}
custom_column_names: {}
custom_name: user_current
custom_root_fields: {}
object_relationships:
- name: connectionStatus
using:
manual_configuration:
column_mapping:
userId: userId
insertion_order: null
remote_table:
name: user_connectionStatus
schema: public
- name: lastBreakoutRoom
using:
manual_configuration:
column_mapping:
userId: userId
insertion_order: null
remote_table:
name: v_user_breakoutRoom
schema: public
- name: meeting
using:
manual_configuration:
column_mapping:
meetingId: meetingId
insertion_order: null
remote_table:
name: meeting
schema: public
- name: voice
using:
manual_configuration:
column_mapping:
userId: userId
insertion_order: null
remote_table:
name: v_user_voice
schema: public
array_relationships:
- name: cameras
using:
manual_configuration:
column_mapping:
userId: userId
insertion_order: null
remote_table:
name: v_user_camera
schema: public
- name: chats
using:
manual_configuration:
column_mapping:
userId: userId
insertion_order: null
remote_table:
name: v_chat
schema: public
- name: presPagesWritable
using:
manual_configuration:
column_mapping:
meetingId: meetingId
userId: userId
insertion_order: null
remote_table:
name: v_pres_page_writers
schema: public
select_permissions:
- role: bbb_client
permission:
columns:
- userId
- extId
- meetingId
- name
- avatar
- color
- emoji
- guest
- guestStatus
- mobile
- clientType
- role
- authed
- joined
- leftFlag
- banned
- loggedOut
- registeredOn
- presenter
- pinned
- locked
- isModerator
filter:
_and:
- meetingId:
_eq: X-Hasura-MeetingId
- userId:
_eq: X-Hasura-UserId

View File

@ -5,6 +5,7 @@
- "!include public_v_chat_message_private.yaml"
- "!include public_v_chat_message_public.yaml"
- "!include public_v_meeting_lockSettings.yaml"
- "!include public_v_meeting_showUserlist.yaml"
- "!include public_v_meeting_usersPolicies.yaml"
- "!include public_v_pres_annotation_curr.yaml"
- "!include public_v_pres_annotation_history_curr.yaml"
@ -13,6 +14,7 @@
- "!include public_v_user.yaml"
- "!include public_v_user_breakoutRoom.yaml"
- "!include public_v_user_camera.yaml"
- "!include public_v_user_current.yaml"
- "!include public_v_user_ref.yaml"
- "!include public_v_user_typing_public.yaml"
- "!include public_v_user_voice.yaml"