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

Refactor/search course #121

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
Open

Refactor/search course #121

wants to merge 12 commits into from

Conversation

Devheun
Copy link
Contributor

@Devheun Devheun commented Jan 27, 2025

๐Ÿ“ Description

๊ฐ•์˜ ๊ฒ€์ƒ‰ ์—”๋“œํฌ์ธํŠธ๋ฅผ ํ•˜๋‚˜๋กœ ํ†ตํ•ฉํ–ˆ์Šต๋‹ˆ๋‹ค.

๐Ÿงช Test

๊ธฐ์กด ๊ฐ•์˜ ๊ฒ€์ƒ‰๊ณผ ๋™์ผํ•˜๊ฒŒ ๊ฒฐ๊ณผ๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š”์ง€ ํ™•์ธํ•ด์ฃผ์‹œ๋ฉด ๊ฐ์‚ฌํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

๐ŸŽธ ETC

R.I.P ์‹œํ” and ์—ฐ์Šน's past code...

Copy link
Contributor

@KimSeongHyeonn KimSeongHyeonn left a comment

Choose a reason for hiding this comment

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

๋ฉ‹์ง„ ์ฝ”๋“œ ์ž˜๋ดค์Šต๋‹ˆ๋‹ค ๋ฐฐ์—ด๋กœ ์ฃผ์ž…ํ•˜๋Š”๊ฑฐ ๊ตฟ์ด๋„ค์š”

required: true,
type: 'string',
type: 'enum',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
type: 'enum',
type: 'enum',
enum: CourseCategory,

์š”๊ฑฐ ๋„ฃ์–ด์ฃผ๋ฉด swagger์—์„œ ์š”์ฒญ์ด ์ž˜ ๊ฐ€๋Š”๊ฑฐ ๊ฐ™์Šต๋‹ˆ๋‹ค

Comment on lines 13 to 21
@ApiProperty({ description: '์—ฐ๋„' })
@IsString()
@Length(4)
year: string;

@ApiProperty({ description: 'ํ•™๊ธฐ' })
@IsString()
@Length(1)
semester: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
@ApiProperty({ description: '์—ฐ๋„' })
@IsString()
@Length(4)
year: string;
@ApiProperty({ description: 'ํ•™๊ธฐ' })
@IsString()
@Length(1)
semester: string;
@ApiProperty({ description: '์—ฐ๋„' })
@IsString()
@Length(4, 4)
year: string;
@ApiProperty({ description: 'ํ•™๊ธฐ' })
@IsString()
@Length(1, 1)
semester: string;

์‚ฌ์†Œํ•˜์ง€๋งŒ ์š”๋Ÿฐ๊ฑฐ๋ผ๋„...

Comment on lines 22 to 24
async getCourseRepository(): Promise<CourseRepository> {
return this.courseRepository;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

์š” ํ•จ์ˆ˜๋Š” ๋ฌด์Šจ์—ญํ• ์ธ์ง€ ๋ฌผ์–ด๋ด๋„ ๋ ๊นŒ์š”..?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

์ง€์šด๋‹ค๋Š”๊ฑธ ๊นœ๋นกํ–ˆ๋„ค์š”...

@Injectable()
export class AllCoursesSearchStrategy implements CourseSearchStrategy {
supports(category: CourseCategory): boolean {
return !category;
Copy link
Contributor

Choose a reason for hiding this comment

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

์š” ๋ถ€๋ถ„์˜ ์˜๋„๋„ ๊ถ๊ธˆํ•ฉ๋‹ˆ๋‹ค..!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ํ”„๋ก ํŠธ์—์„œ category๋ฅผ ์ง€์ •ํ•˜์ง€ ์•Š์„ ๋•Œ category๋ฅผ ์•„๋ฌด๊ฒƒ๋„ ๋„˜๊ฒจ์ฃผ์ง€ ์•Š๋Š”๋ฐ, ์ด๋•Œ ํ•ด๋‹น ์ „๋žต์„ ์ฑ„ํƒํ•˜๋ ค๊ณ  ๋„ฃ์—ˆ์Šต๋‹ˆ๋‹ค!

}),
ApiQuery({
name: 'courseName',
name: 'category',
required: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

์•— ๊ทธ๋Ÿผ ์š”๊ฑฐ false๊ฐ€ ๋˜๋Š”๊ฒŒ ๋งž์„๊ฑฐ ๊ฐ™์•„์šฉ

- category๋Š” ์•ˆ ๋„˜๊ฒจ์ค„๋•Œ๋„ ์žˆ์–ด์„œ false๋กœ ์ˆ˜์ •
import { CourseEntity } from 'src/entities/course.entity';

export interface CourseSearchStrategy {
supports(category: CourseCategory): boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

์‚ฌ์†Œํ•œ๊ฑฐ์ง€๋งŒ category ๋งค๊ฐœ๋ณ€์ˆ˜์— ?๋ฅผ ๋ถ™์ด๊ฑฐ๋‚˜ ํƒ€์ž…์— | undefined ๋ฅผ ์ถ”๊ฐ€ํ•ด์ฃผ๋ฉด ์ข€ ๋” ์ฝ”๋“œ๋ฅผ ์ฝ๊ธฐ ์ข‹์„๊ฑฐ ๊ฐ™์•„์š”
์ง€๊ธˆ๋„ ์˜๋„๋Œ€๋กœ ๋™์ž‘์€ ์ž˜ ํ•˜๋Š”๊ฑฐ ๊ฐ™์Šต๋‹ˆ๋‹ค..!


buildQuery(
queryBuilder: SelectQueryBuilder<CourseEntity>,
searchCourseNewDto?: SearchCourseNewDto,
Copy link
Contributor

Choose a reason for hiding this comment

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

์˜คํžˆ๋ ค ์š”๊ธฐ ๋งค๊ฐœ๋ณ€์ˆ˜๋Š” ํ•ญ์ƒ ๋“ค์–ด๊ฐ€๋Š”๊ฑฐ ๊ฐ™์•„์„œ ๋งž๋‹ค๋ฉด ? ๋นผ์ค˜๋„ ์ข‹์„๊ฑฐ ๊ฐ™์•„์š”

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants