diff --git a/grida-core/core-api/src/main/kotlin/org/grida/presentation/v1/diary/DiaryController.kt b/grida-core/core-api/src/main/kotlin/org/grida/presentation/v1/diary/DiaryController.kt index 333d952e..a43b66d1 100644 --- a/grida-core/core-api/src/main/kotlin/org/grida/presentation/v1/diary/DiaryController.kt +++ b/grida-core/core-api/src/main/kotlin/org/grida/presentation/v1/diary/DiaryController.kt @@ -3,10 +3,14 @@ package org.grida.presentation.v1.diary import io.wwan13.wintersecurity.resolve.RequestUserId import org.grida.api.ApiResponse import org.grida.api.dto.IdResponse +import org.grida.domain.diary.DiaryScope import org.grida.domain.diary.DiaryService +import org.grida.presentation.v1.diary.dto.DiaryModifyRequest import org.grida.presentation.v1.diary.dto.DiaryRequest import org.grida.presentation.v1.diary.dto.DiaryResponse +import org.grida.presentation.v1.diary.dto.DiaryScopeRequest import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.PatchMapping import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.PostMapping import org.springframework.web.bind.annotation.RequestBody @@ -38,4 +42,35 @@ class DiaryController( val response = DiaryResponse.from(diary) return ApiResponse.success(response) } + + @PatchMapping("/{diaryId}") + fun modifyDiary( + @RequestUserId userId: Long, + @PathVariable diaryId: Long, + @RequestBody request: DiaryModifyRequest + ): ApiResponse { + val modifiedDiaryId = diaryService.modify( + diaryId, + userId, + request.content, + DiaryScope.valueOf(request.scope) + ) + val response = IdResponse(modifiedDiaryId) + return ApiResponse.success(response) + } + + @PatchMapping("/{diaryId}/scope") + fun modifyDiaryScope( + @RequestUserId userId: Long, + @PathVariable diaryId: Long, + @RequestBody request: DiaryScopeRequest + ): ApiResponse { + val modifiedDiaryId = diaryService.modifyScope( + diaryId, + userId, + DiaryScope.valueOf(request.scope) + ) + val response = IdResponse(modifiedDiaryId) + return ApiResponse.success(response) + } } diff --git a/grida-core/core-api/src/main/kotlin/org/grida/presentation/v1/diary/dto/DiaryModifyRequest.kt b/grida-core/core-api/src/main/kotlin/org/grida/presentation/v1/diary/dto/DiaryModifyRequest.kt new file mode 100644 index 00000000..d8ef4758 --- /dev/null +++ b/grida-core/core-api/src/main/kotlin/org/grida/presentation/v1/diary/dto/DiaryModifyRequest.kt @@ -0,0 +1,6 @@ +package org.grida.presentation.v1.diary.dto + +data class DiaryModifyRequest( + val content: String, + val scope: String +) diff --git a/grida-core/core-api/src/main/kotlin/org/grida/presentation/v1/diary/dto/DiaryScopeRequest.kt b/grida-core/core-api/src/main/kotlin/org/grida/presentation/v1/diary/dto/DiaryScopeRequest.kt new file mode 100644 index 00000000..1476993b --- /dev/null +++ b/grida-core/core-api/src/main/kotlin/org/grida/presentation/v1/diary/dto/DiaryScopeRequest.kt @@ -0,0 +1,5 @@ +package org.grida.presentation.v1.diary.dto + +data class DiaryScopeRequest( + val scope: String +) diff --git a/grida-core/core-api/src/main/kotlin/org/grida/support/requestlogger/LogFilter.kt b/grida-core/core-api/src/main/kotlin/org/grida/support/requestlogger/LogFilter.kt index 09328717..1dd9fcf7 100644 --- a/grida-core/core-api/src/main/kotlin/org/grida/support/requestlogger/LogFilter.kt +++ b/grida-core/core-api/src/main/kotlin/org/grida/support/requestlogger/LogFilter.kt @@ -1,5 +1,6 @@ package org.grida.support.requestlogger +import com.fasterxml.jackson.databind.ObjectMapper import mu.KotlinLogging import org.springframework.web.filter.OncePerRequestFilter import org.springframework.web.util.ContentCachingRequestWrapper @@ -10,7 +11,9 @@ import javax.servlet.http.HttpServletResponse private val log = KotlinLogging.logger {} -class LogFilter : OncePerRequestFilter() { +class LogFilter( + private val objectMapper: ObjectMapper +) : OncePerRequestFilter() { override fun doFilterInternal( request: HttpServletRequest, @@ -26,7 +29,7 @@ class LogFilter : OncePerRequestFilter() { val requestElapsed = (requestCompleted - requestOccurred) / 1000.0 val logContext = RequestLogContext.of(requestWrapper, responseWrapper, requestElapsed) - log.info(logContext.toLogMessage()) + log.info(logContext.toLogMessage(objectMapper)) responseWrapper.copyBodyToResponse() } diff --git a/grida-core/core-api/src/main/kotlin/org/grida/support/requestlogger/LogFilterRegistrar.kt b/grida-core/core-api/src/main/kotlin/org/grida/support/requestlogger/LogFilterRegistrar.kt index 11c0bc33..049f27b0 100644 --- a/grida-core/core-api/src/main/kotlin/org/grida/support/requestlogger/LogFilterRegistrar.kt +++ b/grida-core/core-api/src/main/kotlin/org/grida/support/requestlogger/LogFilterRegistrar.kt @@ -1,14 +1,17 @@ package org.grida.support.requestlogger +import com.fasterxml.jackson.databind.ObjectMapper import org.springframework.boot.web.servlet.FilterRegistrationBean import org.springframework.context.annotation.Bean class LogFilterRegistrar { @Bean - fun logFilter(): FilterRegistrationBean { + fun logFilter( + objectMapper: ObjectMapper + ): FilterRegistrationBean { val filterRegistration = FilterRegistrationBean() - filterRegistration.filter = LogFilter() + filterRegistration.filter = LogFilter(objectMapper) filterRegistration.order = 0 return filterRegistration } diff --git a/grida-core/core-api/src/main/kotlin/org/grida/support/requestlogger/RequestLogContext.kt b/grida-core/core-api/src/main/kotlin/org/grida/support/requestlogger/RequestLogContext.kt index 61370594..a0a683ab 100644 --- a/grida-core/core-api/src/main/kotlin/org/grida/support/requestlogger/RequestLogContext.kt +++ b/grida-core/core-api/src/main/kotlin/org/grida/support/requestlogger/RequestLogContext.kt @@ -1,49 +1,34 @@ package org.grida.support.requestlogger +import com.fasterxml.jackson.databind.ObjectMapper import org.springframework.http.HttpStatus import org.springframework.web.util.ContentCachingRequestWrapper import org.springframework.web.util.ContentCachingResponseWrapper - -fun ContentCachingRequestWrapper.getRequestHeaders(): String { - val headers = this.headerNames.toList().map { "\"$it\":\"${this.getHeader(it)}\"" } - val joinedHeaders = headers.joinToString(", ") - return "[$joinedHeaders]" -} - -fun ContentCachingRequestWrapper.getRequestParams(): String { - val params = this.parameterNames.toList().map { "\"$it\":\"${this.getParameter(it)}\"" } - val joinedHeaders = params.joinToString(", ") - return "[$joinedHeaders]" -} - -fun String.trimSpaceAndNewLine(): String { - return this.replace("\\n".toRegex(), "").replace(" ", "") -} +import java.util.Enumeration data class RequestLogContext( val method: String, val uri: String, val status: HttpStatus, val elapsed: Double, - val requestHeaders: String, - val requestParams: String, + val requestHeaders: Map, + val requestParams: Map, val requestBody: String, val responseBody: String ) { - fun toLogMessage(): String { + fun toLogMessage(objectMapper: ObjectMapper): String { return """ | |$method $uri - $status ($elapsed s) |>> REQUEST HEADERS : $requestHeaders |>> REQUEST PARAMS : $requestParams - |>> REQUEST BODY : $requestBody - |>> RESPONSE BODY : $responseBody + |>> REQUEST BODY : ${objectMapper.readTree(requestBody.ifBlank { "{}" })} + |>> RESPONSE BODY : ${objectMapper.readTree(responseBody)} """.trimMargin() } companion object { - fun of( request: ContentCachingRequestWrapper, response: ContentCachingResponseWrapper, @@ -54,11 +39,22 @@ data class RequestLogContext( uri = request.requestURI, status = HttpStatus.valueOf(response.status), elapsed = elapsed, - requestHeaders = request.getRequestHeaders(), - requestParams = request.getRequestParams(), - requestBody = String(request.contentAsByteArray).trimSpaceAndNewLine(), - responseBody = String(response.contentAsByteArray).trimSpaceAndNewLine(), + requestHeaders = extractAsMap(request, request.headerNames), + requestParams = extractAsMap(request, request.parameterNames), + requestBody = String(request.contentAsByteArray), + responseBody = String(response.contentAsByteArray), ) } + + private fun extractAsMap( + request: ContentCachingRequestWrapper, + names: Enumeration + ): Map { + val result = mutableMapOf() + names.asIterator().forEach { + result.put(it, request.getHeader(it)) + } + return result + } } } diff --git a/grida-core/core-api/src/test/kotlin/org/grida/docs/diary/DiaryApiDocsTest.kt b/grida-core/core-api/src/test/kotlin/org/grida/docs/diary/DiaryApiDocsTest.kt index b01f6a3e..d48cb8ef 100644 --- a/grida-core/core-api/src/test/kotlin/org/grida/docs/diary/DiaryApiDocsTest.kt +++ b/grida-core/core-api/src/test/kotlin/org/grida/docs/diary/DiaryApiDocsTest.kt @@ -14,7 +14,9 @@ import org.grida.domain.diary.Diary import org.grida.domain.diary.DiaryScope import org.grida.domain.diary.DiaryService import org.grida.presentation.v1.diary.DiaryController +import org.grida.presentation.v1.diary.dto.DiaryModifyRequest import org.grida.presentation.v1.diary.dto.DiaryRequest +import org.grida.presentation.v1.diary.dto.DiaryScopeRequest import org.junit.jupiter.api.Test import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest import java.time.LocalDate @@ -90,4 +92,60 @@ class DiaryApiDocsTest( ) } } + + @Test + fun `일기 수정 API`() { + every { diaryService.modify(any(), any(), any(), any()) } returns 1L + + val api = api.patch("/api/v1/diary/{diaryId}", 1L) { + withBearerToken() + requestBody( + DiaryModifyRequest( + content = "수정할 일기 콘텐츠", + scope = "PUBLIC" + ) + ) + } + + documentFor(api, "modify-diary") { + summary("일기 생성 API") + requestHeaders( + "Authorization" whichMeans "인증 토큰" + ) + requestFields( + "content" isTypeOf STRING whichMeans "수정할 일기 콘텐츠", + "scope" isTypeOf ENUM(DiaryScope::class) whichMeans "일기 공개 범위" + ) + responseFields( + "data.id" isTypeOf NUMBER whichMeans "수정돤 일기 ID" + ) + } + } + + @Test + fun `일기 공개 범위 수정 API`() { + every { diaryService.modifyScope(any(), any(), any()) } returns 1L + + val api = api.patch("/api/v1/diary/{diaryId}/scope", 1L) { + withBearerToken() + requestBody( + DiaryScopeRequest( + scope = "PUBLIC" + ) + ) + } + + documentFor(api, "modify-diary") { + summary("일기 생성 API") + requestHeaders( + "Authorization" whichMeans "인증 토큰" + ) + requestFields( + "scope" isTypeOf ENUM(DiaryScope::class) whichMeans "일기 공개 범위" + ) + responseFields( + "data.id" isTypeOf NUMBER whichMeans "수정돤 일기 ID" + ) + } + } } diff --git a/grida-core/core-domain/src/main/kotlin/org/grida/domain/diary/DiaryAppender.kt b/grida-core/core-domain/src/main/kotlin/org/grida/domain/diary/DiaryAppender.kt index 3ec7ef99..7ac62447 100644 --- a/grida-core/core-domain/src/main/kotlin/org/grida/domain/diary/DiaryAppender.kt +++ b/grida-core/core-domain/src/main/kotlin/org/grida/domain/diary/DiaryAppender.kt @@ -2,6 +2,7 @@ package org.grida.domain.diary import org.grida.domain.user.UserReader import org.springframework.stereotype.Component +import org.springframework.transaction.annotation.Transactional @Component class DiaryAppender( @@ -9,6 +10,7 @@ class DiaryAppender( private val userReader: UserReader ) { + @Transactional fun append( diary: Diary ): Long { diff --git a/grida-core/core-domain/src/main/kotlin/org/grida/domain/diary/DiaryModifier.kt b/grida-core/core-domain/src/main/kotlin/org/grida/domain/diary/DiaryModifier.kt new file mode 100644 index 00000000..aebe7078 --- /dev/null +++ b/grida-core/core-domain/src/main/kotlin/org/grida/domain/diary/DiaryModifier.kt @@ -0,0 +1,38 @@ +package org.grida.domain.diary + +import org.springframework.stereotype.Component +import org.springframework.transaction.annotation.Transactional + +@Component +class DiaryModifier( + private val diaryRepository: DiaryRepository, + private val diaryReader: DiaryReader, + private val diaryValidator: DiaryValidator +) { + + @Transactional + fun modify( + diaryId: Long, + userId: Long, + content: String, + scope: DiaryScope + ) { + val diary = diaryReader.read(diaryId) + diaryValidator.validateIsOwner(diary, userId) + + diaryRepository.updateContent(diaryId, content) + diaryRepository.updateScope(diaryId, scope) + } + + @Transactional + fun modifyScope( + diaryId: Long, + userId: Long, + scope: DiaryScope + ) { + val diary = diaryReader.read(diaryId) + diaryValidator.validateIsOwner(diary, userId) + + diaryRepository.updateScope(diaryId, scope) + } +} \ No newline at end of file diff --git a/grida-core/core-domain/src/main/kotlin/org/grida/domain/diary/DiaryReader.kt b/grida-core/core-domain/src/main/kotlin/org/grida/domain/diary/DiaryReader.kt index a56950ae..fe4c54b2 100644 --- a/grida-core/core-domain/src/main/kotlin/org/grida/domain/diary/DiaryReader.kt +++ b/grida-core/core-domain/src/main/kotlin/org/grida/domain/diary/DiaryReader.kt @@ -9,7 +9,7 @@ class DiaryReader( ) { @Transactional(readOnly = true) - fun read(diaryId: Long, userId: Long): Diary { + fun read(diaryId: Long): Diary { return diaryRepository.findById(diaryId) } } \ No newline at end of file diff --git a/grida-core/core-domain/src/main/kotlin/org/grida/domain/diary/DiaryRepository.kt b/grida-core/core-domain/src/main/kotlin/org/grida/domain/diary/DiaryRepository.kt index ae974734..a92efc7c 100644 --- a/grida-core/core-domain/src/main/kotlin/org/grida/domain/diary/DiaryRepository.kt +++ b/grida-core/core-domain/src/main/kotlin/org/grida/domain/diary/DiaryRepository.kt @@ -10,4 +10,8 @@ interface DiaryRepository { fun findById(id: Long): Diary fun existsByUserIdAndTargetDate(userId: Long, targetDate: LocalDate): Boolean + + fun updateContent(diaryId: Long, content: String): Long + + fun updateScope(diaryId: Long, scope: DiaryScope): Long } \ No newline at end of file diff --git a/grida-core/core-domain/src/main/kotlin/org/grida/domain/diary/DiaryService.kt b/grida-core/core-domain/src/main/kotlin/org/grida/domain/diary/DiaryService.kt index be327dea..4a3fc74b 100644 --- a/grida-core/core-domain/src/main/kotlin/org/grida/domain/diary/DiaryService.kt +++ b/grida-core/core-domain/src/main/kotlin/org/grida/domain/diary/DiaryService.kt @@ -6,6 +6,7 @@ import org.springframework.stereotype.Service class DiaryService( private val diaryAppender: DiaryAppender, private val diaryReader: DiaryReader, + private val diaryModifier: DiaryModifier, private val diaryValidator: DiaryValidator ) { @@ -16,10 +17,32 @@ class DiaryService( return diaryAppender.append(diary) } - fun readDiary(diaryId: Long, userId: Long): Diary { - val diary = diaryReader.read(diaryId, userId) + fun readDiary( + diaryId: Long, + userId: Long + ): Diary { + val diary = diaryReader.read(diaryId) diaryValidator.validateCanAccess(diary, userId) return diary } + + fun modify( + diaryId: Long, + userId: Long, + content: String, + scope: DiaryScope + ): Long { + diaryModifier.modify(diaryId, userId, content, scope) + return diaryId + } + + fun modifyScope( + diaryId: Long, + userId: Long, + scope: DiaryScope + ): Long { + diaryModifier.modifyScope(diaryId, userId, scope) + return diaryId + } } \ No newline at end of file diff --git a/grida-core/core-domain/src/main/kotlin/org/grida/domain/diary/DiaryValidator.kt b/grida-core/core-domain/src/main/kotlin/org/grida/domain/diary/DiaryValidator.kt index 3d74221a..99a69ef6 100644 --- a/grida-core/core-domain/src/main/kotlin/org/grida/domain/diary/DiaryValidator.kt +++ b/grida-core/core-domain/src/main/kotlin/org/grida/domain/diary/DiaryValidator.kt @@ -43,7 +43,7 @@ class DiaryValidator( throw GridaException(AccessFailed) } - private fun validateIsOwner(diary: Diary, userId: Long) { + fun validateIsOwner(diary: Diary, userId: Long) { if (!diary.isOwner(userId)) { throw GridaException(AccessFailed) } diff --git a/grida-core/core-domain/src/main/kotlin/org/grida/domain/profileimage/ProfileImage.kt b/grida-core/core-domain/src/main/kotlin/org/grida/domain/profileimage/ProfileImage.kt index 9c454b80..ace4889a 100644 --- a/grida-core/core-domain/src/main/kotlin/org/grida/domain/profileimage/ProfileImage.kt +++ b/grida-core/core-domain/src/main/kotlin/org/grida/domain/profileimage/ProfileImage.kt @@ -11,12 +11,4 @@ data class ProfileImage( fun isOwner(accessorId: Long): Boolean { return userId == accessorId } - - fun activate(): ProfileImage { - return ProfileImage(id, userId, image.activate(), appearance) - } - - fun deactivate(): ProfileImage { - return ProfileImage(id, userId, image.deactivate(), appearance) - } } diff --git a/grida-core/core-domain/src/main/kotlin/org/grida/domain/profileimage/ProfileImageModifier.kt b/grida-core/core-domain/src/main/kotlin/org/grida/domain/profileimage/ProfileImageModifier.kt index d3cbadda..ae450493 100644 --- a/grida-core/core-domain/src/main/kotlin/org/grida/domain/profileimage/ProfileImageModifier.kt +++ b/grida-core/core-domain/src/main/kotlin/org/grida/domain/profileimage/ProfileImageModifier.kt @@ -19,13 +19,13 @@ class ProfileImageModifier( val profileImage = profileImageReader.read(profileImageId) profileImageValidator.validateIsOwner(profileImage, userId) - profileImageRepository.update(profileImage.activate()) + profileImageRepository.updateStatue(profileImageId, ImageStatus.ACTIVATE) } @Transactional fun modifyOriginalProfileImageAsDeactivate(userId: Long) { val originalProfileImage = profileImageReader.readActivateProfileImage(userId) - profileImageRepository.update(originalProfileImage.deactivate()) + profileImageRepository.updateStatue(originalProfileImage.id, ImageStatus.DEACTIVATE) } } diff --git a/grida-core/core-domain/src/main/kotlin/org/grida/domain/profileimage/ProfileImageRepository.kt b/grida-core/core-domain/src/main/kotlin/org/grida/domain/profileimage/ProfileImageRepository.kt index 7b9eeffe..f8af6940 100644 --- a/grida-core/core-domain/src/main/kotlin/org/grida/domain/profileimage/ProfileImageRepository.kt +++ b/grida-core/core-domain/src/main/kotlin/org/grida/domain/profileimage/ProfileImageRepository.kt @@ -15,5 +15,5 @@ interface ProfileImageRepository { fun existsByUserIdAndStatus(userId: Long, status: ImageStatus): Boolean - fun update(profileImage: ProfileImage): Long + fun updateStatue(profileImageId: Long, status: ImageStatus): Long } diff --git a/grida-database/database-rds/src/main/kotlin/org/grida/persistence/diary/DiaryEntity.kt b/grida-database/database-rds/src/main/kotlin/org/grida/persistence/diary/DiaryEntity.kt index efd42c1b..068f4c46 100644 --- a/grida-database/database-rds/src/main/kotlin/org/grida/persistence/diary/DiaryEntity.kt +++ b/grida-database/database-rds/src/main/kotlin/org/grida/persistence/diary/DiaryEntity.kt @@ -8,6 +8,8 @@ import org.grida.persistence.user.UserEntity import java.time.LocalDate import javax.persistence.Column import javax.persistence.Entity +import javax.persistence.EnumType +import javax.persistence.Enumerated import javax.persistence.FetchType import javax.persistence.GeneratedValue import javax.persistence.GenerationType @@ -26,9 +28,10 @@ class DiaryEntity( var targetDate: LocalDate, + @Column(length = 4095) var content: String, - @Column(length = 4095) + @Enumerated(EnumType.STRING) var scope: DiaryScope, @ManyToOne(fetch = FetchType.LAZY) @@ -47,6 +50,14 @@ class DiaryEntity( ) } + fun updateContent(content: String) { + this.content = content + } + + fun updateScope(scope: DiaryScope) { + this.scope = scope + } + companion object { fun from( diary: Diary, diff --git a/grida-database/database-rds/src/main/kotlin/org/grida/persistence/diary/DiaryEntityRepository.kt b/grida-database/database-rds/src/main/kotlin/org/grida/persistence/diary/DiaryEntityRepository.kt index da91d8c6..7fda38ec 100644 --- a/grida-database/database-rds/src/main/kotlin/org/grida/persistence/diary/DiaryEntityRepository.kt +++ b/grida-database/database-rds/src/main/kotlin/org/grida/persistence/diary/DiaryEntityRepository.kt @@ -2,6 +2,7 @@ package org.grida.persistence.diary import org.grida.domain.diary.Diary import org.grida.domain.diary.DiaryRepository +import org.grida.domain.diary.DiaryScope import org.grida.domain.user.User import org.springframework.stereotype.Repository import org.springframework.transaction.annotation.Transactional @@ -33,4 +34,18 @@ class DiaryEntityRepository( ): Boolean { return diaryJpaEntityRepository.existsByUserIdAndTargetDate(userId, targetDate) } + + @Transactional + override fun updateContent(diaryId: Long, content: String): Long { + val diaryEntity = diaryJpaEntityRepository.findByIdOrException(diaryId) + diaryEntity.updateContent(content) + return diaryEntity.id + } + + @Transactional + override fun updateScope(diaryId: Long, scope: DiaryScope): Long { + val diaryEntity = diaryJpaEntityRepository.findByIdOrException(diaryId) + diaryEntity.updateScope(scope) + return diaryEntity.id + } } \ No newline at end of file diff --git a/grida-database/database-rds/src/main/kotlin/org/grida/persistence/profileimage/ProfileImageEntity.kt b/grida-database/database-rds/src/main/kotlin/org/grida/persistence/profileimage/ProfileImageEntity.kt index bbacfc14..dc392bcc 100644 --- a/grida-database/database-rds/src/main/kotlin/org/grida/persistence/profileimage/ProfileImageEntity.kt +++ b/grida-database/database-rds/src/main/kotlin/org/grida/persistence/profileimage/ProfileImageEntity.kt @@ -69,14 +69,8 @@ class ProfileImageEntity( ) } - fun update(profileImage: ProfileImage) { - this.imageUrl = profileImage.image.url - this.status = profileImage.image.status - this.gender = profileImage.appearance.gender - this.age = profileImage.appearance.age - this.hairStyle = profileImage.appearance.hairStyle - this.glasses = profileImage.appearance.glasses - this.bodyShape = profileImage.appearance.bodyShape + fun updateStatue(status: ImageStatus) { + this.status = status } companion object { diff --git a/grida-database/database-rds/src/main/kotlin/org/grida/persistence/profileimage/ProfileImageEntityRepository.kt b/grida-database/database-rds/src/main/kotlin/org/grida/persistence/profileimage/ProfileImageEntityRepository.kt index 35f2a9f4..96ea7537 100644 --- a/grida-database/database-rds/src/main/kotlin/org/grida/persistence/profileimage/ProfileImageEntityRepository.kt +++ b/grida-database/database-rds/src/main/kotlin/org/grida/persistence/profileimage/ProfileImageEntityRepository.kt @@ -44,9 +44,12 @@ class ProfileImageEntityRepository( } @Transactional - override fun update(profileImage: ProfileImage): Long { - val profileImageEntity = profileImageJpaEntityRepository.findByIdOrException(profileImage.id) - profileImageEntity.update(profileImage) + override fun updateStatue( + profileImageId: Long, + status: ImageStatus + ): Long { + val profileImageEntity = profileImageJpaEntityRepository.findByIdOrException(profileImageId) + profileImageEntity.updateStatue(status) return profileImageEntity.id } }