Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
Merge pull request #320 from SuperViz/refactor/add-group-name-to-acti…
Browse files Browse the repository at this point in the history
…vity

refactor: add group name to send on activity
  • Loading branch information
brunokunace authored Sep 8, 2023
2 parents f7fba79 + 201e6df commit 6948a40
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/core/launcher/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { ParticipantEvent, RealtimeEvent } from '../../common/types/events.types
import { Group, Participant } from '../../common/types/participant.types';
import { Logger } from '../../common/utils';
import { BaseComponent } from '../../components/base';
import ApiService from '../../services/api';
import config from '../../services/config';
import { EventBus } from '../../services/event-bus';
import { PubSub } from '../../services/pubsub';
Expand All @@ -12,7 +13,6 @@ import { AblyParticipant, RealtimeMessage } from '../../services/realtime/ably/t
import { HostObserverCallbackResponse } from '../../services/realtime/base/types';

import { DefaultLauncher, LauncherFacade, LauncherOptions } from './types';
import ApiService from "../../services/api";

export class Launcher implements DefaultLauncher {
private readonly shouldKickParticipantsOnHostLeave: boolean;
Expand Down Expand Up @@ -62,7 +62,7 @@ export class Launcher implements DefaultLauncher {
config: config.configuration,
eventBus: this.eventBus,
});
ApiService.sendActivity(this.participant.id, this.group.id, component.name)
ApiService.sendActivity(this.participant.id, this.group.id, this.group.name, component.name);
};

/**
Expand Down
10 changes: 5 additions & 5 deletions src/services/api/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ describe('ApiService', () => {

describe('sendActivity', () => {
test('should return any message', async () => {

const userId = 'user-id'
const groupId = 'group-id'
const product = 'video-component'
const response = await ApiService.sendActivity(userId, groupId, product);
const userId = 'user-id';
const groupId = 'group-id';
const groupName = 'group-name';
const product = 'video-component';
const response = await ApiService.sendActivity(userId, groupId, groupName, product);

expect(response).toEqual({ message: 'any message' });
});
Expand Down
9 changes: 5 additions & 4 deletions src/services/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { doRequest } from '../../common/utils';
import config from "../config";
import config from '../config';

export default class ApiService {
static createUrl(baseUrl: string, path: string): string {
Expand All @@ -25,18 +25,19 @@ export default class ApiService {
return message;
}

static async sendActivity(userId: string, groupId: string, product: string) {
static async sendActivity(userId: string, groupId: string, groupName: string, product: string) {
const path = '/activity';
const baseUrl = config.get<string>('apiUrl');
const meetingId = config.get<string>('roomId');
const apikey = config.get<string>('apiKey');
const url = this.createUrl(baseUrl, path);
const body = {
groupId,
groupName,
meetingId,
product,
userId
}
userId,
};
return doRequest(url, 'POST', body, { apikey });
}
}

0 comments on commit 6948a40

Please sign in to comment.