Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main <- dev #214

Merged
merged 18 commits into from
Aug 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
98fd8d0
chore: 테스트를 위해 TTL 시간 조정
dldmsql Aug 10, 2023
1533544
feat: 유저 닉네임을 통해 데이터 조회 쿼리 함수 작성
dldmsql Aug 11, 2023
e3ddeb2
feat: 빈집 게시글 추천 태그 추가 및 빈집 거래 상태 변경 기능에 따른 entity 수정
dldmsql Aug 11, 2023
62ce821
feat: 빈집 게시글 추천 태그 기능 도입에 따른 조회 쿼리 튜닝
dldmsql Aug 11, 2023
8965772
fix: 빈집 구매자 데이터 null 허용으로 변경
dldmsql Aug 11, 2023
ddaaac6
feat: 빈집 게시글 ID 기준으로 데이터 조회 쿼리 생성
dldmsql Aug 11, 2023
d4a8707
fix: 빈집 거래 상태 변경 시, 유효성 검증 어노테이션 추가
dldmsql Aug 11, 2023
0c42e26
feat: 빈집 거래 상태 변경 API 기능 개발
dldmsql Aug 11, 2023
6fc3c9d
test: 문서화를 위한 테스트 코드 작성
dldmsql Aug 11, 2023
54a8d92
docs: 빈집 거래 파트 문서 업데이트
dldmsql Aug 11, 2023
f630bf8
fix: 코드 병합
dldmsql Aug 11, 2023
e16b81e
fix: 코드 병합
dldmsql Aug 11, 2023
88193cc
Merge pull request #212 from ODOICHON/feat/house-service
dldmsql Aug 11, 2023
00b2ec1
fix: 자유 게시판에 나눔 카테고리 추가
dldmsql Aug 11, 2023
451f42a
refactor: 불필요한 코드 삭제
dldmsql Aug 11, 2023
9cf5543
fix: 커뮤니티 게시글 작성 시, 말머리 선택값으로 사용할 수 있게 변경
dldmsql Aug 11, 2023
0daecfa
docs: 문서 업데이트
dldmsql Aug 11, 2023
5233163
Merge pull request #213 from ODOICHON/hotfix/board-service
dldmsql Aug 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/docs/asciidoc/board.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
== Board API

*게시글 작성 시, category 값은 Optional 입니다.*

null로 보낼 경우, 서버 측에서 EMPTY 값으로 매핑 시키며 추후 수정 시, EMPTY 값으로 넣어주셔야 합니다.

조회 시, category에 대한 필터링을 원한다면 유의미한 ENUM 값을 넣어주시면 됩니다. 없을 경우, 전체 조회로 간주합니다.

==== 1. 홍보 게시글 작성하기
===== Request
include::{snippets}/ads-board-create/http-request.adoc[]
Expand Down Expand Up @@ -34,6 +40,10 @@ include::{snippets}/get-board-preview/http-response.adoc[]
==== prefix : 필수값
==== category, search, order(default : RECENT) : 선택값

prefix 값은 게시판 타입입니다. 소개/자유/홍보

category 값은 말머리 입니다. 없을 경우, 값을 보내지 않으면 말머리에 대한 필터링을 거치지 않고 데이터를 반환합니다.

===== Request
include::{snippets}/get-board/http-request.adoc[]
===== Response
Expand Down
19 changes: 17 additions & 2 deletions src/docs/asciidoc/house.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,24 @@ include::{snippets}/get-scrap-house-all/http-request.adoc[]
====== Response
include::{snippets}/get-scrap-house-all/http-response.adoc[]

===== 8. 마이페이지 게시글 목록 조회하기 (공인중개사)
===== 10. 마이페이지 게시글 목록 조회하기 (공인중개사)

====== Request
include::{snippets}/get-agent-house-all/http-request.adoc[]
====== Response
include::{snippets}/get-agent-house-all/http-response.adoc[]
include::{snippets}/get-agent-house-all/http-response.adoc[]

===== 11. 빈집 매물 상태 변경하기

