2024-02-23 23:01:53 +08:00
|
|
|
import { gql } from '@apollo/client';
|
2024-06-17 19:35:11 +08:00
|
|
|
|
|
|
|
export const VIDEO_STREAMS_SUBSCRIPTION = gql`
|
|
|
|
subscription VideoStreams {
|
|
|
|
user_camera {
|
|
|
|
streamId
|
|
|
|
user {
|
|
|
|
name
|
|
|
|
userId
|
|
|
|
nameSortable
|
|
|
|
pinned
|
|
|
|
away
|
|
|
|
disconnected
|
|
|
|
role
|
|
|
|
avatar
|
|
|
|
color
|
|
|
|
presenter
|
|
|
|
clientType
|
|
|
|
raiseHand
|
|
|
|
isModerator
|
|
|
|
reactionEmoji
|
|
|
|
}
|
|
|
|
voice {
|
|
|
|
floor
|
|
|
|
lastFloorTime
|
2024-06-29 03:58:29 +08:00
|
|
|
joined
|
|
|
|
listenOnly
|
|
|
|
userId
|
2024-06-17 19:35:11 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-02-23 23:01:53 +08:00
|
|
|
`;
|
|
|
|
|
2024-06-17 19:35:11 +08:00
|
|
|
export const OWN_VIDEO_STREAMS_QUERY = gql`
|
|
|
|
query OwnVideoStreams($userId: String!, $streamIdPrefix: String!) {
|
|
|
|
user_camera(
|
|
|
|
where: {
|
|
|
|
userId: { _eq: $userId },
|
|
|
|
streamId: { _like: $streamIdPrefix }
|
|
|
|
},
|
|
|
|
) {
|
|
|
|
streamId
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const VIEWERS_IN_WEBCAM_COUNT_SUBSCRIPTION = gql`
|
|
|
|
subscription ViewerVideoStreams {
|
|
|
|
user_camera_aggregate(where: {
|
|
|
|
user: { role: { _eq: "VIEWER" }, presenter: { _eq: false } }
|
|
|
|
}) {
|
|
|
|
aggregate {
|
|
|
|
count
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const GRID_USERS_SUBSCRIPTION = gql`
|
2024-07-29 21:37:38 +08:00
|
|
|
subscription GridUsers($limit: Int!) {
|
2024-06-17 19:35:11 +08:00
|
|
|
user(
|
|
|
|
where: {
|
2024-07-29 21:37:38 +08:00
|
|
|
cameras_aggregate: {
|
|
|
|
count: {
|
|
|
|
predicate: { _eq: 0 },
|
|
|
|
},
|
2024-06-17 19:35:11 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
limit: $limit,
|
|
|
|
order_by: {
|
|
|
|
nameSortable: asc,
|
|
|
|
userId: asc,
|
|
|
|
},
|
|
|
|
) {
|
|
|
|
name
|
|
|
|
userId
|
|
|
|
nameSortable
|
|
|
|
pinned
|
|
|
|
away
|
|
|
|
disconnected
|
|
|
|
role
|
|
|
|
avatar
|
|
|
|
color
|
|
|
|
presenter
|
|
|
|
clientType
|
|
|
|
raiseHand
|
|
|
|
isModerator
|
|
|
|
reactionEmoji
|
2024-06-29 03:58:29 +08:00
|
|
|
voice {
|
|
|
|
joined
|
|
|
|
listenOnly
|
|
|
|
userId
|
|
|
|
}
|
2024-06-17 19:35:11 +08:00
|
|
|
}
|
2024-02-23 23:01:53 +08:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export default {
|
2024-06-17 19:35:11 +08:00
|
|
|
OWN_VIDEO_STREAMS_QUERY,
|
|
|
|
VIDEO_STREAMS_SUBSCRIPTION,
|
|
|
|
VIEWERS_IN_WEBCAM_COUNT_SUBSCRIPTION,
|
|
|
|
GRID_USERS_SUBSCRIPTION,
|
2024-02-23 23:01:53 +08:00
|
|
|
};
|