Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/controllers/platform.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const logger = parentLogger.child({ module: 'PlatformController' });
const createPlatform = catchAsync(async function (req: IAuthRequest, res: Response) {
const community = req.community;
const platform = await platformService.managePlatformConnection(community?.id, req.body);
await platformService.callExtractionApp(platform);
platformService.callExtractionApp(platform);
res.status(httpStatus.CREATED).send(platform);
});

Expand Down
4 changes: 2 additions & 2 deletions src/services/discourse/core.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ async function runDiscourseExtraction(platformId: string): Promise<void> {
const data = {
platform_id: platformId,
};
console.log(data);
logger.debug(data);
const response = await fetch(config.discourse.extractionURL, {
method: 'POST',
body: JSON.stringify(data),
headers: { 'Content-Type': 'application/json' },
});
if (response.ok) {
console.log(await response.json());
logger.debug(await response.json());
return;
} else {
const errorResponse = await response.text();
Expand Down
7 changes: 2 additions & 5 deletions src/services/platform.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ const createPlatform = async (PlatformBody: IPlatform): Promise<HydratedDocument
if (PlatformBody.name === PlatformNames.Discord) {
await sagaService.createAndStartFetchMemberSaga(platform._id);
}
// if (PlatformBody.name === PlatformNames.Discourse) {
// await discourseService.coreService.createDiscourseForum(platform.metadata?.id);
// }
return platform;
};

Expand Down Expand Up @@ -68,10 +65,10 @@ const getPlatformById = async (id: Types.ObjectId): Promise<HydratedDocument<IPl
* @param {HydratedDocument<IPlatform>} platform
* @returns {Promise<Void>}
*/
const callExtractionApp = async (platform: HydratedDocument<IPlatform>): Promise<void> => {
const callExtractionApp = (platform: HydratedDocument<IPlatform>): void => {
switch (platform.name) {
case PlatformNames.Discourse: {
await discourseService.coreService.runDiscourseExtraction(platform.id as string);
discourseService.coreService.runDiscourseExtraction(platform.id as string);
return;
}
default: {
Expand Down