Skip to content

학생 폼 제출할 때 재 활용성을 올립니다. #396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading