Skip to content

Commit

Permalink
Merge pull request #396 from GSM-MSG/feature/395-submit-form-active
Browse files Browse the repository at this point in the history
학생 폼 제출할 때 재 활용성을 올립니다.
  • Loading branch information
Huuuunee authored Jul 9, 2024
2 parents ca298f7 + 7338056 commit 538ca1d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import team.msg.sms.domain.authentication.model.FieldType
import team.msg.sms.domain.authentication.model.MarkingBoard
import team.msg.sms.domain.authentication.model.MarkingBoardType
import team.msg.sms.domain.authentication.model.UserFormValue
import team.msg.sms.domain.authentication.service.AuthenticationFormService
import team.msg.sms.domain.authentication.service.AuthenticationSectionService
import team.msg.sms.domain.authentication.service.MarkingBoardService
import team.msg.sms.domain.authentication.service.UserFormValueService
Expand All @@ -15,11 +16,16 @@ import java.util.*

@UseCase
class SubmitUserFormDataUseCase(
private val authenticationFormService: AuthenticationFormService,
private val userFormValueService: UserFormValueService,
private val markingBoardService: MarkingBoardService,
private val studentService: StudentService
) {
fun execute(submitDataList: List<SubmitUserFormRequestData>, authenticationFormId: UUID) {
fun execute(submitDataList: List<SubmitUserFormRequestData>, uuid: String?) {
val authenticationFormId =
if (uuid.equals(null)) authenticationFormService.getActiveAuthenticationFormId()
else UUID.fromString(uuid)

val student = studentService.currentStudent()
val userFormValues = submitDataList.flatMap { submitData ->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class SecurityConfig(
.antMatchers(HttpMethod.GET, "/authentication").hasAuthority(TEACHER)
.antMatchers(HttpMethod.PUT, "/authentication/{uuid}").hasAuthority(STUDENT)
.antMatchers(HttpMethod.POST, "/authentication").hasAuthority(STUDENT)
.antMatchers(HttpMethod.POST, "/authentication/submit/{uuid}").hasAuthority(STUDENT)
.antMatchers(HttpMethod.POST, "/authentication/submit").hasAuthority(STUDENT)
.antMatchers(HttpMethod.POST, "/authentication/create").hasAuthority(TEACHER)
.antMatchers(HttpMethod.POST, "/authentication/grading/{markingBoardId}").hasAuthority(TEACHER)
.antMatchers(HttpMethod.PATCH, "/authentication/teacher/{uuid}/approve").hasAuthority(TEACHER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ class AuthenticationWebAdapter(
queryStudentAuthenticationFormDetailUseCase.execute(UUID.fromString(uuid))
.let { ResponseEntity.ok(it.toResponse()) }

@PostMapping("/submit/{uuid}")
@PostMapping("/submit")
fun submitUserFormValue(
@RequestBody request: SubmitUserFormDataWebRequest,
@PathVariable uuid: String
@RequestParam(name = "uuid", required = false) uuid: String?
): ResponseEntity<Unit> =
submitUserFormDataUseCase.execute(request.contents, UUID.fromString(uuid))
submitUserFormDataUseCase.execute(request.contents, uuid)
.let { ResponseEntity.ok().build() }

@PostMapping("/create")
Expand Down

0 comments on commit 538ca1d

Please sign in to comment.