Skip to content

Commit 86e9651

Browse files
authored
Merge pull request #411 from TASK-FORCE/feature/fix-fomular
모임 조회시 탈퇴한 모임원까지 조회해오는 버그 수정
2 parents 81a6649 + 800a83e commit 86e9651

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

src/course/rest/club/Club.http

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
### [로컬] 내 클럽 조회
2-
GET http://localhost:8080/clubs/my
2+
GET http://localhost:8080/clubs/search
33
Content-Type: application/json;charset=UTF-8
44
Accept: application/json
5-
Authorization: Bearer {{token-sdm}}
5+
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiIxNDUxMDAxNjQ5Iiwic3ViIjoiMTQ1MTAwMTY0OSIsImlhdCI6MTYxODc0MzEzOSwiZXhwIjoxNjE5MzQ3OTM5fQ.9i64zN1FJIGB8NF-goqeDBtvSGDoKF566eB_w3O6xAw
66

77
### [개발] 내 클럽 조회
88
GET {{host}}/clubs/my

src/course/rest/user/user.http

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
GET {{host}} /users/check-already-register
33
Content-Type: application/json;charset=UTF-8
44
Accept: application/json
5-
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiIxNDM5NTI4NTk3Iiwic3ViIjoiMTQzOTUyODU5NyIsImlhdCI6MTYxNzA5MDk3NiwiZXhwIjoxNjE3MDkyNzc2fQ.WC21kPa-PkFCsAbm2gWFQo0g3hlHd5IzKZqvbq2w19I
5+
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJ1c2VySWQiOiIxNDEyMzc1MzA5Iiwic3ViIjoiMTQxMjM3NTMwOSIsImlhdCI6MTYxODc0NDc3MSwiZXhwIjoxNjE5MzQ5NTcxfQ.f3Hx5zrH6T_-g3UvRQddpWvdzTAoxfZbqOAfxw8hbcg
66

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

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

3131
### 카카오 유저 정보
3232
GET {{host}}/users/kakao-profile

src/main/kotlin/com/taskforce/superinvention/app/domain/club/Club.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ class Club(
3333
mainImageName = ""
3434
)
3535

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

3943
@OneToMany

src/main/kotlin/com/taskforce/superinvention/app/domain/club/ClubRepository.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package com.taskforce.superinvention.app.domain.club
22

33
import com.querydsl.core.Tuple
44
import com.querydsl.core.annotations.QueryProjection
5+
import com.querydsl.core.types.Predicate
56
import com.querydsl.core.types.dsl.BooleanExpression
67
import com.querydsl.core.types.dsl.Expressions
78
import com.taskforce.superinvention.app.domain.club.QClub.*
@@ -16,6 +17,7 @@ import com.taskforce.superinvention.app.domain.region.QClubRegion.*
1617
import com.taskforce.superinvention.app.domain.region.QRegion
1718
import com.taskforce.superinvention.app.domain.region.QRegion.region
1819
import com.taskforce.superinvention.app.domain.role.QClubUserRole
20+
import com.taskforce.superinvention.app.domain.role.QRole
1921
import com.taskforce.superinvention.app.domain.role.QRoleGroup
2022
import com.taskforce.superinvention.app.domain.role.Role
2123
import com.taskforce.superinvention.app.domain.user.QUser.user
@@ -45,9 +47,14 @@ class ClubRepositoryImpl: ClubRepositoryCustom, QuerydslRepositorySupport(Club::
4547

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

50+
val clubUserRole = QClubUserRole.clubUserRole
51+
val role = QRole.role
52+
4853
val query = from(club)
4954
.join(club.clubUser, clubUser).fetchJoin()
50-
.join(clubUser.user, user).fetchJoin()
55+
.leftJoin(clubUser.user, user).fetchJoin()
56+
.leftJoin(clubUser.clubUserRoles, clubUserRole).fetchJoin()
57+
.leftJoin(clubUserRole.role, role).fetchJoin()
5158
.join(club.clubInterests, clubInterest).fetchJoin()
5259
.join(clubInterest.interest, interest).fetchJoin()
5360
.join(interest.interestGroup, interestGroup).fetchJoin()
@@ -57,7 +64,8 @@ class ClubRepositoryImpl: ClubRepositoryCustom, QuerydslRepositorySupport(Club::
5764
inIfNotEmpty(clubRegion.region, regionSeqList),
5865
eqIfExist(clubInterest.interest, interestSeq),
5966
eqIfExist(clubInterest.interest.interestGroup, interestGroupSeq),
60-
searchIfExist(club, text)
67+
searchIfExist(club, text),
68+
role.name.`in`(Role.RoleName.CLUB_MEMBER, Role.RoleName.MANAGER, Role.RoleName.MASTER)
6169
)
6270

6371
// PAGING

0 commit comments

Comments
 (0)