Skip to content

Commit

Permalink
[#132] fix : compile error fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ji-Ha committed Jun 25, 2022
1 parent fae6cab commit a3e444a
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.yapp.web2.domain.account.controller
import com.amazonaws.services.s3.model.AmazonS3Exception
import com.yapp.web2.config.S3Uploader
import com.yapp.web2.domain.account.entity.Account
import com.yapp.web2.domain.account.entity.AccountRequestDto
import com.yapp.web2.domain.account.service.AccountService
import com.yapp.web2.security.jwt.TokenDto
import com.yapp.web2.util.ControllerUtil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.yapp.web2.domain.folder.entity.AccountFolder
import com.yapp.web2.security.jwt.TokenDto
import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty
import org.springframework.transaction.annotation.Transactional
import javax.persistence.*
import javax.validation.constraints.NotBlank
import javax.validation.constraints.NotEmpty
Expand Down Expand Up @@ -126,7 +127,6 @@ class Account(
example = "dOOUnnp-iBs:APA91bF1i7mobIF7kEhi3aVlFuv6A5--P1S..."
)
@field: NotEmpty(message = "FCM 토큰을 입력해주세요")
@ApiModelProperty(value = "FCM 토큰", required = true, example = "dOOUnnp-iBs:APA91bF1i7mobIF7kEhi3aVlFuv6A5--P1S...")
val fcmToken: String
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ class AccountService(
private val folderService: FolderService,
private val accountRepository: AccountRepository,
private val jwtProvider: JwtProvider,
private val s3Uploader: S3Uploader,
private val aes256Util: AES256Util
private val aes256Util: AES256Util,
private val s3Uploader: S3Uploader,
private val passwordEncoder: PasswordEncoder,
private val mailSender: JavaMailSender
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ import java.time.LocalDateTime

@Document(collection = "bookmarkInterface")
abstract class BookmarkInterface() {
companion object {
fun copyBookmark(account: Account, bookmark: BookmarkInterface): PersonalBookmark {
return PersonalBookmark(
account,
bookmark.link,
bookmark.title,
bookmark.image,
bookmark.description,
bookmark.id
)
}
}

@Id
var id: String = ""
var userId: Long? = null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
package com.yapp.web2.domain.bookmark.entity

import com.yapp.web2.domain.account.entity.Account
import java.time.LocalDate

class BookmarkUtils {
companion object {
fun sharedBookmarkToPersonalBookmark(sharedBookmark: SharedBookmark, account: Account): PersonalBookmark {
val bookmark = PersonalBookmark()
bookmark.parentBookmarkId = sharedBookmark.id
bookmark.userId = account.id
bookmark.link = sharedBookmark.link
bookmark.title = sharedBookmark.title
bookmark.description = sharedBookmark.description
bookmark.image = sharedBookmark.image
return bookmark
return PersonalBookmark(
account,
sharedBookmark.link,
sharedBookmark.title,
sharedBookmark.image,
sharedBookmark.description,
true
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.yapp.web2.domain.bookmark.service

import com.yapp.web2.domain.bookmark.entity.Bookmark
import com.yapp.web2.domain.bookmark.repository.BookmarkRepository
import com.yapp.web2.domain.folder.repository.FolderRepository
import com.yapp.web2.security.jwt.JwtProvider
import com.yapp.web2.util.AES256Util
import org.springframework.data.domain.Page
Expand All @@ -15,7 +14,7 @@ import java.time.LocalDate
class BookmarkPageService(
private val bookmarkRepository: BookmarkRepository,
private val jwtProvider: JwtProvider,
private val aeS256Util: AES256Util
private val aes256Util: AES256Util
) {
@Transactional(readOnly = true)
fun getAllPageByFolderId(folderId: Long, pageable: Pageable, remind: Boolean): Page<Bookmark> {
Expand Down Expand Up @@ -58,7 +57,8 @@ class BookmarkPageService(
}

fun getAllPageByEncryptFolderId(token: String, pageable: Pageable): Page<Bookmark> {
val folderIdByString = aeS256Util.decrypt(token)
// TODO: 2022/05/14 복호화 후에 id가 제대로 나왔는지 확인하는 로직 필요
val folderIdByString = aes256Util.decrypt(token)
return bookmarkRepository.findAllByFolderIdAndDeleteTimeIsNull(folderIdByString.toLong(), pageable)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import com.yapp.web2.domain.bookmark.entity.BookmarkInterface
import com.yapp.web2.domain.bookmark.repository.BookmarkInterfaceRepository
import com.yapp.web2.domain.folder.entity.Folder
import com.yapp.web2.domain.folder.repository.FolderRepository
import com.yapp.web2.exception.ObjectNotFoundException
import com.yapp.web2.exception.custom.BookmarkNotFoundException
import com.yapp.web2.exception.custom.FolderNotFoundException
import com.yapp.web2.exception.custom.ObjectNotFoundException
import com.yapp.web2.exception.custom.SameBookmarkException
import com.yapp.web2.security.jwt.JwtProvider
import org.springframework.stereotype.Service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import com.yapp.web2.domain.bookmark.repository.BookmarkInterfaceRepository
import com.yapp.web2.domain.folder.entity.Authority
import com.yapp.web2.domain.folder.entity.Folder
import com.yapp.web2.domain.folder.repository.FolderRepository
import com.yapp.web2.exception.ObjectNotFoundException
import com.yapp.web2.exception.custom.*
import com.yapp.web2.security.jwt.JwtProvider
import org.springframework.stereotype.Service
Expand Down
11 changes: 11 additions & 0 deletions src/main/kotlin/com/yapp/web2/domain/folder/entity/Folder.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonManagedReference
import com.yapp.web2.domain.BaseTimeEntity
import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty
import org.springframework.transaction.annotation.Transactional
import javax.persistence.*
import javax.validation.constraints.NotEmpty
import javax.validation.constraints.PositiveOrZero
Expand Down Expand Up @@ -37,6 +38,11 @@ class Folder(
@OneToMany(mappedBy = "folder", cascade = [CascadeType.ALL])
var folders: MutableList<AccountFolder>? = mutableListOf()

// TODO: 2022/05/06 공유 북마크인지 확인하기 위해서 추가한 컬럼
var share: Boolean = false

var rootFolderId: Long? = null

companion object {
fun dtoToEntity(dto: FolderCreateRequest, index: Int): Folder {
return dtoToEntity(dto, null, index)
Expand Down Expand Up @@ -163,4 +169,9 @@ class Folder(
fun updateIndex(nextIndex: Int) {
this.index = nextIndex
}

@Transactional
fun updateBookmarkCount(count: Int) {
this.bookmarkCount += count
}
}

0 comments on commit a3e444a

Please sign in to comment.