diff --git a/src/main/kotlin/team/themoment/gsmNetworking/domain/mentor/controller/TempMentorController.kt b/src/main/kotlin/team/themoment/gsmNetworking/domain/mentor/controller/TempMentorController.kt index 944857b1..9923db0a 100644 --- a/src/main/kotlin/team/themoment/gsmNetworking/domain/mentor/controller/TempMentorController.kt +++ b/src/main/kotlin/team/themoment/gsmNetworking/domain/mentor/controller/TempMentorController.kt @@ -1,24 +1,20 @@ package team.themoment.gsmNetworking.domain.mentor.controller -import org.springframework.http.HttpStatus import org.springframework.http.ResponseEntity -import org.springframework.web.bind.annotation.DeleteMapping import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestMapping import org.springframework.web.bind.annotation.RestController import team.themoment.gsmNetworking.domain.mentor.dto.SearchTempMentorInfoDto import team.themoment.gsmNetworking.domain.mentor.dto.TempMentorInfoDto -import team.themoment.gsmNetworking.domain.mentor.service.DeleteTempMentorService import team.themoment.gsmNetworking.domain.mentor.service.QueryTempMentorListService import team.themoment.gsmNetworking.domain.mentor.service.SearchTempMentorListService @RestController @RequestMapping("/api/v1/temp-mentor") -class TempMentorController( +class TempMentorController ( private val queryTempMentorListService: QueryTempMentorListService, - private val searchTempMentorListService: SearchTempMentorListService, - private val deleteTempMentorService: DeleteTempMentorService + private val searchTempMentorListService: SearchTempMentorListService ) { @GetMapping @@ -28,15 +24,9 @@ class TempMentorController( } @GetMapping("/{name}") - fun searchTempMentorListByName(@PathVariable name: String): ResponseEntity> { + fun searchTempMentorListByName(@PathVariable name: String): ResponseEntity>{ val searchTempMentorList = searchTempMentorListService.execute(name) return ResponseEntity.ok(searchTempMentorList) } - @DeleteMapping("/{firebaseId}") - fun deleteTempMentor(@PathVariable firebaseId: String): ResponseEntity { - deleteTempMentorService.execute(firebaseId) - return ResponseEntity.status(HttpStatus.RESET_CONTENT).build() - } - } diff --git a/src/main/kotlin/team/themoment/gsmNetworking/domain/mentor/domain/TempMentor.kt b/src/main/kotlin/team/themoment/gsmNetworking/domain/mentor/domain/TempMentor.kt index 62f195bd..b66896d6 100644 --- a/src/main/kotlin/team/themoment/gsmNetworking/domain/mentor/domain/TempMentor.kt +++ b/src/main/kotlin/team/themoment/gsmNetworking/domain/mentor/domain/TempMentor.kt @@ -1,12 +1,9 @@ package team.themoment.gsmNetworking.domain.mentor.domain -import org.hibernate.annotations.SQLDelete -import org.hibernate.annotations.Where import javax.persistence.* @Entity @Table(name = "temp_mentor") -@Where(clause = "deleted = false") class TempMentor( @Id @Column(name = "real_id") @@ -34,8 +31,5 @@ class TempMentor( val companyName: String, @Column(nullable = false, name = "position") - val position: String, - - @Column(nullable = false, name = "deleted") - var deleted: Boolean = false + val position: String ) diff --git a/src/main/kotlin/team/themoment/gsmNetworking/domain/mentor/dto/TempMentorInfoDto.kt b/src/main/kotlin/team/themoment/gsmNetworking/domain/mentor/dto/TempMentorInfoDto.kt index 4611cc57..bc0bce35 100644 --- a/src/main/kotlin/team/themoment/gsmNetworking/domain/mentor/dto/TempMentorInfoDto.kt +++ b/src/main/kotlin/team/themoment/gsmNetworking/domain/mentor/dto/TempMentorInfoDto.kt @@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty data class TempMentorInfoDto( var id: Long, - val firebaseId: String, val name: String, val email: String, val generation: Int, diff --git a/src/main/kotlin/team/themoment/gsmNetworking/domain/mentor/repository/TempMentorRepository.kt b/src/main/kotlin/team/themoment/gsmNetworking/domain/mentor/repository/TempMentorRepository.kt index a8f88c06..f0f3f05a 100644 --- a/src/main/kotlin/team/themoment/gsmNetworking/domain/mentor/repository/TempMentorRepository.kt +++ b/src/main/kotlin/team/themoment/gsmNetworking/domain/mentor/repository/TempMentorRepository.kt @@ -3,10 +3,6 @@ package team.themoment.gsmNetworking.domain.mentor.repository import org.springframework.data.repository.CrudRepository import team.themoment.gsmNetworking.domain.mentor.domain.TempMentor -interface TempMentorRepository : CrudRepository { - +interface TempMentorRepository : CrudRepository { fun findByNameContaining(name: String): List - - fun findByFirebaseId(firebaseId: String): TempMentor? - } diff --git a/src/main/kotlin/team/themoment/gsmNetworking/domain/mentor/service/DeleteTempMentorService.kt b/src/main/kotlin/team/themoment/gsmNetworking/domain/mentor/service/DeleteTempMentorService.kt deleted file mode 100644 index 96720779..00000000 --- a/src/main/kotlin/team/themoment/gsmNetworking/domain/mentor/service/DeleteTempMentorService.kt +++ /dev/null @@ -1,21 +0,0 @@ -package team.themoment.gsmNetworking.domain.mentor.service - -import org.springframework.http.HttpStatus -import org.springframework.stereotype.Service -import org.springframework.transaction.annotation.Transactional -import team.themoment.gsmNetworking.common.exception.ExpectedException -import team.themoment.gsmNetworking.domain.mentor.repository.TempMentorRepository - -@Service -@Transactional(rollbackFor = [Exception::class]) -class DeleteTempMentorService( - private val tempMentorRepository: TempMentorRepository -) { - - fun execute(firebaseId: String) { - val tempMentor = tempMentorRepository.findByFirebaseId(firebaseId) - ?: throw ExpectedException("존재하지 않은 firebaseId : $firebaseId 입니다.", HttpStatus.NOT_FOUND) - tempMentor.deleted = true - } - -} \ No newline at end of file diff --git a/src/main/kotlin/team/themoment/gsmNetworking/domain/mentor/service/QueryTempMentorListService.kt b/src/main/kotlin/team/themoment/gsmNetworking/domain/mentor/service/QueryTempMentorListService.kt index 77125856..4e973e2a 100644 --- a/src/main/kotlin/team/themoment/gsmNetworking/domain/mentor/service/QueryTempMentorListService.kt +++ b/src/main/kotlin/team/themoment/gsmNetworking/domain/mentor/service/QueryTempMentorListService.kt @@ -24,7 +24,6 @@ class QueryTempMentorListService( val tempMentors = tempMentorRepository.findAll().map { tempMentor -> TempMentorInfoDto( tempMentor.id, - tempMentor.firebaseId, tempMentor.name, tempMentor.email ?: "", tempMentor.generation, diff --git a/src/main/kotlin/team/themoment/gsmNetworking/global/security/SecurityConfig.kt b/src/main/kotlin/team/themoment/gsmNetworking/global/security/SecurityConfig.kt index 42eabbaf..d6c6ad58 100644 --- a/src/main/kotlin/team/themoment/gsmNetworking/global/security/SecurityConfig.kt +++ b/src/main/kotlin/team/themoment/gsmNetworking/global/security/SecurityConfig.kt @@ -54,7 +54,7 @@ class SecurityConfig( http.authorizeHttpRequests() // /mentor .mvcMatchers("/api/v1/mentor/*").hasAnyRole( - Authority.USER.name + Authority.USER.name, ) .mvcMatchers(HttpMethod.GET, "/api/v1/mentor").hasAnyRole( Authority.TEMP_USER.name, @@ -64,13 +64,6 @@ class SecurityConfig( .mvcMatchers(HttpMethod.POST, "/api/v1/mentor").hasAnyRole( Authority.TEMP_USER.name ) - // /tempMentor - .mvcMatchers(HttpMethod.GET, "/api/v1/temp-mentor/**").hasAnyRole( - Authority.TEMP_USER.name - ) - .mvcMatchers(HttpMethod.DELETE, "/api/v1/temp-mentor/*").hasAnyRole( - Authority.USER.name - ) // /mentee .mvcMatchers("/api/v1/mentee/*").hasAnyRole( Authority.USER.name,