Skip to content

Commit

Permalink
📝 ::
Browse files Browse the repository at this point in the history
  • Loading branch information
gurdl0525 committed Nov 16, 2023
1 parent 1b20c2c commit 32dbf22
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Mission(
var goal: String = goal
protected set

@Column(name = "message", nullable = false, unique = true)
@Column(name = "message", nullable = false)
var message: String = message
protected set

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@ import java.util.*
@Repository
interface MissionRepository : JpaRepository<Mission, UUID?> {

fun existsByMessage(message: String): Boolean

fun findAllByMissionType(missionType: MissionType): MutableList<Mission>
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.example.onui.domain.mission.entity.AssignMission
import com.example.onui.domain.mission.entity.Mission
import com.example.onui.domain.mission.entity.MissionType
import com.example.onui.domain.mission.exception.AlreadyCreatedMissionException
import com.example.onui.domain.mission.exception.TypeCoastMissMatchedMissionException
import com.example.onui.domain.mission.presentation.dto.request.CreateMissionRequest
import com.example.onui.domain.mission.presentation.dto.response.MissionListResponse
Expand All @@ -30,13 +29,12 @@ class MissionServiceImpl(
userFacade.getAdmin()

if (req.missionType!! == MissionType.ASSIGN && req.coast == null) throw TypeCoastMissMatchedMissionException
if (missionRepository.existsByMessage(req.message!!)) throw AlreadyCreatedMissionException

val mission = missionRepository.save(
Mission(
req.name!!,
req.goal!!,
req.message,
req.message!!,
req.missionType
)
)
Expand Down

0 comments on commit 32dbf22

Please sign in to comment.