-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: create, readAll course * 리뷰 반영, formatting
- Loading branch information
Showing
8 changed files
with
163 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/kotlin/com/wafflestudio/csereal/core/academics/api/v2/AcademicsController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.wafflestudio.csereal.core.academics.api.v2 | ||
|
||
import com.wafflestudio.csereal.common.aop.AuthenticatedStaff | ||
import com.wafflestudio.csereal.core.academics.dto.GroupedCourseDto | ||
import com.wafflestudio.csereal.core.academics.service.AcademicsService | ||
import jakarta.validation.Valid | ||
import org.springframework.web.bind.annotation.* | ||
|
||
@RequestMapping("/api/v2/academics") | ||
@RestController | ||
class AcademicsController( | ||
private val academicsService: AcademicsService | ||
) { | ||
@AuthenticatedStaff | ||
@PostMapping("/{studentType}/course") | ||
fun createCourse( | ||
@PathVariable studentType: String, | ||
@Valid | ||
@RequestBody | ||
request: GroupedCourseDto | ||
) = academicsService.createCourse(studentType, request) | ||
|
||
@GetMapping("/{studentType}/courses") | ||
fun readAllGroupedCourses(@PathVariable studentType: String): List<GroupedCourseDto> = | ||
academicsService.readAllGroupedCourses(studentType) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/kotlin/com/wafflestudio/csereal/core/academics/dto/GroupedCourseDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.wafflestudio.csereal.core.academics.dto | ||
|
||
import com.wafflestudio.csereal.core.academics.database.CourseRepository | ||
|
||
data class GroupedCourseDto( | ||
val code: String, | ||
val credit: Int, | ||
val grade: Int, | ||
val ko: SingleCourseDto, | ||
val en: SingleCourseDto | ||
) | ||
|
||
data class SingleCourseDto( | ||
val name: String, | ||
val description: String, | ||
val classification: String | ||
) | ||
|
||
object CourseMapper { | ||
fun toGroupedCourseDTO(projection: CourseRepository.CourseProjection): GroupedCourseDto { | ||
return GroupedCourseDto( | ||
code = projection.code, | ||
credit = projection.credit, | ||
grade = projection.grade, | ||
ko = SingleCourseDto( | ||
name = projection.koName, | ||
description = projection.koDescription, | ||
classification = projection.koClassification | ||
), | ||
en = SingleCourseDto( | ||
name = projection.enName, | ||
description = projection.enDescription, | ||
classification = projection.enClassification | ||
) | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters