Skip to content

Commit

Permalink
Merge pull request #124 from TeamMiso/develop
Browse files Browse the repository at this point in the history
master 브랜치로 머지
  • Loading branch information
uuuuuuuk authored Apr 27, 2024
2 parents a646b24 + 861a262 commit 0d2ce16
Show file tree
Hide file tree
Showing 19 changed files with 116 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ package andreas311.miso.domain.environment.application.port.input.dto
import andreas311.miso.domain.environment.domain.TodayEnvironment

data class DetailEnvironmentDto(
val title: String = "",
val content: String = "",
val imageUrl: String? = ""
val title: String,
val content: String,
val imageUrl: String?
) {
constructor(todayEnvironment: TodayEnvironment): this(
constructor(todayEnvironment: TodayEnvironment) : this(
title = todayEnvironment.title,
content = todayEnvironment.content,
imageUrl = todayEnvironment.imageUrl
)

constructor() : this(
title = "",
content = "",
imageUrl = null
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package andreas311.miso.domain.item.application.port.input.dto
import andreas311.miso.domain.item.domain.Item

data class DetailItemDto(
val id: Long = 0L,
val price: Int = 0,
val amount: Int = 0,
val name: String = "",
val content: String = "",
val imageUrl: String? = ""
val id: Long,
val price: Int,
val amount: Int,
val name: String,
val content: String,
val imageUrl: String?
) {
constructor(item: Item) : this(
id = item.id,
Expand All @@ -18,4 +18,13 @@ data class DetailItemDto(
content = item.content,
imageUrl = item.imageUrl
)

constructor() : this(
id = 0,
price = 0,
amount = 0,
name = "",
content = "",
imageUrl = null
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package andreas311.miso.domain.item.application.port.input.dto
import andreas311.miso.domain.item.domain.Item

data class ItemDto(
val id: Long = 0L,
val price: Int = 0,
val amount: Int = 0,
val name: String = "",
val imageUrl: String? = ""
val id: Long,
val price: Int,
val amount: Int,
val name: String,
val imageUrl: String?
) {
constructor(item: Item) : this(
id = item.id,
Expand All @@ -16,4 +16,12 @@ data class ItemDto(
name = item.name,
imageUrl = item.imageUrl
)

constructor() : this(
id = 0L,
price = 0,
amount = 0,
name = "",
imageUrl = null
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ package andreas311.miso.domain.item.application.port.input.dto

data class ListItemDto(
val itemList: List<ItemDto>
)
) {
constructor() : this(emptyList())
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ import andreas311.miso.domain.item.application.port.input.dto.CreateItemDto
import andreas311.miso.domain.item.application.port.output.CommandItemPort
import andreas311.miso.domain.item.domain.Item
import andreas311.miso.thirdparty.aws.s3.util.S3Util
import org.springframework.cache.annotation.CacheEvict
import org.springframework.web.multipart.MultipartFile

@RollbackService
class CreateItemService(
private val s3Util: S3Util,
private val commandItemPort: CommandItemPort
) : CreateItemUseCase {
@CacheEvict(cacheNames = ["itemList"], key = "'itemList'", cacheManager = "redisCacheManager")
override fun execute(createItemDto: CreateItemDto, multipartFile: MultipartFile?) {
val imageUrl =
if (multipartFile != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ import andreas311.miso.domain.item.application.port.input.DeleteItemUseCase
import andreas311.miso.domain.item.application.port.output.CommandItemPort
import andreas311.miso.domain.item.application.port.output.QueryItemPort
import org.springframework.cache.annotation.CacheEvict
import org.springframework.cache.annotation.Caching

@RollbackService
class DeleteItemService(
private val queryItemPort: QueryItemPort,
private val commandItemPort: CommandItemPort
) : DeleteItemUseCase {
@CacheEvict(cacheNames = ["item"], key = "#id", cacheManager = "redisCacheManager")
@Caching(evict = [
CacheEvict(cacheNames = ["item"], key = "#id", cacheManager = "redisCacheManager"),
CacheEvict(cacheNames = ["itemList"], key = "'itemList'", cacheManager = "redisCacheManager")
])
override fun execute(id: Long) {
val itemEntity = queryItemPort.findByIdOrNull(id)
?: throw ItemNotFoundException()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import andreas311.miso.domain.item.application.port.output.QueryItemPort
import andreas311.miso.domain.item.domain.Item
import andreas311.miso.thirdparty.aws.s3.util.S3Util
import org.springframework.cache.annotation.CacheEvict
import org.springframework.cache.annotation.Caching
import org.springframework.stereotype.Component
import org.springframework.web.multipart.MultipartFile

Expand All @@ -17,7 +18,10 @@ class EditItemService(
private val queryItemPort: QueryItemPort,
private val commandItemPort: CommandItemPort
) : EditItemUseCase {
@CacheEvict(cacheNames = ["item"], key = "#id", cacheManager = "redisCacheManager")
@Caching(evict = [
CacheEvict(cacheNames = ["item"], key = "#id", cacheManager = "redisCacheManager"),
CacheEvict(cacheNames = ["itemList"], key = "'itemList'", cacheManager = "redisCacheManager")
])
override fun execute(id: Long, editItemDto: EditItemDto, multipartFile: MultipartFile?) {
val item = queryItemPort.findByIdOrNull(id)
?: throw ItemNotFoundException()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import andreas311.miso.domain.item.application.port.input.ListItemUseCase
import andreas311.miso.domain.item.application.port.input.dto.ItemDto
import andreas311.miso.domain.item.application.port.input.dto.ListItemDto
import andreas311.miso.domain.item.application.port.output.QueryItemPort
import org.springframework.cache.annotation.Cacheable

@ReadOnlyRollbackService
class ListItemService(
private val queryItemPort: QueryItemPort
) : ListItemUseCase {
@Cacheable(cacheNames = ["itemList"], key = "'itemList'", cacheManager = "redisCacheManager")
override fun execute(): ListItemDto {
return ListItemDto(
itemList = queryItemPort.findAll()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ package andreas311.miso.domain.notification.application.port.input.dto
import andreas311.miso.domain.notification.domain.Notification

data class DetailNotificationDto(
val answer: String = ""
val answer: String
) {
constructor(notification: Notification) : this(
answer = notification.answer
)

constructor() : this(
answer = ""
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import andreas311.miso.domain.recyclables.domain.Recyclables
import andreas311.miso.domain.recyclables.domain.RecyclablesType

data class DetailRecyclablesDto(
val id: Long = 0L,
val title: String = "",
val subTitle: String = "",
val recycleMethod: String = "",
val recycleTip: String = "",
val recycleCaution: String = "",
val imageUrl: String? = "",
val recyclablesType: RecyclablesType = RecyclablesType.BAG,
val recycleMark: String = ""
val id: Long,
val title: String,
val subTitle: String,
val recycleMethod: String,
val recycleTip: String,
val recycleCaution: String,
val imageUrl: String?,
val recyclablesType: RecyclablesType,
val recycleMark: String
) {
constructor(recyclables: Recyclables) : this(
id = recyclables.id,
Expand All @@ -25,4 +25,16 @@ data class DetailRecyclablesDto(
recyclablesType = recyclables.recyclablesType,
recycleMark = recyclables.recycleMark
)

constructor() : this(
id = 0L,
title = "",
subTitle = "",
recycleMethod = "",
recycleTip = "",
recycleCaution = "",
imageUrl = null,
recyclablesType = RecyclablesType.BAG,
recycleMark = ""
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ package andreas311.miso.domain.recyclables.application.port.input.dto

data class ListRecyclablesDto(
val recyclablesList: List<RecyclablesDto>
)
) {
constructor() : this(emptyList())
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,11 @@ data class RecyclablesDto(
recycleMethod = recyclables.recycleMethod,
recyclablesType = recyclables.recyclablesType
)

constructor() : this(
title = "",
imageUrl = null,
recycleMethod = "",
recyclablesType = RecyclablesType.BAG
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ import andreas311.miso.domain.recyclables.application.port.input.dto.CreateRecyc
import andreas311.miso.domain.recyclables.application.port.output.CommandRecyclablesPort
import andreas311.miso.domain.recyclables.domain.Recyclables
import andreas311.miso.thirdparty.aws.s3.util.S3Util
import org.springframework.cache.annotation.CacheEvict
import org.springframework.web.multipart.MultipartFile

@RollbackService
class CreateRecyclablesService(
private val s3Util: S3Util,
private val commandRecyclablesPort: CommandRecyclablesPort
) : CreateRecyclablesUseCase {
@CacheEvict(cacheNames = ["recyclablesList"], key = "'recyclablesList'", cacheManager = "redisCacheManager")
override fun execute(createRecyclablesDto: CreateRecyclablesDto, multipartFile: MultipartFile?) {
val imageUrl =
if (multipartFile != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class DeleteRecyclablesService(
private val queryRecyclablesPort: QueryRecyclablesPort,
private val commandRecyclablesPort: CommandRecyclablesPort
) : DeleteRecyclablesUseCase {
@CacheEvict(cacheNames = ["recyclables"], key = "#id", cacheManager = "redisCacheManager")
@CacheEvict(cacheNames = ["recyclablesList"], key = "'recyclablesList'", cacheManager = "redisCacheManager")
override fun execute(id: Long) {
val recyclablesEntity = queryRecyclablesPort.findByIdOrNull(id)
?: throw RecyclablesNotFoundException()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import andreas311.miso.domain.recyclables.application.port.output.QueryRecyclabl
import andreas311.miso.domain.recyclables.domain.Recyclables
import andreas311.miso.thirdparty.aws.s3.util.S3Util
import org.springframework.cache.annotation.CacheEvict
import org.springframework.cache.annotation.Caching
import org.springframework.web.multipart.MultipartFile

@RollbackService
Expand All @@ -17,7 +18,10 @@ class EditRecyclablesService(
private val queryRecyclablesPort: QueryRecyclablesPort,
private val commandRecyclablesPort: CommandRecyclablesPort
) : EditRecyclablesUseCase {
@CacheEvict(cacheNames = ["recyclables"], key = "#editRecyclablesDto.recyclablesType", cacheManager = "redisCacheManager")
@Caching(evict = [
CacheEvict(cacheNames = ["recyclables"], key = "#editRecyclablesDto.recyclablesType", cacheManager = "redisCacheManager"),
CacheEvict(cacheNames = ["recyclablesList"], key = "'recyclablesList'", cacheManager = "redisCacheManager")
])
override fun execute(id: Long, editRecyclablesDto: EditRecyclablesDto, multipartFile: MultipartFile?) {
val recyclables = queryRecyclablesPort.findByIdOrNull(id)
?: throw RecyclablesNotFoundException()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import andreas311.miso.domain.recyclables.application.port.input.ListRecyclables
import andreas311.miso.domain.recyclables.application.port.input.dto.ListRecyclablesDto
import andreas311.miso.domain.recyclables.application.port.input.dto.RecyclablesDto
import andreas311.miso.domain.recyclables.application.port.output.QueryRecyclablesPort
import org.springframework.cache.annotation.Cacheable

@ReadOnlyRollbackService
class ListRecyclablesService(
private val queryRecyclablesPort: QueryRecyclablesPort
) : ListRecyclablesUseCase {
@Cacheable(cacheNames = ["recyclablesList"], key = "'recyclablesList'", cacheManager = "redisCacheManager")
override fun execute(): ListRecyclablesDto {
return ListRecyclablesDto(
recyclablesList = queryRecyclablesPort.findAll()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ package andreas311.miso.domain.user.application.port.input.dto
import andreas311.miso.domain.user.domain.User

data class PointDto(
val point: Int = 0
val point: Int
) {
constructor(user: User) : this(
point = user.point
)

constructor() : this(
point = 0
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@ import andreas311.miso.domain.user.domain.User
import java.util.*

data class UserInfoDto(
val id: UUID = UUID.randomUUID(),
val email: String = "",
val role: Role = Role.ROLE_USER
val id: UUID,
val email: String,
val role: Role
) {
constructor(user: User) : this(
id = user.id,
email = user.email,
role = user.role
)

constructor() : this(
id = UUID.randomUUID(),
email = "",
role = Role.ROLE_USER
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class JwtExceptionFilter : OncePerRequestFilter() {
val errorCode = when (exception) {
is ExpiredJwtException -> ErrorCode.TOKEN_IS_EXPIRED
is JwtException, is IllegalArgumentException -> ErrorCode.TOKEN_NOT_VALID
else -> ErrorCode.UNKNOWN_ERROR
else -> ErrorCode.UNKNOWN_ERROR.also { exception.printStackTrace() }
}

setErrorResponse(errorCode, response)
Expand All @@ -38,9 +38,6 @@ class JwtExceptionFilter : OncePerRequestFilter() {
else -> "Exception"
}
log.debug("================= [ ExceptionHandlerFilter ] 에서 $debugMessage 발생 ===================")
if (exception is IllegalArgumentException) {
exception.printStackTrace()
}
}
}
}
Expand Down

0 comments on commit 0d2ce16

Please sign in to comment.