-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#75] refactor: auth query kotlin으로 migration
- Loading branch information
1 parent
787e47a
commit 2844d78
Showing
20 changed files
with
146 additions
and
179 deletions.
There are no files selected for viewing
19 changes: 0 additions & 19 deletions
19
src/main/java/com/mallang/auth/query/MemberQueryService.java
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
src/main/java/com/mallang/auth/query/dao/MemberProfileDataDao.java
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
src/main/java/com/mallang/auth/query/dao/support/MemberQuerySupport.java
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
src/main/java/com/mallang/auth/query/data/MemberProfileData.java
This file was deleted.
Oops, something went wrong.
19 changes: 7 additions & 12 deletions
19
src/main/kotlin/com/mallang/auth/exception/IncorrectUseAuthAtException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,9 @@ | ||
package com.mallang.auth.exception; | ||
package com.mallang.auth.exception | ||
|
||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR; | ||
|
||
import com.mallang.common.execption.ErrorCode; | ||
import com.mallang.common.execption.MallangLogException; | ||
|
||
public class IncorrectUseAuthAtException extends MallangLogException { | ||
|
||
public IncorrectUseAuthAtException() { | ||
super(new ErrorCode(INTERNAL_SERVER_ERROR, "@Auth 어노테이션을 잘못 사용했습니다.")); | ||
} | ||
} | ||
import com.mallang.common.execption.ErrorCode | ||
import com.mallang.common.execption.MallangLogException | ||
import org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR | ||
|
||
class IncorrectUseAuthAtException : MallangLogException( | ||
ErrorCode(INTERNAL_SERVER_ERROR, "@Auth 어노테이션을 잘못 사용했습니다.") | ||
) |
18 changes: 7 additions & 11 deletions
18
src/main/kotlin/com/mallang/auth/exception/NoAuthenticationSessionException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
package com.mallang.auth.exception; | ||
package com.mallang.auth.exception | ||
|
||
import static org.springframework.http.HttpStatus.UNAUTHORIZED; | ||
import com.mallang.common.execption.ErrorCode | ||
import com.mallang.common.execption.MallangLogException | ||
import org.springframework.http.HttpStatus.UNAUTHORIZED | ||
|
||
import com.mallang.common.execption.ErrorCode; | ||
import com.mallang.common.execption.MallangLogException; | ||
|
||
public class NoAuthenticationSessionException extends MallangLogException { | ||
|
||
public NoAuthenticationSessionException() { | ||
super(new ErrorCode(UNAUTHORIZED, "인증 정보가 없거나 만료되었습니다.")); | ||
} | ||
} | ||
class NoAuthenticationSessionException : MallangLogException( | ||
ErrorCode(UNAUTHORIZED, "인증 정보가 없거나 만료되었습니다.") | ||
) |
18 changes: 7 additions & 11 deletions
18
src/main/kotlin/com/mallang/auth/exception/NotFoundMemberException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
package com.mallang.auth.exception; | ||
package com.mallang.auth.exception | ||
|
||
import static org.springframework.http.HttpStatus.NOT_FOUND; | ||
import com.mallang.common.execption.ErrorCode | ||
import com.mallang.common.execption.MallangLogException | ||
import org.springframework.http.HttpStatus.NOT_FOUND | ||
|
||
import com.mallang.common.execption.ErrorCode; | ||
import com.mallang.common.execption.MallangLogException; | ||
|
||
public class NotFoundMemberException extends MallangLogException { | ||
|
||
public NotFoundMemberException() { | ||
super(new ErrorCode(NOT_FOUND, "존재하지 않는 회원입니다.")); | ||
} | ||
} | ||
class NotFoundMemberException : MallangLogException( | ||
ErrorCode(NOT_FOUND, "존재하지 않는 회원입니다.") | ||
) |
18 changes: 7 additions & 11 deletions
18
src/main/kotlin/com/mallang/auth/exception/UnsupportedOauthTypeException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
package com.mallang.auth.exception; | ||
package com.mallang.auth.exception | ||
|
||
import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR; | ||
import com.mallang.common.execption.ErrorCode | ||
import com.mallang.common.execption.MallangLogException | ||
import org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR | ||
|
||
import com.mallang.common.execption.ErrorCode; | ||
import com.mallang.common.execption.MallangLogException; | ||
|
||
public class UnsupportedOauthTypeException extends MallangLogException { | ||
|
||
public UnsupportedOauthTypeException() { | ||
super(new ErrorCode(INTERNAL_SERVER_ERROR, "Oauth 에 문제가 있습니다.")); | ||
} | ||
} | ||
class UnsupportedOauthTypeException : MallangLogException( | ||
ErrorCode(INTERNAL_SERVER_ERROR, "Oauth 에 문제가 있습니다.") | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/main/kotlin/com/mallang/auth/query/MemberQueryService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.mallang.auth.query | ||
|
||
import com.mallang.auth.query.dao.MemberProfileDataDao | ||
import com.mallang.auth.query.dao.model.MemberProfileQueryModel | ||
import org.springframework.stereotype.Service | ||
import org.springframework.transaction.annotation.Transactional | ||
|
||
|
||
@Transactional(readOnly = true) | ||
@Service | ||
class MemberQueryService( | ||
private val memberProfileDataDao: MemberProfileDataDao | ||
) { | ||
|
||
fun findProfile(memberId: Long): MemberProfileQueryModel { | ||
return memberProfileDataDao.find(memberId) | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/kotlin/com/mallang/auth/query/dao/MemberProfileDataDao.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.mallang.auth.query.dao | ||
|
||
import com.mallang.auth.query.dao.model.MemberProfileQueryModel | ||
import com.mallang.auth.query.dao.support.MemberQuerySupport | ||
import org.springframework.stereotype.Component | ||
import org.springframework.transaction.annotation.Transactional | ||
|
||
@Transactional(readOnly = true) | ||
@Component | ||
class MemberProfileDataDao( | ||
private val memberQuerySupport: MemberQuerySupport | ||
) { | ||
|
||
fun find(memberId: Long): MemberProfileQueryModel { | ||
return MemberProfileQueryModel.from(memberQuerySupport.getById(memberId)) | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/kotlin/com/mallang/auth/query/dao/model/MemberProfileQueryModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.mallang.auth.query.dao.model | ||
|
||
import com.mallang.auth.domain.Member | ||
|
||
data class MemberProfileQueryModel( | ||
val id: Long, | ||
val nickname: String, | ||
val profileImageUrl: String | ||
) { | ||
companion object { | ||
fun from(member: Member): MemberProfileQueryModel = | ||
MemberProfileQueryModel( | ||
member.id, | ||
member.nickname, | ||
member.profileImageUrl | ||
) | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/kotlin/com/mallang/auth/query/dao/support/MemberQuerySupport.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.mallang.auth.query.dao.support | ||
|
||
import com.mallang.auth.domain.Member | ||
import org.springframework.data.jpa.repository.JpaRepository | ||
import org.springframework.data.repository.findByIdOrNull | ||
|
||
|
||
interface MemberQuerySupport : JpaRepository<Member, Long?> { | ||
fun getById(id: Long) = findByIdOrNull(id) | ||
?: throw NoSuchElementException("id가 ${id}인 회원을 찾을 수 없습니다.") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 0 additions & 47 deletions
47
src/test/java/com/mallang/auth/query/dao/MemberProfileDataDaoTest.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.