Skip to content
Merged
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
18 changes: 8 additions & 10 deletions src/controllers/platform.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,14 @@ import { DatabaseManager, PlatformNames } from '@togethercrew.dev/db';

import config from '../config';
import parentLogger from '../config/logger';
import { discord, generateCodeChallenge, generateCodeVerifier, generateState, google, twitter } from '../config/oAtuh2';
import {
discord, generateCodeChallenge, generateCodeVerifier, generateState, google, twitter
} from '../config/oAtuh2';
import { IAuthAndPlatform, ISessionRequest } from '../interfaces';
import { IAuthRequest } from '../interfaces/Request.interface';
import {
discordServices,
discourseService,
githubService,
googleService,
notionService,
platformService,
tokenService,
twitterService,
userService,
discordServices, discourseService, githubService, googleService, notionService, platformService,
tokenService, twitterService, userService
} from '../services';
import { catchAsync, pick } from '../utils';

Expand Down Expand Up @@ -323,7 +318,10 @@ const getPlatform = catchAsync(async function (req: IAuthRequest, res: Response)
res.send(platform);
});
const updatePlatform = catchAsync(async function (req: IAuthAndPlatform, res: Response) {
console.log('Debug1');
platformService.validatePlatformUpdate(req.platform, req.body);
console.log('Debug2');

Comment on lines +321 to +324
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Replace console.log with proper logging

These debug console log statements appear to be temporary for troubleshooting. Consider:

  1. Using the existing logger system instead of console.log:

    - console.log('Debug1');
    + logger.debug('Before validatePlatformUpdate');
    ...
    - console.log('Debug2');
    + logger.debug('After validatePlatformUpdate');
  2. If these are temporary debugging statements, they should be removed before merging to production or marked with a TODO comment.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
console.log('Debug1');
platformService.validatePlatformUpdate(req.platform, req.body);
console.log('Debug2');
logger.debug('Before validatePlatformUpdate');
platformService.validatePlatformUpdate(req.platform, req.body);
logger.debug('After validatePlatformUpdate');

const platform = await platformService.updatePlatform(req.platform, req.user, req.body);
res.send(platform);
});
Expand Down