Skip to content

Commit

Permalink
🐛 Fix Service(Image, Article, Feed, Auction) to get PresignedUrl with…
Browse files Browse the repository at this point in the history
… no delay
  • Loading branch information
alpakar02 committed Jan 31, 2025
1 parent 1540c0e commit 0c4f517
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## 팀원 소개

- **김정훈**: 소셜 로그인, 환경 설정, 보안 설정
- **박원석**:
- **박원석**: aws 담당, 마이페이지, 채팅, 경매
- **이준용**:

---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ArticleService(
private val articleRepository: ArticleRepository,
private val articleLikesRepository: ArticleLikesRepository,
private val userService: UserService,
@Lazy private val imageService: ImageService,
private val imageService: ImageService,
@Lazy private val chatRoomService: ChatRoomService,
) {
@Transactional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import com.toyProject7.karrot.auction.persistence.AuctionRepository
import com.toyProject7.karrot.image.persistence.ImageUrlEntity
import com.toyProject7.karrot.image.service.ImageService
import com.toyProject7.karrot.user.service.UserService
import org.springframework.context.annotation.Lazy
import org.springframework.data.repository.findByIdOrNull
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
Expand All @@ -29,7 +28,7 @@ class AuctionService(
private val auctionRepository: AuctionRepository,
private val auctionLikesRepository: AuctionLikesRepository,
private val userService: UserService,
@Lazy private val imageService: ImageService,
private val imageService: ImageService,
) {
@Transactional
fun updatePrice(auctionMessage: AuctionMessage): AuctionMessage {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class FeedService(
private val feedLikesRepository: FeedLikesRepository,
private val userService: UserService,
@Lazy private val commentService: CommentService,
@Lazy private val imageService: ImageService,
private val imageService: ImageService,
) {
@Transactional
fun postFeed(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package com.toyProject7.karrot.image.service

import com.toyProject7.karrot.article.service.ArticleService
import com.toyProject7.karrot.auction.service.AuctionService
import com.toyProject7.karrot.feed.service.FeedService
import com.toyProject7.karrot.article.persistence.ArticleRepository
import com.toyProject7.karrot.auction.persistence.AuctionRepository
import com.toyProject7.karrot.feed.persistence.FeedRepository
import com.toyProject7.karrot.image.ImageDeleteException
import com.toyProject7.karrot.image.ImagePresignedUrlCreateException
import com.toyProject7.karrot.image.ImageS3UrlCreateException
import com.toyProject7.karrot.image.persistence.ImageUrlEntity
import com.toyProject7.karrot.image.persistence.ImageUrlRepository
import org.springframework.data.repository.findByIdOrNull
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional
import software.amazon.awssdk.services.s3.S3Client
Expand All @@ -25,9 +26,9 @@ class ImageService(
private val s3Client: S3Client,
private val s3Presigner: S3Presigner,
private val imageUrlRepository: ImageUrlRepository,
private val articleService: ArticleService,
private val feedService: FeedService,
private val auctionService: AuctionService,
private val articleRepository: ArticleRepository,
private val feedRepository: FeedRepository,
private val auctionRepository: AuctionRepository,
) {
@Transactional
fun postImageUrl(
Expand All @@ -41,13 +42,13 @@ class ImageService(
)
when (type) {
"article" -> {
imageUrlEntity.article = articleService.getArticleEntityById(typeId)
imageUrlEntity.article = articleRepository.findByIdOrNull(typeId)
}
"feed" -> {
imageUrlEntity.feed = feedService.getFeedEntityById(typeId)
imageUrlEntity.feed = feedRepository.findByIdOrNull(typeId)
}
"auction" -> {
imageUrlEntity.auction = auctionService.getAuctionEntityById(typeId)
imageUrlEntity.auction = auctionRepository.findByIdOrNull(typeId)
}
}
imageUrlRepository.save(imageUrlEntity)
Expand Down

0 comments on commit 0c4f517

Please sign in to comment.