diff --git a/src/main/kotlin/goodspace/bllsoneshot/entity/assignment/Task.kt b/src/main/kotlin/goodspace/bllsoneshot/entity/assignment/Task.kt index cf5a0e7..2d0c3e8 100644 --- a/src/main/kotlin/goodspace/bllsoneshot/entity/assignment/Task.kt +++ b/src/main/kotlin/goodspace/bllsoneshot/entity/assignment/Task.kt @@ -4,10 +4,19 @@ import goodspace.bllsoneshot.entity.BaseEntity import goodspace.bllsoneshot.entity.user.User import goodspace.bllsoneshot.entity.user.UserRole import goodspace.bllsoneshot.global.exception.ExceptionMessage.NEGATIVE_ACTUAL_MINUTES -import jakarta.persistence.* -import org.hibernate.annotations.BatchSize +import jakarta.persistence.CascadeType +import jakarta.persistence.Column +import jakarta.persistence.Entity +import jakarta.persistence.EnumType +import jakarta.persistence.Enumerated +import jakarta.persistence.FetchType +import jakarta.persistence.JoinColumn +import jakarta.persistence.ManyToOne +import jakarta.persistence.OneToMany +import jakarta.persistence.OneToOne +import jakarta.persistence.Transient import java.time.LocalDate -import java.time.LocalDateTime +import org.hibernate.annotations.BatchSize @Entity class Task( @@ -21,6 +30,8 @@ class Task( val date: LocalDate? = null, + val uploadedAt: LocalDate? = null, + @Column(nullable = false) var name: String, diff --git a/src/main/kotlin/goodspace/bllsoneshot/task/controller/ResourceController.kt b/src/main/kotlin/goodspace/bllsoneshot/task/controller/ResourceController.kt index 0eb1613..efe96fb 100644 --- a/src/main/kotlin/goodspace/bllsoneshot/task/controller/ResourceController.kt +++ b/src/main/kotlin/goodspace/bllsoneshot/task/controller/ResourceController.kt @@ -95,6 +95,7 @@ class ResourceController( resourceName: 자료 이름 fileId: PDF 파일 ID (선택) columnLink: 칼럼 링크 (선택) + uploadedAt: 업로드 날자 (안넣으면 오늘) [응답] 생성된 자료 정보 diff --git a/src/main/kotlin/goodspace/bllsoneshot/task/dto/request/ResourceCreateRequest.kt b/src/main/kotlin/goodspace/bllsoneshot/task/dto/request/ResourceCreateRequest.kt index 6a18d1e..4109746 100644 --- a/src/main/kotlin/goodspace/bllsoneshot/task/dto/request/ResourceCreateRequest.kt +++ b/src/main/kotlin/goodspace/bllsoneshot/task/dto/request/ResourceCreateRequest.kt @@ -2,6 +2,7 @@ package goodspace.bllsoneshot.task.dto.request import goodspace.bllsoneshot.entity.assignment.Subject import jakarta.validation.constraints.NotBlank +import java.time.LocalDate data class ResourceCreateRequest( val menteeId: Long, @@ -9,5 +10,6 @@ data class ResourceCreateRequest( @field:NotBlank(message = "자료 이름이 비어 있습니다.") val resourceName: String, val fileId: Long? = null, - val columnLink: String? = null + val columnLink: String? = null, + val uploadedAt: LocalDate = LocalDate.now() ) diff --git a/src/main/kotlin/goodspace/bllsoneshot/task/dto/response/submit/ResourceResponse.kt b/src/main/kotlin/goodspace/bllsoneshot/task/dto/response/submit/ResourceResponse.kt index 3196e54..e6f87ad 100644 --- a/src/main/kotlin/goodspace/bllsoneshot/task/dto/response/submit/ResourceResponse.kt +++ b/src/main/kotlin/goodspace/bllsoneshot/task/dto/response/submit/ResourceResponse.kt @@ -11,5 +11,6 @@ data class ResourceResponse( val resourceName: String, val registeredDate: LocalDate, val worksheets: List, - val columnLinks: List + val columnLinks: List, + val uploadedAt: LocalDate? ) diff --git a/src/main/kotlin/goodspace/bllsoneshot/task/dto/response/task/TaskDetailResponse.kt b/src/main/kotlin/goodspace/bllsoneshot/task/dto/response/task/TaskDetailResponse.kt index 38d5a9d..1a2b1a4 100644 --- a/src/main/kotlin/goodspace/bllsoneshot/task/dto/response/task/TaskDetailResponse.kt +++ b/src/main/kotlin/goodspace/bllsoneshot/task/dto/response/task/TaskDetailResponse.kt @@ -4,6 +4,7 @@ import goodspace.bllsoneshot.entity.assignment.Subject import goodspace.bllsoneshot.entity.user.UserRole import goodspace.bllsoneshot.task.dto.response.feedback.ColumnLinkResponse import goodspace.bllsoneshot.task.dto.response.feedback.WorksheetResponse +import java.time.LocalDate data class TaskDetailResponse( val taskId: Long, @@ -14,6 +15,9 @@ data class TaskDetailResponse( val goalMinutes: Int, val actualMinutes: Int?, + val isResource: Boolean, + val uploadedAt: LocalDate?, + val hasFeedback: Boolean, val generalComment: String?, val mentorName: String, diff --git a/src/main/kotlin/goodspace/bllsoneshot/task/mapper/ResourceMapper.kt b/src/main/kotlin/goodspace/bllsoneshot/task/mapper/ResourceMapper.kt index 6aa7cc4..83b8686 100644 --- a/src/main/kotlin/goodspace/bllsoneshot/task/mapper/ResourceMapper.kt +++ b/src/main/kotlin/goodspace/bllsoneshot/task/mapper/ResourceMapper.kt @@ -19,7 +19,8 @@ class ResourceMapper( resourceName = task.name, registeredDate = task.date ?: LocalDate.now(), worksheets = task.worksheets.map { worksheetMapper.map(it) }, - columnLinks = task.columnLinks.map { columnLinkMapper.map(it) } + columnLinks = task.columnLinks.map { columnLinkMapper.map(it) }, + uploadedAt = task.uploadedAt ) } diff --git a/src/main/kotlin/goodspace/bllsoneshot/task/mapper/TaskDetailMapper.kt b/src/main/kotlin/goodspace/bllsoneshot/task/mapper/TaskDetailMapper.kt index 53a73ee..26d02e4 100644 --- a/src/main/kotlin/goodspace/bllsoneshot/task/mapper/TaskDetailMapper.kt +++ b/src/main/kotlin/goodspace/bllsoneshot/task/mapper/TaskDetailMapper.kt @@ -30,6 +30,8 @@ class TaskDetailMapper( subject = task.subject, goalMinutes = task.goalMinutes, actualMinutes = task.actualMinutes, + isResource = task.isResource, + uploadedAt = task.uploadedAt, hasFeedback = task.hasFeedback(), generalComment = task.generalComment?.content, mentorName = task.mentee.mentor?.name ?: "", diff --git a/src/main/kotlin/goodspace/bllsoneshot/task/service/ResourceService.kt b/src/main/kotlin/goodspace/bllsoneshot/task/service/ResourceService.kt index e976553..ada7e9d 100644 --- a/src/main/kotlin/goodspace/bllsoneshot/task/service/ResourceService.kt +++ b/src/main/kotlin/goodspace/bllsoneshot/task/service/ResourceService.kt @@ -67,7 +67,8 @@ class ResourceService( name = request.resourceName, goalMinutes = 0, createdBy = UserRole.ROLE_MENTOR, - isResource = true + isResource = true, + uploadedAt = request.uploadedAt ) request.fileId?.let { fileId ->