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

129 서비스명이 다 불편하네요 갈아엎어주세요 #130

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ class RegisterClientService(
private val userUtil: UserUtil
) {
fun execute(clientRegisterDto: ClientRegisterReqDto): ClientRegisterResDto {
val clientSecret = createUUID()
val clientId = createUUID()
val (clientSecret, clientId) = createUUID() to createUUID()
val user = userUtil.fetchCurrentUser()
val client = clientRegisterDto.toEntity(user, clientSecret, clientId)
return ClientRegisterResDto(clientRepository.save(client))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
package com.msg.gauth.domain.email.presentation

import com.msg.gauth.domain.email.presentation.dto.EmailSendDto
import com.msg.gauth.domain.email.services.MailSendService
import com.msg.gauth.domain.email.services.MailVerificationCheckService
import com.msg.gauth.domain.email.services.MailVerificationService
import com.msg.gauth.domain.email.services.SendMailService
import com.msg.gauth.domain.email.services.CheckMailVerificationService
import com.msg.gauth.domain.email.services.VerifyMailService
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.*

@RestController
@RequestMapping("/email")
class EmailController(
private val mailSendService: MailSendService,
private val mailVerificationService: MailVerificationService,
private val mailVerificationCheckService: MailVerificationCheckService,
private val sendMailService: SendMailService,
private val verifyMailService: VerifyMailService,
private val checkMailVerificationService: CheckMailVerificationService,
) {
@PostMapping
fun emailSend(@RequestBody emailSendDto: EmailSendDto): ResponseEntity<Void> {
mailSendService.execute(emailSendDto)
sendMailService.execute(emailSendDto)
return ResponseEntity.noContent().build()
}

@GetMapping("/authentication")
fun emailVerification(@RequestParam email: String, @RequestParam uuid: String): ResponseEntity<String> {
mailVerificationService.execute(email, uuid)
verifyMailService.execute(email, uuid)
return ResponseEntity.ok("완료되었습니다!<br> 다음 단계를 진행해주세요.")
}

@GetMapping
fun checkEmailVerification(@RequestParam email: String): ResponseEntity<Void>{
mailVerificationCheckService.execute(email)
checkMailVerificationService.execute(email)
return ResponseEntity.ok().build()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.msg.gauth.domain.email.repository.EmailAuthRepository
import org.springframework.stereotype.Service

@Service
class MailVerificationCheckService(
class CheckMailVerificationService(
private val emailAuthRepository: EmailAuthRepository,
){
fun execute(email: String){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import java.util.*
import javax.mail.MessagingException

@Service
class MailSendService(
class SendMailService(
private val mailSender: JavaMailSender,
private val emailAuthRepository: EmailAuthRepository,
private val templateEngine: SpringTemplateEngine
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.msg.gauth.domain.email.repository.EmailAuthRepository
import com.msg.gauth.global.annotation.service.TransactionalService

@TransactionalService
class MailVerificationService(
class VerifyMailService(
private val emailAuthRepository: EmailAuthRepository
) {
fun execute(email: String, uuid: String) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ class OauthTokenService(
private val userRepository: UserRepository,
private val tokenProvider: JwtTokenProvider,
private val refreshTokenRepository: OauthRefreshTokenRepository,
private val oauthCodeRepository: OauthCodeRepository,
private val passwordEncoder: PasswordEncoder,
private val oauthCodeRepository: OauthCodeRepository
){
fun execute(userTokenRequestDto: UserTokenRequestDto): UserTokenResponseDto{
val client = (clientRepository.findByClientIdAndRedirectUri(userTokenRequestDto.clientId, userTokenRequestDto.redirectUri)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import javax.validation.Valid
class UserController(
private val changePasswordService: ChangePasswordService,
private val uploadProfileService: UploadProfileService,
private val myProfileService: MyProfileService,
private val acceptedUserService: AcceptedUserService,
private val getMyProfileService: GetMyProfileService,
private val getAcceptedUsersService: GetAcceptedUsersService,
private val acceptTeacherSignUpService: AcceptTeacherSignUpService,
private val pendingListService: PendingListService,
private val getPendingUsersService: GetPendingUsersService,
private val acceptStudentSignUpService: AcceptStudentSignUpService,
private val getMyRolesService: GetMyRolesService
) {
Expand All @@ -34,7 +34,7 @@ class UserController(

@GetMapping
fun myProfile(): ResponseEntity<MyProfileResDto> {
val result = myProfileService.execute()
val result = getMyProfileService.execute()
return ResponseEntity.ok(result)
}

Expand All @@ -56,7 +56,7 @@ class UserController(
@RequestParam keyword: String?,
pageable: Pageable
): ResponseEntity<List<SingleAcceptedUserResDto>> {
val result = acceptedUserService.execute(grade, classNum, keyword, pageable)
val result = getAcceptedUsersService.execute(grade, classNum, keyword, pageable)
return ResponseEntity.ok(result)
}

Expand All @@ -68,7 +68,7 @@ class UserController(

@GetMapping("/pending")
fun pendingList(): ResponseEntity<List<SinglePendingListResDto>> {
val result = pendingListService.execute()
val result = getPendingUsersService.execute()
return ResponseEntity.ok(result)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,20 @@ import com.msg.gauth.global.annotation.service.ReadOnlyService
import org.springframework.data.domain.Pageable

@ReadOnlyService
class AcceptedUserService(
class GetAcceptedUsersService(
private val userRepository: UserRepository,
) {
fun execute(grade: Int, classNum: Int, name: String?, pageable: Pageable): List<SingleAcceptedUserResDto> {
val keyword: String = name ?: ""
val userList: List<User>
= when {
grade == 0 && classNum == 0 && name == "" -> userRepository.findAllByStateOrderByGrade(UserState.CREATED, pageable)

grade == 0 && classNum == 0 -> userRepository.findAllByStateAndNameContainingOrderByGrade(UserState.CREATED, keyword, pageable)
classNum == 0 && name == "" -> userRepository.findAllByStateAndGradeOrderByGrade(UserState.CREATED, classNum, pageable)
grade == 0 && name == ""-> userRepository.findAllByStateAndClassNumOrderByGrade(UserState.CREATED, grade, pageable)

grade == 0 -> userRepository.findAllByStateAndClassNumAndNameContainingOrderByGrade(UserState.CREATED, classNum, keyword, pageable)
classNum == 0 -> userRepository.findAllByStateAndGradeAndNameContainingOrderByGrade(UserState.CREATED, grade, keyword, pageable)
name == "" -> userRepository.findAllByStateAndGradeAndClassNumOrderByGrade(UserState.CREATED, grade, classNum, pageable)

else -> userRepository.findAllByStateAndGradeAndClassNumAndNameContainingOrderByGrade(UserState.CREATED, grade, classNum, keyword, pageable)
}
return userList.map {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.msg.gauth.domain.user.utils.UserUtil
import com.msg.gauth.global.annotation.service.ReadOnlyService

@ReadOnlyService
class MyProfileService(
class GetMyProfileService(
private val userUtil: UserUtil,
private val clientRepository: ClientRepository
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import com.msg.gauth.domain.user.repository.UserRepository
import com.msg.gauth.global.annotation.service.ReadOnlyService

@ReadOnlyService
class PendingListService(
class GetPendingUsersService(
private val userRepository: UserRepository
) {
fun execute(): List<SinglePendingListResDto>
Expand Down