Skip to content

Commit bf964c4

Browse files
jp3peparkgang
authored andcommitted
import된 course만 가져오는 API endpoint 추가 (#110)
* add: Import된 코스만 가져오는 API Endpoint 추가 * up: API 호출 양식 문서 업데이트
1 parent 14c53f2 commit bf964c4

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

src/todo/lib/api.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,16 @@ export class TodoApiClient {
124124
return serviceResult;
125125
}
126126

127-
async getCoursesByConditions(userId?: number): Promise<AxiosResponse<any>> {
127+
async getCoursesByConditions(userId?: number, courseId?: number, belfOnly?: boolean): Promise<AxiosResponse<any>> {
128128
let serviceResult: any;
129129

130130
try {
131131
serviceResult = await this.httpService
132132
.get("/courses", {
133133
params: {
134134
userId: userId?.toString(),
135+
courseId: courseId?.toString(),
136+
belfOnly: belfOnly?.toString(),
135137
},
136138
})
137139
.toPromise();

src/todo/todo.controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,11 @@ export class TodoController {
156156
}
157157

158158
@Get("courses")
159-
async getCoursesByConditions(@Query("userId") userId?: number) {
159+
async getCoursesByConditions(@Query("userId") userId?: number, @Query("courseId") courseId?: number, @Query("belfOnly") belfOnly?: boolean) {
160160
let serviceResult: CourseGetInterface[];
161161

162162
try {
163-
const result: AxiosResponse<any> = await this.appService.getCoursesByConditions(userId);
163+
const result: AxiosResponse<any> = await this.appService.getCoursesByConditions(userId, courseId, belfOnly);
164164

165165
serviceResult = result.data;
166166
} catch (error) {

src/todo/todo.http

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ GET {{Host}}/{{Router}}/courses
3636
GET {{Host}}/{{Router}}/courses/1
3737

3838
### course 조건으로 조회
39-
GET {{Host}}/{{Router}}/courses?userId=
39+
GET {{Host}}/{{Router}}/courses?userId=&belfOnly=&courseId=
4040

4141
### course 생성
4242
POST {{Host}}/{{Router}}/courses

src/todo/todo.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,11 @@ export class TodoService {
144144
return apiClientResult;
145145
}
146146

147-
async getCoursesByConditions(userId?: number) {
147+
async getCoursesByConditions(userId?: number, courseId?: number, belfOnly?: boolean) {
148148
let apiClientResult: any;
149149

150150
try {
151-
apiClientResult = await this.todoApiClient.getCoursesByConditions(userId);
151+
apiClientResult = await this.todoApiClient.getCoursesByConditions(userId, courseId, belfOnly);
152152
} catch (error) {
153153
throw error;
154154
}

0 commit comments

Comments
 (0)