Skip to content

Commit

Permalink
Merge pull request #349 from ODOICHON/qa
Browse files Browse the repository at this point in the history
Qa반영 릴리즈
  • Loading branch information
dldmsql committed Feb 9, 2024
2 parents c692591 + 240a241 commit f405247
Show file tree
Hide file tree
Showing 67 changed files with 6,403 additions and 5,095 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ out/
src/main/resources/application-secret.yml
src/test/resources/application-test.yml
src/main/resources/logback-spring.xml
*.log
5 changes: 5 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ dependencies {
// Database
runtimeOnly("com.mysql:mysql-connector-j")
implementation("org.springframework.boot:spring-boot-starter-data-redis")
implementation ("com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.9.0")
// Jwt
implementation("io.jsonwebtoken:jjwt-api:0.11.2")
runtimeOnly("io.jsonwebtoken:jjwt-impl:0.11.2")
Expand All @@ -81,6 +82,10 @@ dependencies {
implementation("net.sf.ehcache:ehcache:2.10.6")
implementation("javax.cache:cache-api:1.1.0")
implementation ("com.fasterxml.jackson.core:jackson-databind")
// implementation("com.slack.api:slack-api-client:1.8.1")
if(project.hasProperty("dev") || project.hasProperty("local")) {
implementation("com.github.gavlyukovskiy:p6spy-spring-boot-starter:1.9.0")
}
}

tasks.withType<KotlinCompile> {
Expand Down
53 changes: 52 additions & 1 deletion src/docs/asciidoc/user.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,30 @@ include::{snippets}/update-user/http-request.adoc[]
===== Response
include::{snippets}/update-user/http-response.adoc[]

*회원탈퇴 시, 사용되는 enum*

|===
|enum 값|Description

|ROW_USE
|이용빈도 낮음

|RE_JOIN
|재가입

|INSUFFICIENT_CONTENT
|콘텐츠 및 정보 부족

|PERSONAL_PROTECTION
|개인 정보 보호

|ETC
|기타

|===

위의 표에 나와 있는 description을 사용자가 선택하게 됩니다. 그 description을 그대로 복붙해서 요청 body에 넣어주시면 됩니다.

=== 13. 유저 탈퇴
===== Request
include::{snippets}/withdrawal/http-request.adoc[]
Expand Down Expand Up @@ -202,4 +226,31 @@ include::{snippets}/check-email/http-response.adoc[]
===== Request
include::{snippets}/userName-check/http-request.adoc[]
===== Response
include::{snippets}/userName-check/http-response.adoc[]
include::{snippets}/userName-check/http-response.adoc[]

=== 17. 이메일 수정

이메일 수정 시, 이메일 인증을 거쳐야 합니다.

===== Request
include::{snippets}/update-email/http-request.adoc[]
===== Response
include::{snippets}/update-email/http-response.adoc[]


=== 18. 전화번호 수정

전화번호 수정 시, 전화번호 인증을 거쳐야 합니다.

===== Request
include::{snippets}/update-phone-num/http-request.adoc[]
include::{snippets}/update-phone-num/request-fields.adoc[]
===== Response
include::{snippets}/update-phone-num/http-response.adoc[]

=== 19. 비밀번호 확인

===== Request
include::{snippets}/password-check/http-request.adoc[]
===== Response
include::{snippets}/password-check/http-response.adoc[]
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,22 @@ class AdminUserController(

return "user/withdrawalDetail"
}

@GetMapping("/manage")
fun getUserManage(
@ModelAttribute("searchForm") adminUserSearch: AdminUserWithdrawalSearch,
model: Model,
@PageableDefault(size=10, page=0) pageable: Pageable
): String {
// 승인 요청된 게시글 목록 데이터
val result = adminUserService.getUserWithSearchForm(adminUserSearch, pageable)
model.addAttribute("userList", result)

// 페이징 데이터
val pageCom = pageable.pageNumber / 5
model.addAttribute("pageCom", pageCom)
model.addAttribute("filterList", UserSearchFilter.values())

return "user/userManager"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
package com.example.jhouse_server.admin.user.dto

import com.example.jhouse_server.domain.user.entity.Age
import com.example.jhouse_server.domain.user.entity.JoinPath
import com.example.jhouse_server.domain.user.entity.Term
import com.example.jhouse_server.domain.user.entity.UserType
import com.querydsl.core.annotations.QueryProjection
import org.springframework.format.annotation.DateTimeFormat
import java.time.LocalDateTime

/**
* ============================================================================================
* AdminAgentSearch -- 공인중개사 검색 조건
Expand Down Expand Up @@ -54,5 +62,42 @@ enum class AgentSearchFilter(val value: String) {
}

enum class UserSearchFilter(val value: String){
NICKNAME("이름")
NICKNAME("닉네임")
}

data class AdminUserList @QueryProjection constructor(
val id: Long,
val nickName: String,
val email: String,
val userType: UserType,
val phoneNum : String,
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
// @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Seoul")
val createdAt : LocalDateTime,
val age: String,
val joinPath: Set<String>,
val term : Set<String>,
){
fun getAgeValues() : String{
return Age.valueOf(age).value ?: ""
}
fun getJoinPathValues(): Set<String> {
return joinPath.map { JoinPath.valueOf(it)?.value }.toSet() as Set<String>
}

fun getTermValues(): Set<String> {
return term.map { Term.valueOf(it)?.value }.toSet() as Set<String>
}

}
data class AdminUserQueryResult(
val id: Long,
val nickName: String,
val email: String,
val userType: UserType,
val phoneNum : String,
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
// @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Seoul")
val createdAt : LocalDateTime,
val age: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ package com.example.jhouse_server.admin.user.service


import com.example.jhouse_server.admin.user.dto.AdminJoinAgentList
import com.example.jhouse_server.admin.user.dto.AdminUserList
import com.example.jhouse_server.admin.user.dto.AdminUserWithdrawalSearch
import com.example.jhouse_server.admin.user.dto.AdminWithdrawalList
import com.example.jhouse_server.domain.user.entity.agent.AgentStatus
import com.example.jhouse_server.domain.user.repository.AgentRepository
import com.example.jhouse_server.domain.user.repository.UserRepository
import org.springframework.data.domain.Page
import org.springframework.data.domain.Pageable
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional

Expand Down Expand Up @@ -39,4 +43,11 @@ class AdminUserService(
findUsers?.forEach { u -> u.withdrawalUser() }
}

fun getUserWithSearchForm(
adminUserSearch: AdminUserWithdrawalSearch,
pageable: Pageable
): Page<AdminUserList> {
return userRepository.getUserWithSearchForm(adminUserSearch, pageable)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.example.jhouse_server.domain.board.controller
import com.example.jhouse_server.domain.board.*
import com.example.jhouse_server.domain.board.dto.BoardMyPageResDto
import com.example.jhouse_server.domain.board.dto.BoardResDto
import com.example.jhouse_server.domain.board.dto.CommentMyPageResDto
import com.example.jhouse_server.domain.board.service.BoardService
import com.example.jhouse_server.domain.user.entity.User
import com.example.jhouse_server.global.annotation.Auth
Expand Down Expand Up @@ -147,7 +148,7 @@ class BoardController(
fun getUserCommentAll(
@AuthUser user: User,
@PageableDefault(size=10, page=0) pageable: Pageable
): ApplicationResponse<Page<BoardMyPageResDto>> {
): ApplicationResponse<Page<CommentMyPageResDto>> {
return ApplicationResponse.ok(boardService.getUserCommentAll(user, pageable))
}
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ class BoardResDto() {
}
}

data class CommentMyPageResDto @QueryProjection constructor(
var commentId: Long,
var boardId: Long ,
var title : String,
var commentContent: String
)


class BoardMyPageResDto() {
var boardId: Long = 0
lateinit var title: String
Expand All @@ -72,6 +80,7 @@ class BoardMyPageResDto() {
var imageUrl: String? = null
lateinit var category: String
lateinit var prefixCategory: String
var commentCnt: Long = 0

constructor(boardId: Long,
title: String,
Expand All @@ -80,6 +89,7 @@ class BoardMyPageResDto() {
imageUrl: String?,
category: String,
prefixCategory: String,
commentCnt: Long
) : this() {
this.boardId = boardId
this.title = title
Expand All @@ -88,6 +98,7 @@ class BoardMyPageResDto() {
this.imageUrl = imageUrl
this.category = category
this.prefixCategory = prefixCategory
this.commentCnt = commentCnt
}
}

Expand All @@ -99,7 +110,7 @@ class BoardMyPageResDto() {
fun toMyPageListDto(board : Board) : BoardMyPageResDto {
val oneLineContent = sliceContentWithRegex(board.content)
if (board.imageUrls.isEmpty()) {
return BoardMyPageResDto(board.id, board.title, oneLineContent, Timestamp.valueOf(board.createdAt), null, board.category.name, board.prefixCategory.name)
return BoardMyPageResDto(board.id, board.title, oneLineContent, Timestamp.valueOf(board.createdAt), null, board.category.name, board.prefixCategory.name, board.comment.size.toLong())
}
return BoardMyPageResDto(board.id, board.title, oneLineContent, Timestamp.valueOf(board.createdAt), board.imageUrls[0], board.category.name, board.prefixCategory.name)
return BoardMyPageResDto(board.id, board.title, oneLineContent, Timestamp.valueOf(board.createdAt), board.imageUrls[0], board.category.name, board.prefixCategory.name, board.comment.size.toLong())
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.example.jhouse_server.domain.board.BoardListDto
import com.example.jhouse_server.domain.board.BoardPreviewListDto
import com.example.jhouse_server.domain.board.dto.BoardMyPageResDto
import com.example.jhouse_server.domain.board.dto.BoardResultDto
import com.example.jhouse_server.domain.board.dto.CommentMyPageResDto
import com.example.jhouse_server.domain.board.entity.Board
import com.example.jhouse_server.domain.user.entity.User
import org.springframework.data.domain.Page
Expand All @@ -16,6 +17,6 @@ interface BoardRepositoryCustom {
fun getBoardAll(boardListDto: BoardListDto, pageable: Pageable): Page<BoardResultDto>
fun getBoardPreviewAll(boardPreviewListDto: BoardPreviewListDto): List<BoardResultDto>
fun getUserBoardAll(user: User, pageable: Pageable): Page<BoardMyPageResDto>
fun getUserCommentAll(user: User, pageable: Pageable): Page<BoardMyPageResDto>
fun getUserCommentAll(user: User, pageable: Pageable): Page<CommentMyPageResDto>
fun getUserLoveAll(user: User, pageable: Pageable): Page<BoardMyPageResDto>
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ class BoardRepositoryImpl(
searchWithKeyword(boardListDto.search)
)
.groupBy(board.id)
.orderBy(board.fixed.desc(), searchWithOrder(boardListDto.order))
.orderBy(board.fixed.desc(), searchWithOrder(boardListDto.order), board.createdAt.desc())
.limit(pageable.pageSize.toLong())
.offset(pageable.offset)
.fetch()
val countQuery = jpaQueryFactory
.select(board.count())
.select(board)
.from(board)
.join(board.boardCode, boardCode)
.join(board.user, user)
Expand Down Expand Up @@ -185,7 +185,7 @@ class BoardRepositoryImpl(
board.user.eq(user),
board.useYn.eq(true),
)
.orderBy(board.fixed.desc())
.orderBy(board.createdAt.desc())
.limit(pageable.pageSize.toLong())
.offset(pageable.offset)
.fetch()
Expand All @@ -204,27 +204,33 @@ class BoardRepositoryImpl(
* 자신이 작성한 댓글의 게시글 목록 조회 -- 마이페이지
* =============================================================================================
* */
override fun getUserCommentAll(user: User, pageable: Pageable): Page<BoardMyPageResDto> {
override fun getUserCommentAll(user: User, pageable: Pageable): Page<CommentMyPageResDto> {
val result = jpaQueryFactory
.selectFrom(board).distinct()
.join(board.comment, comment).fetchJoin()
.select(QCommentMyPageResDto(
comment.id.`as`("commentId"),
board.id.`as`("boardId"),
board.title,
comment.content
))
.from(board)
.join(comment).on(comment.board.eq(board))
.where(
comment.user.eq(user),
board.useYn.eq(true),
)
.orderBy(board.fixed.desc())
.orderBy(comment.createdAt.desc())
.limit(pageable.pageSize.toLong())
.offset(pageable.offset)
.fetch()
val countQuery = jpaQueryFactory
.selectFrom(board).distinct()
.join(board.comment, comment)
.selectFrom(board)
.join(comment).on(comment.board.eq(board))
.where(
comment.user.eq(user),
board.useYn.eq(true),
)

return PageableExecutionUtils.getPage(result, pageable) {countQuery.fetch().size.toLong()}.map { toMyPageListDto(it) }
return PageableExecutionUtils.getPage(result, pageable) {countQuery.fetch().size.toLong()}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.example.jhouse_server.domain.board.service
import com.example.jhouse_server.domain.board.*
import com.example.jhouse_server.domain.board.dto.BoardMyPageResDto
import com.example.jhouse_server.domain.board.dto.BoardResDto
import com.example.jhouse_server.domain.board.dto.CommentMyPageResDto
import com.example.jhouse_server.domain.user.entity.User
import org.springframework.data.domain.Page
import org.springframework.data.domain.Pageable
Expand All @@ -16,6 +17,6 @@ interface BoardService {
fun deleteBoard(boardId: Long, user: User)
fun getCategory(name: String): List<CodeResDto>
fun getUserBoardAll(user: User, pageable: Pageable): Page<BoardMyPageResDto>
fun getUserCommentAll(user: User, pageable: Pageable): Page<BoardMyPageResDto>
fun getUserCommentAll(user: User, pageable: Pageable): Page<CommentMyPageResDto>
fun getUserLoveAll(user: User, pageable: Pageable): Page<BoardMyPageResDto>
}
Loading

0 comments on commit f405247

Please sign in to comment.