Skip to content

Commit

Permalink
Merge pull request #389 from TogetherCrew/385-discourse-metric-apis
Browse files Browse the repository at this point in the history
385 discourse metric apis
  • Loading branch information
Behzad-rabiei authored Sep 12, 2024
2 parents dcb5ce5 + e32649e commit 7b73575
Show file tree
Hide file tree
Showing 10 changed files with 288 additions and 136 deletions.
5 changes: 4 additions & 1 deletion src/controllers/platform.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
tokenService,
githubService,
notionService,
discourseService,
} from '../services';
import { IAuthRequest } from '../interfaces/Request.interface';
import { catchAsync, pick, ApiError } from '../utils';
Expand All @@ -17,7 +18,7 @@ import config from '../config';
import httpStatus from 'http-status';
import querystring from 'querystring';
import parentLogger from '../config/logger';
import { IPlatform, PlatformNames } from '@togethercrew.dev/db';
import { PlatformNames } from '@togethercrew.dev/db';
import { DatabaseManager } from '@togethercrew.dev/db';

const logger = parentLogger.child({ module: 'PlatformController' });
Expand Down Expand Up @@ -362,6 +363,8 @@ const getProperties = catchAsync(async function (req: IAuthAndPlatform, res: Res
let result;
if (platform?.name === PlatformNames.Discord) {
result = await discordServices.coreService.getPropertyHandler(req);
} else if (platform?.name === PlatformNames.Discourse) {
result = await discourseService.coreService.getPropertyHandler(req);
}
res.status(httpStatus.OK).send(result);
});
Expand Down
15 changes: 15 additions & 0 deletions src/docs/discourse.doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,25 @@ paths:
format: date-time
timeZone:
type: string
allCategories:
type: boolean
default: true
include:
type: array
items:
type: string
description: category id
exclude:
type: array
items:
type: string
description: category id
example:
startDate: '2023-01-17T13:02:10.911+00:00'
endDate: '2023-01-29T10:50:01.513Z'
timeZone: 'America/Fortaleza'
allCategories: false
include: [123456, 654321]
responses:
'200':
description: OK
Expand Down
Loading

0 comments on commit 7b73575

Please sign in to comment.