Skip to content

Commit

Permalink
Revert "TempMentor 삭제하는 기능 구현 (#40)"
Browse files Browse the repository at this point in the history
This reverts commit 45e70b7.
  • Loading branch information
hajeu committed Nov 6, 2023
1 parent 2d57492 commit 5fcad3f
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 56 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -28,15 +24,9 @@ class TempMentorController(
}

@GetMapping("/{name}")
fun searchTempMentorListByName(@PathVariable name: String): ResponseEntity<List<SearchTempMentorInfoDto>> {
fun searchTempMentorListByName(@PathVariable name: String): ResponseEntity<List<SearchTempMentorInfoDto>>{
val searchTempMentorList = searchTempMentorListService.execute(name)
return ResponseEntity.ok(searchTempMentorList)
}

@DeleteMapping("/{firebaseId}")
fun deleteTempMentor(@PathVariable firebaseId: String): ResponseEntity<Void> {
deleteTempMentorService.execute(firebaseId)
return ResponseEntity.status(HttpStatus.RESET_CONTENT).build()
}

}
Original file line number Diff line number Diff line change
@@ -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")
Expand Down Expand Up @@ -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
)
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<TempMentor, Long> {

interface TempMentorRepository : CrudRepository<TempMentor, Int> {
fun findByNameContaining(name: String): List<TempMentor>

fun findByFirebaseId(firebaseId: String): TempMentor?

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class QueryTempMentorListService(
val tempMentors = tempMentorRepository.findAll().map { tempMentor ->
TempMentorInfoDto(
tempMentor.id,
tempMentor.firebaseId,
tempMentor.name,
tempMentor.email ?: "",
tempMentor.generation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit 5fcad3f

Please sign in to comment.