Skip to content

Commit

Permalink
✨feature: feed save 등 기타 문제 수정, 코드 정리
Browse files Browse the repository at this point in the history
  • Loading branch information
daehyeon authored and kohmlab committed Mar 8, 2023
1 parent 01046d2 commit c9f2786
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ class FeedHandler(
private val findUseCase: FindUseCase,
private val deleteUseCase: DeleteUseCase
) {
// fun findById(request: ServerRequest): Mono<ServerResponse> =
// findUseCase.findById(request.pathVariable("feedId").orElseThrow { throw BadRequestException("잘못된 요청입니다.") }.toLong())
// .flatMap{BaseResponse().success(it)}

fun findById(request: ServerRequest): Mono<ServerResponse> =
findUseCase.findById(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@ package com.nexters.pimo.feed.adapter.out.persistence

import com.nexters.pimo.feed.domain.Clap
import org.springframework.data.repository.reactive.ReactiveCrudRepository
import reactor.core.publisher.Flux

interface ClapRepository: ReactiveCrudRepository<Clap, Long> {
fun findAllByFeedId(feedId: Long): Flux<Clap>
}
interface ClapRepository: ReactiveCrudRepository<Clap, Long>
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ package com.nexters.pimo.feed.adapter.out.persistence

import com.nexters.pimo.feed.domain.Content
import org.springframework.data.repository.reactive.ReactiveCrudRepository
import reactor.core.publisher.Flux
import reactor.core.publisher.Mono

interface ContentRepository : ReactiveCrudRepository<Content, Long> {
fun findAllByFeedId(feedId: Long): Flux<Content>
fun deleteAllByFeedId(feedId: Long): Mono<Boolean>
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class FeedPersistenceAdapter(
feedRepository.saveFeed(input.userId).map {
input.contents.map { content ->
Content(
// feedId = it["id"] as Long,
feedId = it,
caption = content.caption,
url = content.url
Expand All @@ -65,7 +64,6 @@ class FeedPersistenceAdapter(
feedRepository.findByIdWithContentAndClap(feedId)
.switchIfEmpty { throw BadRequestException("피드가 존재하지 않습니다.") }
.flatMap { feedRepository.deleteByIdAndStatus(feedId, "0") }
// .flatMap { Mono.just(true) }

override fun clap(feedId: Long, userId: String): Mono<Boolean> =
feedRepository.findByIdWithContentAndClap(feedId)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.nexters.pimo.feed.adapter.out.persistence

import com.nexters.pimo.feed.domain.Feed
import com.nexters.pimo.feed.domain.Report
import org.springframework.data.repository.reactive.ReactiveCrudRepository

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.nexters.pimo.feed.application.dto

import com.nexters.pimo.feed.domain.Content
import java.io.Serializable

data class FeedDto(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.nexters.pimo.feed.application.port.out

import com.nexters.pimo.feed.application.dto.FeedDto
import com.nexters.pimo.feed.domain.Clap
import reactor.core.publisher.Flux
import reactor.core.publisher.Mono

Expand Down
3 changes: 0 additions & 3 deletions src/main/kotlin/com/nexters/pimo/feed/domain/Content.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.nexters.pimo.feed.domain

import com.nexters.pimo.common.constants.CommCode
import com.nexters.pimo.feed.application.dto.ContentDto
import jakarta.persistence.*
import org.springframework.data.annotation.Id
Expand Down Expand Up @@ -32,8 +31,6 @@ data class Content(
@Column("updatedAt")
val updatedAt: LocalDateTime = LocalDateTime.now(),

// @Column("deletedAt")
// val deletedAt: LocalDateTime? = null
) {
fun toDto(): ContentDto {
return ContentDto(
Expand Down
2 changes: 0 additions & 2 deletions src/main/kotlin/com/nexters/pimo/feed/domain/Feed.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.nexters.pimo.feed.domain

import com.nexters.pimo.common.constants.CommCode
import com.nexters.pimo.feed.adapter.`in`.web.dto.ContentInput
import com.nexters.pimo.feed.application.dto.FeedDto
import jakarta.persistence.*
import org.springframework.data.annotation.Id
Expand Down

0 comments on commit c9f2786

Please sign in to comment.