2024-04-20 04:34:43 +08:00
|
|
|
import { gql } from '@apollo/client';
|
|
|
|
|
|
|
|
export interface VideoStreamsResponse {
|
|
|
|
user_camera: {
|
|
|
|
streamId: string;
|
|
|
|
user: {
|
|
|
|
userId: string;
|
|
|
|
pinned: boolean;
|
|
|
|
nameSortable: string;
|
|
|
|
name: string;
|
|
|
|
isModerator: boolean;
|
|
|
|
};
|
|
|
|
voice?: {
|
|
|
|
floor: boolean;
|
|
|
|
lastFloorTime: string;
|
|
|
|
};
|
|
|
|
}[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface VideoStreamsUsersResponse {
|
|
|
|
user: {
|
|
|
|
userId: string;
|
|
|
|
pinned: boolean;
|
|
|
|
nameSortable: string;
|
|
|
|
name: string;
|
|
|
|
away: boolean;
|
|
|
|
disconnected: boolean;
|
|
|
|
emoji: string;
|
|
|
|
role: string;
|
|
|
|
avatar: string;
|
|
|
|
color: string;
|
|
|
|
presenter: boolean;
|
|
|
|
clientType: string;
|
|
|
|
raiseHand: boolean;
|
2024-05-02 03:48:12 +08:00
|
|
|
isModerator: boolean;
|
2024-04-20 04:34:43 +08:00
|
|
|
reaction: {
|
|
|
|
reactionEmoji: string;
|
|
|
|
};
|
|
|
|
}[];
|
|
|
|
}
|
|
|
|
|
2024-05-02 22:22:24 +08:00
|
|
|
export interface OwnVideoStreamsResponse {
|
|
|
|
user_camera: {
|
|
|
|
streamId: string;
|
|
|
|
}[];
|
|
|
|
}
|
|
|
|
|
2024-04-20 04:34:43 +08:00
|
|
|
export const VIDEO_STREAMS_SUBSCRIPTION = gql`
|
|
|
|
subscription VideoStreams {
|
|
|
|
user_camera {
|
|
|
|
streamId
|
|
|
|
user {
|
|
|
|
userId
|
|
|
|
pinned
|
|
|
|
nameSortable
|
|
|
|
name
|
|
|
|
isModerator
|
|
|
|
}
|
|
|
|
voice {
|
|
|
|
floor
|
|
|
|
lastFloorTime
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const OWN_VIDEO_STREAMS_QUERY = gql`
|
2024-05-08 05:05:36 +08:00
|
|
|
query OwnVideoStreams($userId: String!, $streamIdPrefix: String!) {
|
2024-04-20 04:34:43 +08:00
|
|
|
user_camera(
|
|
|
|
where: {
|
2024-05-08 05:05:36 +08:00
|
|
|
userId: { _eq: $userId },
|
|
|
|
streamId: { _like: $streamIdPrefix }
|
2024-04-20 04:34:43 +08:00
|
|
|
},
|
|
|
|
) {
|
|
|
|
streamId
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const VIEWERS_IN_WEBCAM_COUNT_SUBSCRIPTION = gql`
|
|
|
|
subscription ViewerVideoStreams {
|
|
|
|
user_camera_aggregate(where: {
|
|
|
|
user: { role: { _eq: "VIEWER" }, presenter: { _eq: false } }
|
|
|
|
}) {
|
|
|
|
aggregate {
|
|
|
|
count
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2024-05-03 20:58:27 +08:00
|
|
|
export const GRID_USERS_SUBSCRIPTION = gql`
|
2024-05-04 03:35:56 +08:00
|
|
|
subscription GridUsers($exceptUserIds: [String]!, $limit: Int!) {
|
2024-05-03 20:58:27 +08:00
|
|
|
user(
|
|
|
|
where: {
|
|
|
|
userId: {
|
2024-05-06 20:01:39 +08:00
|
|
|
_nin: $exceptUserIds,
|
2024-05-03 20:58:27 +08:00
|
|
|
},
|
|
|
|
},
|
2024-05-06 19:23:55 +08:00
|
|
|
limit: $limit,
|
2024-05-06 20:01:39 +08:00
|
|
|
order_by: {
|
|
|
|
nameSortable: asc,
|
|
|
|
userId: asc,
|
|
|
|
},
|
2024-05-03 20:58:27 +08:00
|
|
|
) {
|
2024-04-20 04:34:43 +08:00
|
|
|
name
|
|
|
|
userId
|
|
|
|
nameSortable
|
|
|
|
pinned
|
|
|
|
away
|
|
|
|
disconnected
|
|
|
|
emoji
|
|
|
|
role
|
|
|
|
avatar
|
|
|
|
color
|
|
|
|
presenter
|
|
|
|
clientType
|
|
|
|
userId
|
|
|
|
raiseHand
|
|
|
|
isModerator
|
|
|
|
reaction {
|
|
|
|
reactionEmoji
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2024-05-02 20:17:58 +08:00
|
|
|
export const VIDEO_STREAMS_USERS_FILTERED_SUBSCRIPTION = gql`
|
|
|
|
subscription FilteredVideoStreamsUsers($userIds: [String]!) {
|
|
|
|
user(
|
|
|
|
where: {
|
|
|
|
userId: {
|
|
|
|
_in: $userIds
|
|
|
|
}
|
|
|
|
}
|
|
|
|
) {
|
|
|
|
name
|
|
|
|
userId
|
|
|
|
nameSortable
|
|
|
|
pinned
|
|
|
|
away
|
|
|
|
disconnected
|
|
|
|
emoji
|
|
|
|
role
|
|
|
|
avatar
|
|
|
|
color
|
|
|
|
presenter
|
|
|
|
clientType
|
|
|
|
userId
|
|
|
|
raiseHand
|
|
|
|
isModerator
|
|
|
|
reaction {
|
|
|
|
reactionEmoji
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2024-04-20 04:34:43 +08:00
|
|
|
export default {
|
2024-05-02 03:48:12 +08:00
|
|
|
OWN_VIDEO_STREAMS_QUERY,
|
2024-04-20 04:34:43 +08:00
|
|
|
VIDEO_STREAMS_SUBSCRIPTION,
|
|
|
|
VIEWERS_IN_WEBCAM_COUNT_SUBSCRIPTION,
|
2024-05-03 20:58:27 +08:00
|
|
|
GRID_USERS_SUBSCRIPTION,
|
2024-05-06 20:01:39 +08:00
|
|
|
VIDEO_STREAMS_USERS_FILTERED_SUBSCRIPTION,
|
2024-04-20 04:34:43 +08:00
|
|
|
};
|