-
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.
* Merge pull request #2 * Conflict 수정
- Loading branch information
Showing
24 changed files
with
514 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,4 @@ class CommonApplication | |
|
||
fun main(args: Array<String>) { | ||
runApplication<CommonApplication>(*args) | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,4 @@ class RequestLoggingFilterConfiguration { | |
it.setMaxPayloadLength(64000) | ||
} | ||
} | ||
} | ||
} |
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
5 changes: 5 additions & 0 deletions
5
common/src/main/kotlin/com/example/common/enums/CalendarType.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,5 @@ | ||
package com.example.common.enums | ||
|
||
enum class CalendarType { | ||
ASSIGNMENT, VIDEO | ||
} |
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
119 changes: 119 additions & 0 deletions
119
common/src/main/kotlin/com/example/domain/course/controller/CourseController.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,119 @@ | ||
package com.example.domain.course.controller | ||
|
||
import com.example.common.dto.Response | ||
import com.example.domain.course.dto.request.AssignmentRequest | ||
import com.example.domain.course.dto.request.CalendarRequest | ||
import com.example.domain.course.dto.request.CourseRequest | ||
import com.example.domain.course.dto.request.VideoRequest | ||
import com.example.domain.course.dto.response.AssignmentResponse | ||
import com.example.domain.course.dto.response.CalendarResponse | ||
import com.example.domain.course.dto.response.CourseResponse | ||
import com.example.domain.course.dto.response.VideoResponse | ||
import com.example.domain.course.service.CourseService | ||
import io.swagger.v3.oas.annotations.Operation | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse | ||
import io.swagger.v3.oas.annotations.tags.Tag | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.web.bind.annotation.PathVariable | ||
import org.springframework.web.bind.annotation.PostMapping | ||
import org.springframework.web.bind.annotation.RequestBody | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RestController | ||
@RequestMapping("/course") | ||
@Tag(name = "Course", description = "강의, 일정 API") | ||
class CourseController ( | ||
private val courseService: CourseService, | ||
) { | ||
@Operation( | ||
summary = "강의 리스트형식 출력", | ||
responses = [ | ||
ApiResponse( | ||
responseCode = "200", | ||
description = "OK" | ||
) | ||
], | ||
) | ||
@GetMapping() | ||
fun getCourseList() : Response<List<CourseResponse>> = | ||
Response(data = courseService.getCourseList()) | ||
|
||
|
||
@Operation( | ||
summary = "강의 단일 조회", | ||
responses = [ | ||
ApiResponse(responseCode = "200", description = "OK") | ||
] | ||
) | ||
@GetMapping("{courseId}") | ||
fun getCourse( | ||
@PathVariable courseId: Long | ||
) : Response<CourseResponse> = | ||
Response(data = courseService.getCourse(courseId = courseId)) | ||
|
||
|
||
@Operation( | ||
summary = "월 단위로 일정 가져오기", | ||
responses = [ | ||
ApiResponse(responseCode = "200", description = "OK") | ||
] | ||
) | ||
@GetMapping("/calendar/{date}") | ||
fun getCalendar( | ||
@PathVariable("date") date: String | ||
) : Response<Map<String, List<CalendarResponse>>> = | ||
Response(data = courseService.getCalendar(dateRequest = date)) | ||
|
||
|
||
@Operation( | ||
summary = "일정 추가하기", | ||
responses = [ | ||
ApiResponse(responseCode = "200", description = "OK") | ||
] | ||
) | ||
@PostMapping("/calendar") | ||
fun postCreateCalendar( | ||
@RequestBody calendarRequest: CalendarRequest | ||
) : Response<CalendarResponse> = | ||
Response(data = courseService.postCalendar(calendarRequest = calendarRequest)) | ||
|
||
|
||
@Operation( | ||
summary = "강의 추가하기", | ||
responses = [ | ||
ApiResponse(responseCode = "200", description = "OK") | ||
] | ||
) | ||
@PostMapping("/video") | ||
fun postCreateVideo( | ||
@RequestBody videoRequest: VideoRequest | ||
) : Response<VideoResponse> = | ||
Response(data = courseService.postVideo(videoRequest)) | ||
|
||
|
||
@Operation( | ||
summary = "과제 추가하기", | ||
responses = [ | ||
ApiResponse(responseCode = "200", description = "OK") | ||
] | ||
) | ||
@PostMapping("/assignment") | ||
fun postCreateAssignment( | ||
@RequestBody assignmentRequest: AssignmentRequest | ||
) : Response<AssignmentResponse> = | ||
Response(data = courseService.postAssignment(assignmentRequest = assignmentRequest)) | ||
|
||
|
||
@Operation( | ||
summary = "과목 추가하기", | ||
responses = [ | ||
ApiResponse(responseCode = "200", description = "OK") | ||
] | ||
) | ||
@PostMapping("/course") | ||
fun postCreateCourse( | ||
@RequestBody courseRequest: CourseRequest | ||
) : Response<CourseResponse> = | ||
Response(data = courseService.postCourse(courseRequest = courseRequest)) | ||
} |
12 changes: 12 additions & 0 deletions
12
common/src/main/kotlin/com/example/domain/course/dto/request/AssignmentRequest.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,12 @@ | ||
package com.example.domain.course.dto.request | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema | ||
|
||
|
||
@Schema(name = "과제 등록 API Request Body") | ||
class AssignmentRequest ( | ||
@Schema(description = "강의 id") | ||
val courseId: Long, | ||
@Schema(description = "과제 이름") | ||
val name: String, | ||
) |
16 changes: 16 additions & 0 deletions
16
common/src/main/kotlin/com/example/domain/course/dto/request/CalendarRequest.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,16 @@ | ||
package com.example.domain.course.dto.request | ||
|
||
import com.example.common.enums.CalendarType | ||
import io.swagger.v3.oas.annotations.media.Schema | ||
|
||
@Schema(name = "일정 추가 API Request Body") | ||
class CalendarRequest ( | ||
@Schema(description = "일정의 종류") | ||
val type: CalendarType, | ||
@Schema(description = "일정의 분류") | ||
val course: String, | ||
@Schema(description = "일정의 마감기한") | ||
val dueAt: String, | ||
@Schema(description = "일정의 제목") | ||
val name: String, | ||
) |
11 changes: 11 additions & 0 deletions
11
common/src/main/kotlin/com/example/domain/course/dto/request/CourseRequest.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,11 @@ | ||
package com.example.domain.course.dto.request | ||
|
||
import org.jetbrains.annotations.NotNull | ||
|
||
class CourseRequest ( | ||
@NotNull | ||
val name: String, | ||
|
||
@NotNull | ||
val term: Int | ||
) |
11 changes: 11 additions & 0 deletions
11
common/src/main/kotlin/com/example/domain/course/dto/request/VideoRequest.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,11 @@ | ||
package com.example.domain.course.dto.request | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema | ||
|
||
@Schema(description = "강의 등록 API Request Body입니다. ") | ||
class VideoRequest ( | ||
@Schema(description = "강의 id") | ||
val courseId: Long, | ||
@Schema(description = "강의 이름") | ||
val name: String | ||
) |
10 changes: 10 additions & 0 deletions
10
common/src/main/kotlin/com/example/domain/course/dto/response/AssignmentResponse.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,10 @@ | ||
package com.example.domain.course.dto.response | ||
|
||
import java.time.LocalDateTime | ||
|
||
class AssignmentResponse( | ||
val id: Long, | ||
val name: String, | ||
val dueAt: LocalDateTime, | ||
val startAt: LocalDateTime | ||
) |
11 changes: 11 additions & 0 deletions
11
common/src/main/kotlin/com/example/domain/course/dto/response/CalendarResponse.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,11 @@ | ||
package com.example.domain.course.dto.response | ||
|
||
import com.example.common.enums.CalendarType | ||
import java.time.LocalDateTime | ||
|
||
class CalendarResponse ( | ||
|
||
val type: CalendarType, | ||
val dueAt: LocalDateTime, | ||
val name: String, | ||
) |
8 changes: 8 additions & 0 deletions
8
common/src/main/kotlin/com/example/domain/course/dto/response/CourseResponse.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,8 @@ | ||
package com.example.domain.course.dto.response | ||
|
||
class CourseResponse ( | ||
val name: String, | ||
val videos: List<VideoResponse> = emptyList(), | ||
val assignments: List<AssignmentResponse> = emptyList(), | ||
val term: Int | ||
) |
11 changes: 11 additions & 0 deletions
11
common/src/main/kotlin/com/example/domain/course/dto/response/VideoResponse.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,11 @@ | ||
package com.example.domain.course.dto.response | ||
|
||
import java.time.LocalDate | ||
import java.time.LocalDateTime | ||
|
||
class VideoResponse ( | ||
val id: Long, | ||
val name: String, | ||
val dueAt: LocalDateTime, | ||
val startAt: LocalDateTime | ||
) |
19 changes: 19 additions & 0 deletions
19
common/src/main/kotlin/com/example/domain/course/model/entity/Assignment.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,19 @@ | ||
package com.example.domain.course.model.entity | ||
|
||
import com.example.common.domain.BaseEntity | ||
import com.fasterxml.jackson.annotation.JsonIgnore | ||
import jakarta.persistence.* | ||
import java.time.LocalDateTime | ||
|
||
@Entity | ||
class Assignment ( | ||
val dueAt : LocalDateTime, | ||
|
||
val startAt : LocalDateTime, | ||
|
||
val name: String, | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "course_id") | ||
var course : Course? = null, | ||
) : BaseEntity() |
17 changes: 17 additions & 0 deletions
17
common/src/main/kotlin/com/example/domain/course/model/entity/Calendar.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,17 @@ | ||
package com.example.domain.course.model.entity | ||
|
||
import com.example.common.domain.BaseEntity | ||
import com.example.common.enums.CalendarType | ||
import jakarta.persistence.* | ||
import java.time.LocalDateTime | ||
|
||
@Entity | ||
class Calendar ( | ||
val type: CalendarType, | ||
|
||
val course: String, | ||
|
||
val dueAt: LocalDateTime, | ||
|
||
val name: String | ||
) : BaseEntity() |
Oops, something went wrong.