Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix bugs #408

Merged
merged 3 commits into from
Nov 18, 2024
Merged
Changes from 1 commit
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
7 changes: 6 additions & 1 deletion src/controllers/nft.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const logger = parentLogger.child({ module: 'NftController' });

const getReputationScore = catchAsync(async function (req: Request, res: Response) {
const { tokenId, address } = req.params;
const supportedPlatforms = ['discord', 'discourse'];
const supportedPlatforms = ['discord'];

let repuationScore;
logger.debug(tokenId, address);
Expand All @@ -27,11 +27,15 @@ const getReputationScore = catchAsync(async function (req: Request, res: Respons
name: supportedPlatforms[i],
community: dynamicNftModule?.community,
});
console.log(supportedPlatforms[i], dynamicNftModule?.community);

Copy link

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 structured logging

Using console.log for debugging is not recommended in production code. The codebase already has a proper logging setup with logger.debug.

Replace the console.log statements with structured logging:

-    console.log(supportedPlatforms[i], dynamicNftModule?.community);
+    logger.debug({ platform: supportedPlatforms[i], community: dynamicNftModule?.community });

-    console.log(platform, platform?.name as SupportedNeo4jPlatforms, 'BBB');
+    logger.debug({ platform, platformName: platform?.name });

-    console.log(temp, 'HAHA');
+    logger.debug({ platformType: temp });

-    console.log(repuationScore, _fieldLookup, _fields);
+    logger.debug({ repuationScore, fieldLookup: _fieldLookup, fields: _fields });

Also applies to: 32-32, 38-38, 65-65

console.log(platform, platform?.name as SupportedNeo4jPlatforms, 'BBB');
logger.debug({ i, platform, supportedPlatforms: supportedPlatforms[i] });
for (let j = 0; j < profiles.length; j++) {
const profile = profiles[j];
logger.debug({ i, j, profile, supportedPlatforms: supportedPlatforms[i] });
const temp = platform?.name as SupportedNeo4jPlatforms;
console.log(temp, 'HAHA');
if (profile.profile.provider === supportedPlatforms[i]) {
const reputationScoreQuery = `
MATCH (:${NEO4J_PLATFORM_INFO[temp].member} {id: "${profile.profile.id}"})-[r:HAVE_METRICS {platformId: "${platform?.id}"}]->(a)
Expand All @@ -58,6 +62,7 @@ const getReputationScore = catchAsync(async function (req: Request, res: Respons

repuationScore = _fields[_fieldLookup['reputation_score']];
logger.debug(repuationScore);
console.log(repuationScore, _fieldLookup, _fields);
}
}
}
Expand Down