1
- import { Controller , Get , Param , Query , UseGuards } from '@nestjs/common' ;
1
+ import { Controller , Get , Query , UseGuards } from '@nestjs/common' ;
2
2
import { CourseService } from './course.service' ;
3
3
import { ApiTags } from '@nestjs/swagger' ;
4
- import { CommonCourseResponseDto } from './dto/common-course-response.dto' ;
5
4
import { JwtAuthGuard } from 'src/auth/guards/jwt-auth.guard' ;
6
- import { SearchCourseCodeDto } from './dto/search-course-code.dto' ;
7
- import { SearchCourseNameDto } from './dto/search-course-name.dto' ;
8
- import { SearchProfessorNameDto } from './dto/search-professor-name.dto' ;
9
5
import { PaginatedCoursesDto } from './dto/paginated-courses.dto' ;
10
6
import { CourseDocs } from 'src/decorators/docs/course.decorator' ;
11
- import { GetGeneralCourseDto } from './dto/get-general-course.dto' ;
12
- import { GetMajorCourseDto } from './dto/get-major-course.dto' ;
13
- import { GetAcademicFoundationCourseDto } from './dto/get-academic-foundation-course.dto' ;
14
- import { SearchCoursesWithKeywordDto } from './dto/search-courses-with-keyword.dto' ;
7
+ import { SearchCourseNewDto } from './dto/search-course-new.dto' ;
15
8
16
9
@ApiTags ( 'course' )
17
10
@CourseDocs
@@ -20,139 +13,10 @@ export class CourseController {
20
13
constructor ( private courseService : CourseService ) { }
21
14
22
15
@UseGuards ( JwtAuthGuard )
23
- @Get ( 'search-all' )
24
- async searchAllCourses (
25
- @Query ( ) searchCoursesWithKeywordDto : SearchCoursesWithKeywordDto ,
16
+ @Get ( )
17
+ async searchCourses (
18
+ @Query ( ) searchCourseNewDto : SearchCourseNewDto ,
26
19
) : Promise < PaginatedCoursesDto > {
27
- return await this . courseService . searchAllCourses (
28
- searchCoursesWithKeywordDto ,
29
- ) ;
30
- }
31
-
32
- @UseGuards ( JwtAuthGuard )
33
- @Get ( 'search-major' )
34
- async searchMajorCourses (
35
- @Query ( 'major' ) major : string ,
36
- @Query ( ) searchCoursesWithKeywordDto : SearchCoursesWithKeywordDto ,
37
- ) : Promise < PaginatedCoursesDto > {
38
- return await this . courseService . searchMajorCourses (
39
- major ,
40
- searchCoursesWithKeywordDto ,
41
- ) ;
42
- }
43
-
44
- @UseGuards ( JwtAuthGuard )
45
- @Get ( 'search-general' )
46
- async searchGeneralCourses (
47
- @Query ( ) searchCoursesWithKeywordDto : SearchCoursesWithKeywordDto ,
48
- ) : Promise < PaginatedCoursesDto > {
49
- return await this . courseService . searchGeneralCourses (
50
- searchCoursesWithKeywordDto ,
51
- ) ;
52
- }
53
-
54
- @UseGuards ( JwtAuthGuard )
55
- @Get ( 'search-academic-foundation' )
56
- async searchAcademicFoundationCourses (
57
- @Query ( 'college' ) college : string ,
58
- @Query ( ) searchCoursesWithKeywordDto : SearchCoursesWithKeywordDto ,
59
- ) : Promise < PaginatedCoursesDto > {
60
- return await this . courseService . searchAcademicFoundationCourses (
61
- college ,
62
- searchCoursesWithKeywordDto ,
63
- ) ;
64
- }
65
-
66
- // 학수번호 검색
67
- @UseGuards ( JwtAuthGuard )
68
- @Get ( 'search-course-code' )
69
- async searchCourseCode (
70
- @Query ( ) searchCourseCodeDto : SearchCourseCodeDto ,
71
- ) : Promise < PaginatedCoursesDto > {
72
- return await this . courseService . searchCourseCode ( searchCourseCodeDto ) ;
73
- }
74
-
75
- // 전공 -- 과목명 검색
76
- @UseGuards ( JwtAuthGuard )
77
- @Get ( 'search-major-course-name' )
78
- async searchMajorCourseName (
79
- @Query ( 'major' ) major : string ,
80
- @Query ( ) searchCourseNameDto : SearchCourseNameDto ,
81
- ) : Promise < PaginatedCoursesDto > {
82
- return await this . courseService . searchMajorCourseName (
83
- major ,
84
- searchCourseNameDto ,
85
- ) ;
86
- }
87
-
88
- // 교양 - 과목명 검색
89
- @UseGuards ( JwtAuthGuard )
90
- @Get ( 'search-general-course-name' )
91
- async searchGeneralCourseName (
92
- @Query ( ) searchCourseNameDto : SearchCourseNameDto ,
93
- ) : Promise < PaginatedCoursesDto > {
94
- return await this . courseService . searchGeneralCourseName (
95
- searchCourseNameDto ,
96
- ) ;
97
- }
98
-
99
- // 전공 - 교수님 성함 검색
100
- @UseGuards ( JwtAuthGuard )
101
- @Get ( 'search-major-professor-name' )
102
- async searchMajorProfessorName (
103
- @Query ( 'major' ) major : string ,
104
- @Query ( ) searchProfessorNameDto : SearchProfessorNameDto ,
105
- ) : Promise < PaginatedCoursesDto > {
106
- return await this . courseService . searchMajorProfessorName (
107
- major ,
108
- searchProfessorNameDto ,
109
- ) ;
110
- }
111
-
112
- // 교양 - 교수님 성함 검색
113
- @UseGuards ( JwtAuthGuard )
114
- @Get ( 'search-general-professor-name' )
115
- async searchGeneralProfessorName (
116
- @Query ( ) searchProfessorNameDto : SearchProfessorNameDto ,
117
- ) : Promise < PaginatedCoursesDto > {
118
- return await this . courseService . searchGeneralProfessorName (
119
- searchProfessorNameDto ,
120
- ) ;
121
- }
122
-
123
- // 교양 리스트
124
- @UseGuards ( JwtAuthGuard )
125
- @Get ( 'general' )
126
- async getGeneralCourses (
127
- @Query ( ) getGeneralCourseDto : GetGeneralCourseDto ,
128
- ) : Promise < PaginatedCoursesDto > {
129
- return await this . courseService . getGeneralCourses ( getGeneralCourseDto ) ;
130
- }
131
-
132
- // 전공 리스트 (학부별)
133
- @UseGuards ( JwtAuthGuard )
134
- @Get ( 'major' )
135
- async getMajorCourses (
136
- @Query ( ) getMajorCourseDto : GetMajorCourseDto ,
137
- ) : Promise < PaginatedCoursesDto > {
138
- return await this . courseService . getMajorCourses ( getMajorCourseDto ) ;
139
- }
140
-
141
- // 학문의 기초 리스트
142
- @UseGuards ( JwtAuthGuard )
143
- @Get ( 'academic-foundation' )
144
- async getAcademicFoundationCourses (
145
- @Query ( ) getAcademicFoundationCourseDto : GetAcademicFoundationCourseDto ,
146
- ) : Promise < PaginatedCoursesDto > {
147
- return await this . courseService . getAcademicFoundationCourses (
148
- getAcademicFoundationCourseDto ,
149
- ) ;
150
- }
151
-
152
- @Get ( '/:courseId' )
153
- async getCourse (
154
- @Param ( 'courseId' ) courseId : number ,
155
- ) : Promise < CommonCourseResponseDto > {
156
- return await this . courseService . getCourse ( courseId ) ;
20
+ return await this . courseService . searchCourses ( searchCourseNewDto ) ;
157
21
}
158
22
}
0 commit comments