Conversation
| fs.writeFileSync(outputPath, `${lines.join("\n")}\n`, "utf8"); | ||
| } | ||
|
|
||
| function toNumberOrZero(value) { |
There was a problem hiding this comment.
[maintainability]
The toNumberOrZero function is introduced to handle conversion of values to numbers with a fallback to zero. Ensure that this function is used consistently throughout the codebase wherever similar conversions are needed to maintain uniformity and prevent potential errors from inconsistent handling.
| toNumberOrZero(row["user_payment.net_amount"]); | ||
| } | ||
|
|
||
| const aggregatedRows = Array.from(aggregatedByUser.values()) |
There was a problem hiding this comment.
[💡 performance]
The use of Array.from(aggregatedByUser.values()) followed by map and sort is correct but could be optimized. Consider chaining these operations directly on the Map to avoid creating an intermediate array, which could improve performance slightly, especially with large datasets.
| } from "./dtos/submission-links.dto"; | ||
|
|
||
| @ApiTags("Challenges Reports") | ||
| @ApiProduces("application/json", "text/csv") |
There was a problem hiding this comment.
[correctness]
The @ApiProduces decorator specifies both application/json and text/csv. Ensure that the CsvResponseInterceptor correctly handles the content negotiation between these types, as it might affect the response format expected by clients.
|
|
||
| @ApiTags("Challenges Reports") | ||
| @ApiProduces("application/json", "text/csv") | ||
| @UseInterceptors(CsvResponseInterceptor) |
There was a problem hiding this comment.
[design]
The CsvResponseInterceptor is applied globally to the controller. Verify that all endpoints within this controller are intended to support CSV responses, as this might introduce unexpected behavior for endpoints not designed to return CSV.
No description provided.