-
Notifications
You must be signed in to change notification settings - Fork 6
fix(Filters): In search API #16
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
Conversation
@@ -31,6 +31,7 @@ import { | |||
import { ChallengeTrack } from 'src/shared/enums/challengeTrack.enum'; | |||
import { ScoreCardService } from './scorecard.service'; | |||
import { PaginationHeaderInterceptor } from 'src/interceptors/PaginationHeaderInterceptor'; | |||
import { $Enums } from '@prisma/client'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider renaming $Enums
to a more descriptive name that reflects its purpose or the specific enums being imported. This will improve code readability and maintainability.
@@ -181,6 +194,9 @@ export class ScorecardController { | |||
async searchScorecards( | |||
@Query('challengeTrack') challengeTrack?: ChallengeTrack | ChallengeTrack[], | |||
@Query('challengeType') challengeType?: string | string[], | |||
@Query('status') status?: $Enums.ScorecardStatus | $Enums.ScorecardStatus[], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider checking if $Enums.ScorecardStatus
is correctly imported and defined, as it is being used here for the status
query parameter.
@@ -181,6 +194,9 @@ export class ScorecardController { | |||
async searchScorecards( | |||
@Query('challengeTrack') challengeTrack?: ChallengeTrack | ChallengeTrack[], | |||
@Query('challengeType') challengeType?: string | string[], | |||
@Query('status') status?: $Enums.ScorecardStatus | $Enums.ScorecardStatus[], | |||
@Query('scorecardType') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that $Enums.ScorecardType
is properly imported and defined, as it is being used for the scorecardType
query parameter.
const result = await this.scorecardService.getScoreCards({ | ||
challengeTrack: challengeTrackArray, | ||
challengeType: challengeTypeArray, | ||
name, | ||
page, | ||
perPage, | ||
scorecardTypesArray, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The property name scorecardTypesArray
should be passed as scorecardType
to match the expected parameter name in the getScoreCards
method, unless the method signature has been updated to expect scorecardTypesArray
.
const result = await this.scorecardService.getScoreCards({ | ||
challengeTrack: challengeTrackArray, | ||
challengeType: challengeTypeArray, | ||
name, | ||
page, | ||
perPage, | ||
scorecardTypesArray, | ||
statusArray, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The property name statusArray
should be passed as status
to match the expected parameter name in the getScoreCards
method, unless the method signature has been updated to expect statusArray
.
...(name && { name: { contains: name, mode: 'insensitive' } }), | ||
}; | ||
console.log(where, 'asdkjalsd'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the console.log
statement used for debugging. Leaving debugging statements in production code can lead to unnecessary console output and potential performance issues.
@@ -1,4 +1,5 @@ | |||
import { ApiProperty } from '@nestjs/swagger'; | |||
import { $Enums } from '@prisma/client'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider importing only the necessary enums from @prisma/client
to avoid importing unused code. This can help reduce the bundle size and improve performance.
status: { | ||
in: statusArray, | ||
}, | ||
}), | ||
...(name && { name: { contains: name, mode: 'insensitive' } }), | ||
}; | ||
const data = await this.prisma.scorecard.findMany({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the commented-out console.log
statement. Leaving commented-out code can clutter the codebase and is generally not recommended unless it serves a specific purpose, such as documentation or a temporary workaround.
What's in this PR?