diff --git a/src/main/kotlin/org/meogo/domain/post/domain/Post.kt b/src/main/kotlin/org/meogo/domain/post/domain/Post.kt new file mode 100644 index 0000000..2d6fc71 --- /dev/null +++ b/src/main/kotlin/org/meogo/domain/post/domain/Post.kt @@ -0,0 +1,42 @@ +package org.meogo.domain.post.domain + +import java.time.LocalDateTime +import java.util.UUID +import javax.persistence.Column +import javax.persistence.Entity +import javax.persistence.GeneratedValue +import javax.persistence.GenerationType +import javax.persistence.Id + +@Entity +class Post( + + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Id + val id: Long = 0, + + @Column(nullable = false) + val title: String, + + @Column(nullable = false) + val content: String, + + @Column(name = "user_id", columnDefinition = "BINARY(16)") + val userId: UUID, + + @Column(nullable = false) + var good: Int = 0, + + @Column(nullable = false) + val date: LocalDateTime, + + @Column(name = "school_id") + val schoolId: Int?, + + @Column(name = "key_word") + val keyWord: String? +) { + fun addGood() { + this.good += 1 + } +} diff --git a/src/main/kotlin/org/meogo/domain/post/domain/PostRepository.kt b/src/main/kotlin/org/meogo/domain/post/domain/PostRepository.kt new file mode 100644 index 0000000..7b5770f --- /dev/null +++ b/src/main/kotlin/org/meogo/domain/post/domain/PostRepository.kt @@ -0,0 +1,10 @@ +package org.meogo.domain.post.domain + +import org.springframework.data.repository.Repository + +interface PostRepository : Repository { + + fun save(post: Post) + + fun findAll(): List +} diff --git a/src/main/kotlin/org/meogo/domain/review/repository/ReviewRepository.kt b/src/main/kotlin/org/meogo/domain/review/domain/ReviewRepository.kt similarity index 79% rename from src/main/kotlin/org/meogo/domain/review/repository/ReviewRepository.kt rename to src/main/kotlin/org/meogo/domain/review/domain/ReviewRepository.kt index ddc0e87..0405602 100644 --- a/src/main/kotlin/org/meogo/domain/review/repository/ReviewRepository.kt +++ b/src/main/kotlin/org/meogo/domain/review/domain/ReviewRepository.kt @@ -1,6 +1,5 @@ -package org.meogo.domain.review.repository +package org.meogo.domain.review.domain -import org.meogo.domain.review.domain.Review import org.springframework.data.repository.Repository import java.util.UUID diff --git a/src/main/kotlin/org/meogo/domain/review/service/CreateReviewService.kt b/src/main/kotlin/org/meogo/domain/review/service/CreateReviewService.kt index c5e045e..5f37e1f 100644 --- a/src/main/kotlin/org/meogo/domain/review/service/CreateReviewService.kt +++ b/src/main/kotlin/org/meogo/domain/review/service/CreateReviewService.kt @@ -1,8 +1,8 @@ package org.meogo.domain.review.service import org.meogo.domain.review.domain.Review +import org.meogo.domain.review.domain.ReviewRepository import org.meogo.domain.review.presentation.dto.request.ReviewRequest -import org.meogo.domain.review.repository.ReviewRepository import org.meogo.domain.user.exception.UserNotFoundException import org.meogo.domain.user.facade.UserFacade import org.springframework.stereotype.Service diff --git a/src/main/kotlin/org/meogo/domain/review/service/DeleteReviewService.kt b/src/main/kotlin/org/meogo/domain/review/service/DeleteReviewService.kt index d04fcb7..5d64611 100644 --- a/src/main/kotlin/org/meogo/domain/review/service/DeleteReviewService.kt +++ b/src/main/kotlin/org/meogo/domain/review/service/DeleteReviewService.kt @@ -1,11 +1,11 @@ package org.meogo.domain.review.service +import org.meogo.domain.review.domain.ReviewRepository import org.meogo.domain.review.exception.ReviewNotFoundException -import org.meogo.domain.review.repository.ReviewRepository +import org.meogo.domain.user.domain.UserRepository import org.meogo.domain.user.exception.UserMisMatchException import org.meogo.domain.user.exception.UserNotFoundException import org.meogo.domain.user.facade.UserFacade -import org.meogo.domain.user.repository.UserRepository import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional diff --git a/src/main/kotlin/org/meogo/domain/review/service/ModifyReviewService.kt b/src/main/kotlin/org/meogo/domain/review/service/ModifyReviewService.kt index 6ae17c7..762dc7f 100644 --- a/src/main/kotlin/org/meogo/domain/review/service/ModifyReviewService.kt +++ b/src/main/kotlin/org/meogo/domain/review/service/ModifyReviewService.kt @@ -1,8 +1,8 @@ package org.meogo.domain.review.service +import org.meogo.domain.review.domain.ReviewRepository import org.meogo.domain.review.exception.ReviewNotFoundException import org.meogo.domain.review.presentation.dto.request.ModifyReviewRequest -import org.meogo.domain.review.repository.ReviewRepository import org.meogo.domain.user.exception.UserMisMatchException import org.meogo.domain.user.exception.UserNotFoundException import org.meogo.domain.user.facade.UserFacade diff --git a/src/main/kotlin/org/meogo/domain/review/service/QueryAllBySchoolIdService.kt b/src/main/kotlin/org/meogo/domain/review/service/QueryAllBySchoolIdService.kt index d43581b..e1dcb67 100644 --- a/src/main/kotlin/org/meogo/domain/review/service/QueryAllBySchoolIdService.kt +++ b/src/main/kotlin/org/meogo/domain/review/service/QueryAllBySchoolIdService.kt @@ -1,7 +1,7 @@ package org.meogo.domain.review.service +import org.meogo.domain.review.domain.ReviewRepository import org.meogo.domain.review.presentation.dto.response.ReviewResponse -import org.meogo.domain.review.repository.ReviewRepository import org.meogo.domain.user.facade.UserFacade import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional diff --git a/src/main/kotlin/org/meogo/domain/review/service/QueryReviewPictureService.kt b/src/main/kotlin/org/meogo/domain/review/service/QueryReviewPictureService.kt index 3214472..740e8ed 100644 --- a/src/main/kotlin/org/meogo/domain/review/service/QueryReviewPictureService.kt +++ b/src/main/kotlin/org/meogo/domain/review/service/QueryReviewPictureService.kt @@ -1,7 +1,7 @@ package org.meogo.domain.review.service +import org.meogo.domain.review.domain.ReviewRepository import org.meogo.domain.review.presentation.dto.response.ReviewPictureResponse -import org.meogo.domain.review.repository.ReviewRepository import org.springframework.stereotype.Service import org.springframework.transaction.annotation.Transactional diff --git a/src/main/kotlin/org/meogo/domain/user/repository/UserRepository.kt b/src/main/kotlin/org/meogo/domain/user/domain/UserRepository.kt similarity index 77% rename from src/main/kotlin/org/meogo/domain/user/repository/UserRepository.kt rename to src/main/kotlin/org/meogo/domain/user/domain/UserRepository.kt index 0dda506..0bd6a7b 100644 --- a/src/main/kotlin/org/meogo/domain/user/repository/UserRepository.kt +++ b/src/main/kotlin/org/meogo/domain/user/domain/UserRepository.kt @@ -1,6 +1,5 @@ -package org.meogo.domain.user.repository +package org.meogo.domain.user.domain -import org.meogo.domain.user.domain.User import org.springframework.data.jpa.repository.JpaRepository import java.util.UUID diff --git a/src/main/kotlin/org/meogo/domain/user/facade/UserFacade.kt b/src/main/kotlin/org/meogo/domain/user/facade/UserFacade.kt index 3d6af5b..96c6db3 100644 --- a/src/main/kotlin/org/meogo/domain/user/facade/UserFacade.kt +++ b/src/main/kotlin/org/meogo/domain/user/facade/UserFacade.kt @@ -1,8 +1,8 @@ package org.meogo.domain.user.facade import org.meogo.domain.user.domain.User +import org.meogo.domain.user.domain.UserRepository import org.meogo.domain.user.exception.UserNotFoundException -import org.meogo.domain.user.repository.UserRepository import org.springframework.security.core.context.SecurityContextHolder import org.springframework.stereotype.Component import java.util.UUID diff --git a/src/main/kotlin/org/meogo/domain/user/service/CheckAccountIdService.kt b/src/main/kotlin/org/meogo/domain/user/service/CheckAccountIdService.kt index b8afa47..bf16884 100644 --- a/src/main/kotlin/org/meogo/domain/user/service/CheckAccountIdService.kt +++ b/src/main/kotlin/org/meogo/domain/user/service/CheckAccountIdService.kt @@ -1,7 +1,7 @@ package org.meogo.domain.user.service +import org.meogo.domain.user.domain.UserRepository import org.meogo.domain.user.presentation.dto.request.UserCheckRequest -import org.meogo.domain.user.repository.UserRepository import org.springframework.stereotype.Service @Service diff --git a/src/main/kotlin/org/meogo/domain/user/service/UserSignInService.kt b/src/main/kotlin/org/meogo/domain/user/service/UserSignInService.kt index 4f24780..004a4ab 100644 --- a/src/main/kotlin/org/meogo/domain/user/service/UserSignInService.kt +++ b/src/main/kotlin/org/meogo/domain/user/service/UserSignInService.kt @@ -1,9 +1,9 @@ package org.meogo.domain.user.service +import org.meogo.domain.user.domain.UserRepository import org.meogo.domain.user.exception.PasswordMismatchException import org.meogo.domain.user.exception.UserNotFoundException import org.meogo.domain.user.presentation.dto.request.UserSignInRequest -import org.meogo.domain.user.repository.UserRepository import org.meogo.global.jwt.JwtTokenProvider import org.meogo.global.jwt.dto.TokenResponse import org.springframework.security.crypto.password.PasswordEncoder diff --git a/src/main/kotlin/org/meogo/domain/user/service/UserSignUpService.kt b/src/main/kotlin/org/meogo/domain/user/service/UserSignUpService.kt index 974ad01..9cecd89 100644 --- a/src/main/kotlin/org/meogo/domain/user/service/UserSignUpService.kt +++ b/src/main/kotlin/org/meogo/domain/user/service/UserSignUpService.kt @@ -1,9 +1,9 @@ package org.meogo.domain.user.service import org.meogo.domain.user.domain.User +import org.meogo.domain.user.domain.UserRepository import org.meogo.domain.user.domain.UserRole import org.meogo.domain.user.presentation.dto.request.UserSignUpRequest -import org.meogo.domain.user.repository.UserRepository import org.meogo.global.jwt.JwtTokenProvider import org.meogo.global.jwt.dto.TokenResponse import org.springframework.security.crypto.password.PasswordEncoder