본인이 작성한 게시글에 한해서만 상태 변경이 가능합니다. 재등록을 서버 측에서 제한하지 않았기에 클라이언트 측에서 재변경이 안되도록 이벤트를 걸어주셔야 합니다.

리뷰 내용은 필수값은 아니지만, 점수는 필수로 입력해야 하며 이는 양의 정수로 0~5까지 표현할 수 있습니다.

====== Request
include::{snippets}/update-house-deal-status/http-request.adoc[]

====== Request Fields
include::{snippets}/update-house-deal-status/request-fields.adoc[]

====== Response
include::{snippets}/update-house-deal-status/http-response.adoc[]
Original file line number Diff line number Diff line change
Expand Up @@ -16,47 +16,21 @@ data class BoardReqDto(
val title: String? = null,
@field:NotNull(message = "code는 필수값입니다.")
val code: String? = null,
@field:NotNull(message = "말머리는 필수값입니다.")
val category: BoardCategory? = null,
// @field:NotNull(message = "말머리는 필수값입니다.")
val category: BoardCategory?,
val imageUrls: List<String>,
@field:NotNull(message = "게시글 타입은 필수값입니다.")
val prefixCategory: PrefixCategory? = null,
val fixed: Boolean? = null, // 홍보 게시글에 대해서만 true 설정 가능
)

//data class BoardResDto(
// @JsonProperty
// val boardId: Long,
// @JsonProperty
// val title: String,
// @JsonProperty
// val code: String,
// @JsonProperty
// val oneLineContent: String,
// @JsonProperty
// val nickName: String,
// @JsonProperty
// val createdAt: Date?,
// @JsonProperty
// val imageUrl: String?,
// @JsonProperty
// val commentCount: Int,
// @JsonProperty
// val category: String,
// @JsonProperty
// val prefixCategory: String,
// @JsonProperty
// val fixed: Boolean
//)


