-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
229 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 14 additions & 12 deletions
26
src/main/kotlin/com/example/onui/domain/mission/entity/AssignMission.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
src/main/kotlin/com/example/onui/domain/mission/entity/GeneralMission.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
src/main/kotlin/com/example/onui/domain/mission/entity/MissionType.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.example.onui.domain.mission.entity | ||
|
||
enum class MissionType { | ||
|
||
ESSENTIAL, | ||
RANDOM, | ||
ASSIGN | ||
} |
18 changes: 0 additions & 18 deletions
18
src/main/kotlin/com/example/onui/domain/mission/entity/RandomMission.kt
This file was deleted.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
src/main/kotlin/com/example/onui/domain/mission/exception/AlreadyCreatedMissionException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.example.onui.domain.mission.exception | ||
|
||
import com.example.onui.global.config.error.data.ErrorCode | ||
import com.example.onui.global.config.error.exception.BusinessException | ||
|
||
object AlreadyCreatedMissionException : BusinessException(ErrorCode.ALREADY_CREATED_MISSION) |
6 changes: 6 additions & 0 deletions
6
.../kotlin/com/example/onui/domain/mission/exception/TypeCoastMissMatchedMissionException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.example.onui.domain.mission.exception | ||
|
||
import com.example.onui.global.config.error.data.ErrorCode | ||
import com.example.onui.global.config.error.exception.BusinessException | ||
|
||
object TypeCoastMissMatchedMissionException : BusinessException(ErrorCode.TYPE_COAST_MISS_MATCHED) |
9 changes: 3 additions & 6 deletions
9
...n/mission/controller/MissionController.kt → ...mission/presentation/MissionController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
package com.example.onui.domain.mission.controller | ||
package com.example.onui.domain.mission.presentation | ||
|
||
import com.example.onui.domain.mission.service.MissionService | ||
import org.springframework.web.bind.annotation.GetMapping | ||
import org.springframework.validation.annotation.Validated | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@Validated | ||
@RestController | ||
@RequestMapping("/mission") | ||
class MissionController( | ||
private val missionService: MissionService | ||
) { | ||
|
||
@GetMapping("/test") | ||
fun test() = missionService.test() | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
...n/kotlin/com/example/onui/domain/mission/presentation/dto/request/CreateMissionRequest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.example.onui.domain.mission.presentation.dto.request | ||
|
||
import com.example.onui.domain.mission.entity.MissionType | ||
import javax.validation.constraints.Max | ||
import javax.validation.constraints.Min | ||
import javax.validation.constraints.NotBlank | ||
import javax.validation.constraints.NotNull | ||
|
||
data class CreateMissionRequest( | ||
|
||
@field:NotBlank(message = "null일 수 없습니다.") | ||
val name: String?, | ||
|
||
@field:NotBlank(message = "null일 수 없습니다.") | ||
val goal: String?, | ||
|
||
@field:NotBlank(message = "null일 수 없습니다.") | ||
val message: String?, | ||
|
||
@field:NotNull(message = "null일 수 없습니다.") | ||
val missionType: MissionType?, | ||
|
||
@field:Min(-10, message = "-10 보다 커야합니다,") | ||
@field:Max(10, message = "10 보다 작야합니다,") | ||
val coast: Int? | ||
) |
19 changes: 19 additions & 0 deletions
19
src/main/kotlin/com/example/onui/domain/mission/presentation/dto/response/MissionResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.example.onui.domain.mission.presentation.dto.response | ||
|
||
import com.example.onui.domain.mission.entity.MissionType | ||
import java.util.* | ||
|
||
data class MissionResponse( | ||
|
||
val id: UUID, | ||
|
||
val name: String, | ||
|
||
val goal: String, | ||
|
||
val message: String, | ||
|
||
val missionType: MissionType, | ||
|
||
val coast: Int? | ||
) |
11 changes: 11 additions & 0 deletions
11
src/main/kotlin/com/example/onui/domain/mission/repository/AssignMissionRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.example.onui.domain.mission.repository | ||
|
||
import com.example.onui.domain.mission.entity.AssignMission | ||
import org.springframework.data.jpa.repository.JpaRepository | ||
import org.springframework.stereotype.Repository | ||
import java.util.* | ||
|
||
@Repository | ||
interface AssignMissionRepository : JpaRepository<AssignMission, UUID?> { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
src/main/kotlin/com/example/onui/domain/mission/repository/QMissionRepository.kt
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
src/main/kotlin/com/example/onui/domain/mission/repository/QMissionRepositoryImpl.kt
This file was deleted.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
src/main/kotlin/com/example/onui/domain/mission/service/MissionScheduling.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.example.onui.domain.mission.service | ||
|
||
import org.springframework.stereotype.Service | ||
import org.springframework.transaction.annotation.Transactional | ||
|
||
@Service | ||
@Transactional(readOnly = true) | ||
class MissionScheduling( | ||
) { | ||
|
||
// @Transactional | ||
// @Scheduled(cron = "0 30 6 * * ?", zone = "Asia/Seoul") | ||
// fun assigningMission() { | ||
// | ||
// val randomMissions = randomMissionRepository.findAll() | ||
// | ||
// val generalMissions = generalMissionRepository.findAll() | ||
// | ||
// userRepository.findAll() | ||
// .parallelStream() | ||
// .forEach { | ||
// val date = LocalDate.now() | ||
// | ||
// val diaries = | ||
// diaryRepository.findAllByUserAndYearAndMonthOrderByCreatedAtAsc(it, date.year, date.monthValue) | ||
// | ||
// val assignMission: Mission = if (diaries.isNullOrEmpty()) { | ||
// | ||
// qDiaryRepository.findThreeDayAgoByUser(it)?.let { diary -> | ||
// | ||
// qMissionRepository.findAssignByCoast(diary.mood.coast).random() | ||
// | ||
// } ?: randomMissions.random() | ||
// | ||
// } else randomMissions.random() | ||
// | ||
// var randomMission = randomMissions.random() | ||
// | ||
// while (randomMission == assignMission) { | ||
// randomMission = randomMissions.random() | ||
// } | ||
// | ||
// assignedRepository.saveAll( | ||
// listOf( | ||
// Assigned(it, generalMissions.random()), | ||
// Assigned(it, assignMission), | ||
// Assigned(it, randomMission) | ||
// ) | ||
// ) | ||
// } | ||
// } | ||
// | ||
// @Transactional | ||
// @Scheduled(cron = "0 0 0 * * ?", zone = "Asia/Seoul") | ||
// fun disAssigning() { | ||
// assignedRepository.deleteAll() | ||
// } | ||
|
||
} |
Oops, something went wrong.