2023-09-28 04:42:47 +08:00
|
|
|
import { gql } from '@apollo/client';
|
|
|
|
|
2024-03-16 02:17:27 +08:00
|
|
|
// Interface for a single cursor coordinates object
|
|
|
|
export interface CursorCoordinates {
|
|
|
|
xPercent: number;
|
|
|
|
yPercent: number;
|
|
|
|
userId: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Interface for the response data
|
|
|
|
export interface CursorCoordinatesResponse {
|
|
|
|
pres_page_cursor_stream: CursorCoordinates[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface UserCursor {
|
|
|
|
name: string;
|
|
|
|
presenter: boolean;
|
|
|
|
role: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface userCursorResponse {
|
|
|
|
userId: string;
|
|
|
|
isCurrentPage: boolean;
|
|
|
|
lastUpdatedAt: string;
|
|
|
|
pageId: string;
|
|
|
|
presentationId: string;
|
|
|
|
user: UserCursor;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Interface for the pres_page_cursor subscription
|
|
|
|
export interface CursorSubscriptionResponse {
|
|
|
|
pres_page_cursor: Array<userCursorResponse>;
|
|
|
|
}
|
|
|
|
|
2023-09-28 04:42:47 +08:00
|
|
|
export const CURRENT_PRESENTATION_PAGE_SUBSCRIPTION = gql`subscription CurrentPresentationPagesSubscription {
|
|
|
|
pres_page_curr {
|
|
|
|
height
|
|
|
|
isCurrentPage
|
|
|
|
num
|
|
|
|
pageId
|
|
|
|
scaledHeight
|
|
|
|
scaledViewBoxHeight
|
|
|
|
scaledViewBoxWidth
|
|
|
|
scaledWidth
|
2023-10-18 00:49:23 +08:00
|
|
|
svgUrl: urlsJson(path: "$.svg")
|
2023-09-28 04:42:47 +08:00
|
|
|
width
|
|
|
|
xOffset
|
|
|
|
yOffset
|
|
|
|
presentationId
|
2023-10-03 03:16:46 +08:00
|
|
|
content
|
|
|
|
downloadFileUri
|
2023-10-18 00:35:48 +08:00
|
|
|
totalPages
|
2023-10-03 03:16:46 +08:00
|
|
|
downloadable
|
2023-10-03 20:08:12 +08:00
|
|
|
presentationName
|
|
|
|
isDefaultPresentation
|
2023-09-28 04:42:47 +08:00
|
|
|
}
|
|
|
|
}`;
|
|
|
|
|
2023-10-17 03:27:22 +08:00
|
|
|
export const PRESENTATIONS_SUBSCRIPTION = gql`subscription PresentationsSubscription {
|
|
|
|
pres_presentation {
|
2023-10-18 00:35:48 +08:00
|
|
|
uploadInProgress
|
2023-10-17 03:27:22 +08:00
|
|
|
current
|
|
|
|
downloadFileUri
|
|
|
|
downloadable
|
2023-10-18 00:35:48 +08:00
|
|
|
uploadErrorDetailsJson
|
|
|
|
uploadErrorMsgKey
|
2023-10-17 03:27:22 +08:00
|
|
|
filenameConverted
|
|
|
|
isDefault
|
|
|
|
name
|
2023-10-18 00:35:48 +08:00
|
|
|
totalPages
|
|
|
|
totalPagesUploaded
|
2023-10-17 03:27:22 +08:00
|
|
|
presentationId
|
|
|
|
removable
|
|
|
|
uploadCompleted
|
|
|
|
}
|
|
|
|
}`;
|
|
|
|
|
2023-10-20 02:56:13 +08:00
|
|
|
export const EXPORTING_PRESENTATIONS_SUBSCRIPTION = gql`subscription PresentationsSubscription {
|
|
|
|
pres_presentation {
|
|
|
|
uploadInProgress
|
|
|
|
current
|
|
|
|
downloadFileUri
|
|
|
|
downloadable
|
|
|
|
uploadErrorDetailsJson
|
|
|
|
uploadErrorMsgKey
|
|
|
|
filenameConverted
|
|
|
|
isDefault
|
|
|
|
name
|
|
|
|
totalPages
|
|
|
|
totalPagesUploaded
|
|
|
|
presentationId
|
|
|
|
removable
|
|
|
|
uploadCompleted
|
|
|
|
exportToChatInProgress
|
|
|
|
exportToChatStatus
|
|
|
|
exportToChatCurrentPage
|
|
|
|
exportToChatHasError
|
|
|
|
}
|
|
|
|
}`;
|
|
|
|
|
2023-10-17 21:20:24 +08:00
|
|
|
export const PROCESSED_PRESENTATIONS_SUBSCRIPTION = gql`subscription ProcessedPresentationsSubscription {
|
2023-10-18 04:42:59 +08:00
|
|
|
pres_presentation(where: { uploadCompleted: { _eq: true } }) {
|
2023-10-17 21:20:24 +08:00
|
|
|
current
|
|
|
|
name
|
|
|
|
presentationId
|
|
|
|
}
|
|
|
|
}`;
|
|
|
|
|
2023-09-28 10:15:33 +08:00
|
|
|
export const CURRENT_PAGE_ANNOTATIONS_QUERY = gql`query CurrentPageAnnotationsQuery {
|
|
|
|
pres_annotation_curr(order_by: { lastUpdatedAt: desc }) {
|
2023-09-28 04:42:47 +08:00
|
|
|
annotationId
|
|
|
|
annotationInfo
|
|
|
|
lastHistorySequence
|
|
|
|
lastUpdatedAt
|
|
|
|
pageId
|
|
|
|
presentationId
|
|
|
|
userId
|
|
|
|
}
|
|
|
|
}`;
|
|
|
|
|
2023-09-28 10:15:33 +08:00
|
|
|
export const CURRENT_PAGE_ANNOTATIONS_STREAM = gql`subscription annotationsStream($lastUpdatedAt: timestamptz){
|
2024-04-16 23:50:59 +08:00
|
|
|
pres_annotation_curr_stream(batch_size: 1000, cursor: {initial_value: {lastUpdatedAt: $lastUpdatedAt}}) {
|
2023-09-28 10:15:33 +08:00
|
|
|
annotationId
|
|
|
|
annotationInfo
|
|
|
|
lastUpdatedAt
|
|
|
|
pageId
|
|
|
|
presentationId
|
|
|
|
userId
|
|
|
|
}
|
2023-10-03 03:16:46 +08:00
|
|
|
}`;
|
|
|
|
|
2024-01-11 00:47:00 +08:00
|
|
|
export const CURRENT_PAGE_WRITERS_SUBSCRIPTION = gql`
|
|
|
|
subscription currentPageWritersSubscription($pageId: String!) {
|
|
|
|
pres_page_writers(where: { pageId: { _eq: $pageId } }) {
|
|
|
|
userId
|
|
|
|
}
|
2023-10-03 03:16:46 +08:00
|
|
|
}
|
2024-01-11 00:47:00 +08:00
|
|
|
`;
|
2023-09-28 04:42:47 +08:00
|
|
|
|
2023-12-16 01:39:12 +08:00
|
|
|
export const CURRENT_PAGE_WRITERS_QUERY = gql`query currentPageWritersQuery {
|
|
|
|
pres_page_writers {
|
|
|
|
userId
|
|
|
|
pageId
|
|
|
|
}
|
|
|
|
}`;
|
|
|
|
|
2024-06-19 21:53:39 +08:00
|
|
|
export const cursorUserSubscription = gql`
|
|
|
|
subscription CursorSubscription {
|
|
|
|
pres_page_cursor(where: {isCurrentPage: {_eq: true}}) {
|
|
|
|
userId
|
|
|
|
isCurrentPage
|
|
|
|
pageId
|
|
|
|
presentationId
|
|
|
|
user {
|
|
|
|
name
|
|
|
|
presenter
|
|
|
|
role
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
2024-03-16 02:17:27 +08:00
|
|
|
|
2024-06-19 21:53:39 +08:00
|
|
|
export const getCursorsCoordinatesStream = gql`
|
2024-03-16 02:17:27 +08:00
|
|
|
subscription getCursorCoordinatesStream {
|
2024-06-19 21:53:39 +08:00
|
|
|
pres_page_cursor_stream(cursor: {initial_value: {lastUpdatedAt: "2020-01-01"}},
|
|
|
|
where: {isCurrentPage: {_eq: true}},
|
|
|
|
batch_size: 100) {
|
2024-03-16 02:17:27 +08:00
|
|
|
xPercent
|
|
|
|
yPercent
|
|
|
|
lastUpdatedAt
|
|
|
|
userId
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2023-09-28 10:15:33 +08:00
|
|
|
export default CURRENT_PAGE_ANNOTATIONS_QUERY;
|