Add graphql actions for Users
This commit is contained in:
parent
c3351087e6
commit
fcfa215431
@ -0,0 +1,22 @@
|
||||
import { RedisMessage } from '../types';
|
||||
|
||||
export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage {
|
||||
const eventName = `UserBroadcastCamStartMsg`;
|
||||
|
||||
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 = {
|
||||
stream: input.stream
|
||||
};
|
||||
|
||||
return { eventName, routing, header, body };
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
import { RedisMessage } from '../types';
|
||||
|
||||
export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage {
|
||||
const eventName = `UserBroadcastCamStopMsg`;
|
||||
|
||||
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 = {
|
||||
stream: input.stream
|
||||
};
|
||||
|
||||
return { eventName, routing, header, body };
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
import { RedisMessage } from '../types';
|
||||
import {isModerator} from "../imports/validation";
|
||||
|
||||
export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage {
|
||||
const eventName = `MuteUserCmdMsg`;
|
||||
|
||||
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 userId = isModerator(sessionVariables) && input.hasOwnProperty('userId') ? input.userId : routing.userId;
|
||||
|
||||
const body = {
|
||||
mutedBy: routing.userId,
|
||||
userId: userId,
|
||||
mute: input.muted
|
||||
};
|
||||
|
||||
return { eventName, routing, header, body };
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
import { RedisMessage } from '../types';
|
||||
import {throwErrorIfNotModerator} from "../imports/validation";
|
||||
|
||||
export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage {
|
||||
throwErrorIfNotModerator(sessionVariables);
|
||||
const eventName = `LookUpUserReqMsg`;
|
||||
|
||||
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 = {
|
||||
externalUserId: input.externalUserId
|
||||
};
|
||||
|
||||
//TODO validate Meteor.settings.public.app.allowUserLookup
|
||||
|
||||
return { eventName, routing, header, body };
|
||||
}
|
@ -28,7 +28,12 @@ app.post('/', async (req: Request, res: Response) => {
|
||||
}
|
||||
|
||||
// Build message using received information.
|
||||
const { eventName, routing, header, body } = await redisMessageFactory.buildMessage(sessionVariables, actionName, input);
|
||||
const {
|
||||
eventName,
|
||||
routing,
|
||||
header,
|
||||
body
|
||||
} = await redisMessageFactory.buildMessage(sessionVariables, actionName, input);
|
||||
|
||||
// Construct payload to be sent to Redis.
|
||||
const redisPayload = {
|
||||
@ -49,7 +54,11 @@ app.post('/', async (req: Request, res: Response) => {
|
||||
}
|
||||
|
||||
// Publish the constructed payload to Redis.
|
||||
await redisClient.publish('to-akka-apps-redis-channel', JSON.stringify(redisPayload));
|
||||
if(actionName == 'userThirdPartyInfoResquest') {
|
||||
await redisClient.publish('to-third-party-redis-channel', JSON.stringify(redisPayload));
|
||||
} else {
|
||||
await redisClient.publish('to-akka-apps-redis-channel', JSON.stringify(redisPayload));
|
||||
}
|
||||
|
||||
// Send a success response.
|
||||
res.status(200).json(true);
|
||||
|
@ -456,3 +456,27 @@ input GuestUserApprovalStatus {
|
||||
status: String!
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
userSetMuted(
|
||||
userId: String
|
||||
muted: Boolean!
|
||||
): Boolean
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
cameraBroadcastStart(
|
||||
stream: String!
|
||||
): Boolean
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
cameraBroadcastStop(
|
||||
stream: String!
|
||||
): Boolean
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
userThirdPartyInfoResquest(
|
||||
externalUserId: String!
|
||||
): Boolean
|
||||
}
|
||||
|
@ -408,6 +408,30 @@ actions:
|
||||
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
|
||||
permissions:
|
||||
- role: bbb_client
|
||||
- name: userSetMuted
|
||||
definition:
|
||||
kind: synchronous
|
||||
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
|
||||
permissions:
|
||||
- role: bbb_client
|
||||
- name: cameraBroadcastStart
|
||||
definition:
|
||||
kind: synchronous
|
||||
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
|
||||
permissions:
|
||||
- role: bbb_client
|
||||
- name: cameraBroadcastStop
|
||||
definition:
|
||||
kind: synchronous
|
||||
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
|
||||
permissions:
|
||||
- role: bbb_client
|
||||
- name: userThirdPartyInfoResquest
|
||||
definition:
|
||||
kind: synchronous
|
||||
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
|
||||
permissions:
|
||||
- role: bbb_client
|
||||
custom_types:
|
||||
enums: []
|
||||
input_objects:
|
||||
|
Loading…
Reference in New Issue
Block a user