Skip to content

Commit

Permalink
Merge pull request #411 from TASK-FORCE/feature/fix-fomular
Browse files Browse the repository at this point in the history
모임 조회시 탈퇴한 모임원까지 조회해오는 버그 수정
  • Loading branch information
yyy9942 authored Apr 18, 2021
2 parents 81a6649 + 800a83e commit 86e9651
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/course/rest/club/Club.http
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
### [로컬] 내 클럽 조회
GET http://localhost:8080/clubs/my
GET http://localhost:8080/clubs/search
Content-Type: application/json;charset=UTF-8
Accept: application/json
Authorization: Bearer {{token-sdm}}
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiIxNDUxMDAxNjQ5Iiwic3ViIjoiMTQ1MTAwMTY0OSIsImlhdCI6MTYxODc0MzEzOSwiZXhwIjoxNjE5MzQ3OTM5fQ.9i64zN1FJIGB8NF-goqeDBtvSGDoKF566eB_w3O6xAw

### [개발] 내 클럽 조회
GET {{host}}/clubs/my
Expand Down
4 changes: 2 additions & 2 deletions src/course/rest/user/user.http
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
GET {{host}} /users/check-already-register
Content-Type: application/json;charset=UTF-8
Accept: application/json
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiIxNDM5NTI4NTk3Iiwic3ViIjoiMTQzOTUyODU5NyIsImlhdCI6MTYxNzA5MDk3NiwiZXhwIjoxNjE3MDkyNzc2fQ.WC21kPa-PkFCsAbm2gWFQo0g3hlHd5IzKZqvbq2w19I
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiIxNDEyMzc1MzA5Iiwic3ViIjoiMTQxMjM3NTMwOSIsImlhdCI6MTYxODc0NDc3MSwiZXhwIjoxNjE5MzQ5NTcxfQ.f3Hx5zrH6T_-g3UvRQddpWvdzTAoxfZbqOAfxw8hbcg

### 유저 백도어 조회
GET {{host}}/users/door/꽑꽑이
Expand All @@ -26,7 +26,7 @@ Content-type: application/x-www-form-urlencoded;charset=utf-8

### 카카오 유저 정보
GET {{host}}/users/kakao-profile
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiIxNDEyMzc1MzA5Iiwic3ViIjoiMTQxMjM3NTMwOSIsImlhdCI6MTYxMTQ4NTEwOCwiZXhwIjoxNjQzMDIxMTA4fQ.gJg2APZdNtewO_OIfkAhbLB0ZJzBYrTZUjR72JvzXqI
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiIxNDEyMzc1MzA5Iiwic3ViIjoiMTQxMjM3NTMwOSIsImlhdCI6MTYxODc0NDc3MSwiZXhwIjoxNjE5MzQ5NTcxfQ.f3Hx5zrH6T_-g3UvRQddpWvdzTAoxfZbqOAfxw8hbcg

### 카카오 유저 정보
GET {{host}}/users/kakao-profile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ class Club(
mainImageName = ""
)

@Formula("(select count(*) from club_user cu where cu.club_seq = seq)")
@Formula("(SELECT count(*)\n" +
"FROM club_user cu\n" +
"JOIN club_user_role cur on cu.seq = cur.club_user_seq\n" +
"JOIN role r on cur.role_seq = r.seq\n" +
"WHERE r.name IN ('CLUB_MEMBER', 'MANAGER', 'MASTER') AND cu.club_seq = seq)")
var userCount: Long ?= null

@OneToMany
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.taskforce.superinvention.app.domain.club

import com.querydsl.core.Tuple
import com.querydsl.core.annotations.QueryProjection
import com.querydsl.core.types.Predicate
import com.querydsl.core.types.dsl.BooleanExpression
import com.querydsl.core.types.dsl.Expressions
import com.taskforce.superinvention.app.domain.club.QClub.*
Expand All @@ -16,6 +17,7 @@ import com.taskforce.superinvention.app.domain.region.QClubRegion.*
import com.taskforce.superinvention.app.domain.region.QRegion
import com.taskforce.superinvention.app.domain.region.QRegion.region
import com.taskforce.superinvention.app.domain.role.QClubUserRole
import com.taskforce.superinvention.app.domain.role.QRole
import com.taskforce.superinvention.app.domain.role.QRoleGroup
import com.taskforce.superinvention.app.domain.role.Role
import com.taskforce.superinvention.app.domain.user.QUser.user
Expand Down Expand Up @@ -45,9 +47,14 @@ class ClubRepositoryImpl: ClubRepositoryCustom, QuerydslRepositorySupport(Club::

override fun search(text: String?, regionSeqList: List<Long>, interestSeq: Long?, interestGroupSeq: Long?, pageable: Pageable): Page<Club> {

val clubUserRole = QClubUserRole.clubUserRole
val role = QRole.role

val query = from(club)
.join(club.clubUser, clubUser).fetchJoin()
.join(clubUser.user, user).fetchJoin()
.leftJoin(clubUser.user, user).fetchJoin()
.leftJoin(clubUser.clubUserRoles, clubUserRole).fetchJoin()
.leftJoin(clubUserRole.role, role).fetchJoin()
.join(club.clubInterests, clubInterest).fetchJoin()
.join(clubInterest.interest, interest).fetchJoin()
.join(interest.interestGroup, interestGroup).fetchJoin()
Expand All @@ -57,7 +64,8 @@ class ClubRepositoryImpl: ClubRepositoryCustom, QuerydslRepositorySupport(Club::
inIfNotEmpty(clubRegion.region, regionSeqList),
eqIfExist(clubInterest.interest, interestSeq),
eqIfExist(clubInterest.interest.interestGroup, interestGroupSeq),
searchIfExist(club, text)
searchIfExist(club, text),
role.name.`in`(Role.RoleName.CLUB_MEMBER, Role.RoleName.MANAGER, Role.RoleName.MASTER)
)

// PAGING
Expand Down

0 comments on commit 86e9651

Please sign in to comment.