data class BoardUpdateReqDto(
@field:NotNull(message = "게시글 제목은 필수값입니다.")
val title: String? = null,
@field:NotNull(message = "code는 필수값입니다.")
val code: String? = null,
@field:NotNull(message = "말머리는 필수값입니다.")
val category: String? = null,
// @field:NotNull(message = "말머리는 필수값입니다.")
val category: String?,
val imageUrls: List<String>,
@field:NotNull(message = "게시글 타입은 필수값입니다.")
val prefixCategory: String? = null,
Expand Down Expand Up @@ -102,8 +76,6 @@ fun toDto(board: Board) : BoardResOneDto {
return BoardResOneDto(board.id, board.title, board.boardCode.code, board.user.nickName, Timestamp.valueOf(board.createdAt), board.imageUrls, board.love.size, board.category.name, board.prefixCategory.name, board.comment.size, board.comment.stream().map { com.example.jhouse_server.domain.comment.dto.toDto(it) }.toList())
}
fun sliceContentWithRegex(content : String) : String {
// val pattern = Regex("^[a-zA-Z가-힣].*[.!?]$")
// val validatedString = pattern.find(content)?.value ?: ""
return if (content.length >= 200) {
content.take(200)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class Board(
this.boardCode = code
this.content = content
this.category = BoardCategory.values().firstOrNull { it.name == category }
?: throw ApplicationException(ErrorCode.NOT_FOUND_EXCEPTION)
?: BoardCategory.EMPTY
this.imageUrls = imageUrls
this.prefixCategory = PrefixCategory.values().firstOrNull { it.name == prefixCategory }
?: throw ApplicationException(ErrorCode.NOT_FOUND_EXCEPTION)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ enum class BoardCategory(val value: String, val superCategory: PrefixCategory) {

QUESTION("질문", PrefixCategory.DEFAULT),
DAILY("일상", PrefixCategory.DEFAULT),
SHARING("나눔", PrefixCategory.DEFAULT),

TREND("트렌드", PrefixCategory.INTRO),
REVIEW("후기", PrefixCategory.INTRO),

EMPTY("태그 없음", PrefixCategory.ALL),
;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import javax.persistence.Converter
enum class PrefixCategory(val value: String) {
DEFAULT("자유"),
INTRO("소개"),
ADVERTISEMENT("홍보");
ADVERTISEMENT("홍보"),
ALL("공통");

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import com.example.jhouse_server.domain.board.entity.QBoard.board
import com.example.jhouse_server.domain.board.entity.QBoardCode.boardCode
import com.example.jhouse_server.domain.comment.entity.QComment.comment
import com.example.jhouse_server.domain.love.entity.QLove.love
import com.example.jhouse_server.domain.user.entity.QUser
import com.example.jhouse_server.domain.user.entity.QUser.user
import com.example.jhouse_server.domain.user.entity.User
import com.querydsl.core.types.OrderSpecifier
Expand All @@ -22,6 +21,7 @@ import com.querydsl.jpa.impl.JPAQueryFactory
import org.springframework.data.domain.Page
import org.springframework.data.domain.Pageable
import org.springframework.data.support.PageableExecutionUtils
import org.springframework.util.StringUtils.hasText

class BoardRepositoryImpl(
private var jpaQueryFactory: JPAQueryFactory
Expand Down Expand Up @@ -65,7 +65,7 @@ class BoardRepositoryImpl(
.selectFrom(board)
.join(board.boardCode, boardCode).fetchJoin()
.join(board.user, user).fetchJoin()
.where(board.useYn.eq(true), board.prefixCategory.eq(PrefixCategory.valueOf(boardListDto.prefix)),searchWithBoardCategory(boardListDto.category),searchWithKeyword(boardListDto.search))
.where(board.useYn.eq(true), filterWithPrefixCategory(boardListDto.prefix) ,searchWithBoardCategory(boardListDto.category),searchWithKeyword(boardListDto.search))
.orderBy(board.fixed.desc(), searchWithOrder(boardListDto.order))
.limit(pageable.pageSize.toLong())
.offset(pageable.offset)
Expand All @@ -77,6 +77,10 @@ class BoardRepositoryImpl(
return PageableExecutionUtils.getPage(result, pageable) {countQuery.fetch().size.toLong()}.map { toListDto(it) }
}

private fun filterWithPrefixCategory(prefix: String): BooleanExpression? {
return if(!hasText(prefix)) null else board.prefixCategory.eq(PrefixCategory.valueOf(prefix))
}


override fun getBoardPreviewAll(boardPreviewListDto: BoardPreviewListDto): List<Board> {
return jpaQueryFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ class BoardServiceImpl(
val content = getContent(req.code!!)
val fixed = if(req.prefixCategory == PrefixCategory.ADVERTISEMENT) req.fixed!! else false
val code = boardCodeRepository.save(BoardCode(req.code))
val category = BoardCategory.values().firstOrNull { it == req.category } ?: BoardCategory.EMPTY
val board = Board(
req.title!!, content, req.category!!, req.imageUrls, user, req.prefixCategory!!, fixed, code
req.title!!, content, category, req.imageUrls, user, req.prefixCategory!!, fixed, code
)
return boardRepository.save(board).id
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,32 @@ class HouseController(
}

/**
* 스크랩 게시글 목록 조회
<<<<<<< HEAD
* 빈집 매물 상태 변경
*
* @author MoonMinHyuk
* @author dldmsql
* @param user User 현재 로그인한 유저
* @param pageable Pageable 페이징 처리를 위한 쿼리 인터페이스
* @return Page<HouseResDto>
*/
* @param houseId Long 빈집 매물 게시글
* @param dealReqDto DealReqDto 판매 완료
* @return Nothing
* */
@Auth
@PutMapping("/status/{houseId}")
fun updateStatus(
@AuthUser user: User,
@PathVariable houseId: Long,
@RequestBody dealReqDto: DealReqDto,
) : ApplicationResponse<Nothing> {
houseService.updateStatus(user, houseId, dealReqDto)
return ApplicationResponse.ok()
}
/** 스크랩 게시글 목록 조회
*
* @author MoonMinHyuk
* @param user User 현재 로그인한 유저
* @param pageable Pageable 페이징 처리를 위한 쿼리 인터페이스
* @return Page<HouseResDto>
*/
@Auth
@GetMapping("/scrap")
fun getScrapHouseAll(
Expand Down
Loading