Merge pull request #19282 from gustavotrott/graphql-actions-presentation

graphql-actions: Presentation actions
This commit is contained in:
Gustavo Trott 2023-12-05 08:22:12 -03:00 committed by GitHub
commit f35deac405
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 327 additions and 3 deletions

View File

@ -38,7 +38,16 @@ trait DeleteWhiteboardAnnotationsPubMsgHdlr extends RightsManagementTrait {
PermissionCheck.ejectUserForFailedPermission(meetingId, msg.header.userId, reason, bus.outGW, liveMeeting)
}
} else {
val deletedAnnotations = deleteWhiteboardAnnotations(msg.body.whiteboardId, msg.header.userId, msg.body.annotationsIds, liveMeeting, isUserAmongPresenters, isUserModerator)
val annotationsIds = {
if (msg.body.annotationsIds.size > 0) {
msg.body.annotationsIds
} else {
getWhiteboardAnnotations(msg.body.whiteboardId, liveMeeting).map(a => a.id)
}
}
val deletedAnnotations = deleteWhiteboardAnnotations(msg.body.whiteboardId, msg.header.userId, annotationsIds, liveMeeting, isUserAmongPresenters, isUserModerator)
if (!deletedAnnotations.isEmpty) {
broadcastEvent(msg, deletedAnnotations)
}

View File

@ -0,0 +1,26 @@
import { RedisMessage } from '../types';
import { ValidationError } from '../types/ValidationError';
import {throwErrorIfNotPresenter} from "../imports/validation";
export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage {
throwErrorIfNotPresenter(sessionVariables);
const eventName = `DeleteWhiteboardAnnotationsPubMsg`;
const routing = {
meetingId: sessionVariables['x-hasura-meetingid'] as String,
userId: sessionVariables['x-hasura-userid'] as String
};
const header = {
name: eventName,
meetingId: routing.meetingId,
userId: routing.userId
};
const body = {
whiteboardId: input.pageId,
annotationsIds: input.annotationsIds,
};
return { eventName, routing, header, body };
}

View File

@ -0,0 +1,26 @@
import { RedisMessage } from '../types';
import { ValidationError } from '../types/ValidationError';
import {throwErrorIfNotPresenter} from "../imports/validation";
export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage {
throwErrorIfNotPresenter(sessionVariables);
const eventName = `DeleteWhiteboardAnnotationsPubMsg`;
const routing = {
meetingId: sessionVariables['x-hasura-meetingid'] as String,
userId: sessionVariables['x-hasura-userid'] as String
};
const header = {
name: eventName,
meetingId: routing.meetingId,
userId: routing.userId
};
const body = {
whiteboardId: input.pageId,
annotationsIds: []
};
return { eventName, routing, header, body };
}

View File

@ -0,0 +1,27 @@
import { RedisMessage } from '../types';
import { ValidationError } from '../types/ValidationError';
import {throwErrorIfNotPresenter} from "../imports/validation";
export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage {
throwErrorIfNotPresenter(sessionVariables);
const eventName = `SendWhiteboardAnnotationsPubMsg`;
const routing = {
meetingId: sessionVariables['x-hasura-meetingid'] as String,
userId: sessionVariables['x-hasura-userid'] as String
};
const header = {
name: eventName,
meetingId: routing.meetingId,
userId: routing.userId
};
const body = {
whiteboardId: input.pageId,
annotations: input.annotations,
html5InstanceId: '', //TODO remove this prop from bbb-common-msg
};
return { eventName, routing, header, body };
}

View File

@ -0,0 +1,26 @@
import { RedisMessage } from '../types';
import { ValidationError } from '../types/ValidationError';
import {throwErrorIfNotPresenter} from "../imports/validation";
export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage {
throwErrorIfNotPresenter(sessionVariables);
const eventName = `RemovePresentationPubMsg`;
const routing = {
meetingId: sessionVariables['x-hasura-meetingid'] as String,
userId: sessionVariables['x-hasura-userid'] as String
};
const header = {
name: eventName,
meetingId: routing.meetingId,
userId: routing.userId
};
const body = {
podId: 'DEFAULT_PRESENTATION_POD',
presentationId: input.presentationId
};
return { eventName, routing, header, body };
}

View File

@ -0,0 +1,26 @@
import { RedisMessage } from '../types';
import { ValidationError } from '../types/ValidationError';
import {throwErrorIfNotPresenter} from "../imports/validation";
export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage {
throwErrorIfNotPresenter(sessionVariables);
const eventName = `SetCurrentPresentationPubMsg`;
const routing = {
meetingId: sessionVariables['x-hasura-meetingid'] as String,
userId: sessionVariables['x-hasura-userid'] as String
};
const header = {
name: eventName,
meetingId: routing.meetingId,
userId: routing.userId
};
const body = {
podId: 'DEFAULT_PRESENTATION_POD',
presentationId: input.presentationId
};
return { eventName, routing, header, body };
}

View File

@ -0,0 +1,28 @@
import { RedisMessage } from '../types';
import { ValidationError } from '../types/ValidationError';
import {throwErrorIfNotPresenter} from "../imports/validation";
export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage {
throwErrorIfNotPresenter(sessionVariables);
const eventName = `SetPresentationDownloadablePubMsg`;
const routing = {
meetingId: sessionVariables['x-hasura-meetingid'] as String,
userId: sessionVariables['x-hasura-userid'] as String
};
const header = {
name: eventName,
meetingId: routing.meetingId,
userId: routing.userId
};
const body = {
podId: 'DEFAULT_PRESENTATION_POD',
presentationId: input.presentationId,
downloadable: input.downloadable,
fileStateType: input.fileStateType,
};
return { eventName, routing, header, body };
}

View File

@ -0,0 +1,27 @@
import { RedisMessage } from '../types';
import { ValidationError } from '../types/ValidationError';
import {throwErrorIfNotPresenter} from "../imports/validation";
export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage {
throwErrorIfNotPresenter(sessionVariables);
const eventName = `SetCurrentPagePubMsg`;
const routing = {
meetingId: sessionVariables['x-hasura-meetingid'] as String,
userId: sessionVariables['x-hasura-userid'] as String
};
const header = {
name: eventName,
meetingId: routing.meetingId,
userId: routing.userId
};
const body = {
podId: 'DEFAULT_PRESENTATION_POD',
presentationId: input.presentationId,
pageId: input.pageId,
};
return { eventName, routing, header, body };
}

View File

@ -0,0 +1,28 @@
import { RedisMessage } from '../types';
import { ValidationError } from '../types/ValidationError';
import {throwErrorIfNotPresenter} from "../imports/validation";
export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage {
throwErrorIfNotPresenter(sessionVariables);
const eventName = `SetPresentationRenderedInToastPubMsg`;
const routing = {
meetingId: sessionVariables['x-hasura-meetingid'] as String,
userId: sessionVariables['x-hasura-userid'] as String
};
const header = {
name: eventName,
meetingId: routing.meetingId,
userId: routing.userId
};
const body = {
podId: 'DEFAULT_PRESENTATION_POD',
presentationId: input.presentationId,
};
//TODO Akka-apps doesn't handle it (graphql doesnt have `pres.renderedInToast` prop)
return { eventName, routing, header, body };
}

View File

@ -85,13 +85,66 @@ type Mutation {
}
type Mutation {
requestPresentationUploadToken(
presAnnotationDelete(
pageId: String!
annotationsIds: [String]!
): Boolean
}
type Mutation {
presAnnotationDeleteAll(
pageId: String!
): Boolean
}
type Mutation {
presAnnotationSubmit(
pageId: String!
annotations: [String]!
): Boolean
}
type Mutation {
presentationRemove(
presentationId: String!
): Boolean
}
type Mutation {
presentationRequestUploadToken(
podId: String!
filename: String!
uploadTemporaryId: String!
): Boolean
}
type Mutation {
presentationSetCurrent(
presentationId: String!
): Boolean
}
type Mutation {
presentationSetDownloadable(
presentationId: String!
downloadable: Boolean!
fileStateType: String!
): Boolean
}
type Mutation {
presentationSetPage(
presentationId: String!
pageId: String!
): Boolean
}
type Mutation {
presentationSetRenderedInToast(
presentationId: String!
): Boolean
}
type Mutation {
timerActivate(
stopwatch: Boolean!

View File

@ -83,7 +83,55 @@ actions:
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
permissions:
- role: bbb_client
- name: requestPresentationUploadToken
- name: presAnnotationDelete
definition:
kind: synchronous
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
permissions:
- role: bbb_client
- name: presAnnotationDeleteAll
definition:
kind: synchronous
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
permissions:
- role: bbb_client
- name: presAnnotationSubmit
definition:
kind: synchronous
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
permissions:
- role: bbb_client
- name: presentationRemove
definition:
kind: synchronous
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
permissions:
- role: bbb_client
- name: presentationRequestUploadToken
definition:
kind: synchronous
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
permissions:
- role: bbb_client
- name: presentationSetCurrent
definition:
kind: synchronous
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
permissions:
- role: bbb_client
- name: presentationSetDownloadable
definition:
kind: synchronous
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
permissions:
- role: bbb_client
- name: presentationSetPage
definition:
kind: synchronous
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
permissions:
- role: bbb_client
- name: presentationSetRenderedInToast
definition:
kind: synchronous
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'