-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
251 additions
and
26 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
idle-api/src/main/kotlin/com/swm/idle/api/auth/carer/spec/CarerAuthApi.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,10 @@ | ||
package com.swm.idle.api.auth.carer.spec | ||
|
||
import io.swagger.v3.oas.annotations.tags.Tag | ||
import org.springframework.web.bind.annotation.RequestMapping | ||
|
||
@Tag(name = "Auth-Carer", description = "Carer Auth API") | ||
@RequestMapping("/api/v1/auth/carer", produces = ["application/json"]) | ||
interface CarerAuthApi { | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
idle-api/src/main/kotlin/com/swm/idle/api/auth/center/controller/CenterAuthController.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,41 @@ | ||
package com.swm.idle.api.auth.center.controller | ||
|
||
import com.swm.idle.api.auth.center.dto.JoinRequest | ||
import com.swm.idle.api.auth.center.facade.CenterAuthFacadeService | ||
import com.swm.idle.api.auth.center.spec.CenterAuthApi | ||
import com.swm.idle.domain.center.vo.BusinessRegistrationNumber | ||
import com.swm.idle.domain.sms.vo.PhoneNumber | ||
import org.springframework.web.bind.annotation.RestController | ||
|
||
@RestController | ||
class CenterAuthController( | ||
private val centerAuthFacadeService: CenterAuthFacadeService, | ||
) : CenterAuthApi { | ||
|
||
override fun join(request: JoinRequest) { | ||
centerAuthFacadeService.join( | ||
identifier = request.identifier, | ||
password = request.password, | ||
phoneNumber = PhoneNumber(request.phoneNumber), | ||
managerName = request.managerName, | ||
centerBusinessRegistrationNumber = BusinessRegistrationNumber(request.centerBusinessRegistrationNumber), | ||
) | ||
} | ||
|
||
// override fun login(request: LoginRequest): LoginResponse { | ||
// TODO("Not yet implemented") | ||
// } | ||
// | ||
// override fun logout() { | ||
// TODO("Not yet implemented") | ||
// } | ||
// | ||
// override fun refreshLoginToken(request: RefreshTokenRequest): RefreshLoginTokenResponse { | ||
// TODO("Not yet implemented") | ||
// } | ||
// | ||
// override fun withDraw() { | ||
// TODO("Not yet implemented") | ||
// } | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
idle-api/src/main/kotlin/com/swm/idle/api/auth/center/dto/JoinRequest.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,20 @@ | ||
package com.swm.idle.api.auth.center.dto | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema | ||
|
||
@Schema( | ||
name = "Center Manager Join Request", | ||
description = "센터 관리자 회원 가입 요청" | ||
) | ||
data class JoinRequest( | ||
@Schema(description = "아이디(ID)") | ||
val identifier: String, | ||
@Schema(description = "비밀번호") | ||
val password: String, | ||
@Schema(description = "관리자 휴대폰 번호", example = "010-0000-0000") | ||
val phoneNumber: String, | ||
@Schema(description = "관리자 성명") | ||
val managerName: String, | ||
@Schema(description = "센터 사업자 등록 번호", example = "000-00-00000") | ||
val centerBusinessRegistrationNumber: String, | ||
) |
28 changes: 28 additions & 0 deletions
28
idle-api/src/main/kotlin/com/swm/idle/api/auth/center/facade/CenterAuthFacadeService.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,28 @@ | ||
package com.swm.idle.api.auth.center.facade | ||
|
||
import com.swm.idle.domain.center.service.CenterManagerService | ||
import com.swm.idle.domain.center.vo.BusinessRegistrationNumber | ||
import com.swm.idle.domain.sms.vo.PhoneNumber | ||
import org.springframework.stereotype.Service | ||
|
||
@Service | ||
class CenterAuthFacadeService( | ||
private val centerManagerService: CenterManagerService, | ||
) { | ||
fun join( | ||
identifier: String, | ||
password: String, | ||
phoneNumber: PhoneNumber, | ||
managerName: String, | ||
centerBusinessRegistrationNumber: BusinessRegistrationNumber, | ||
) { | ||
centerManagerService.save( | ||
identifier = identifier, | ||
password = password, | ||
phoneNumber = phoneNumber, | ||
managerName = managerName, | ||
centerBusinessRegistrationNumber = centerBusinessRegistrationNumber, | ||
) | ||
} | ||
|
||
} |
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
54 changes: 54 additions & 0 deletions
54
idle-domain/src/main/kotlin/com/swm/idle/domain/center/entity/CenterManager.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,54 @@ | ||
package com.swm.idle.domain.center.entity | ||
|
||
import com.swm.idle.domain.center.enums.CenterAccountStatus | ||
import jakarta.persistence.Column | ||
import jakarta.persistence.Entity | ||
import jakarta.persistence.EnumType | ||
import jakarta.persistence.Enumerated | ||
import jakarta.persistence.Id | ||
import jakarta.persistence.Table | ||
import java.util.* | ||
|
||
@Entity | ||
@Table(name = "center_manager") | ||
class CenterManager( | ||
id: UUID, | ||
identifier: String, | ||
password: String, | ||
managerName: String, | ||
phoneNumber: String, | ||
status: CenterAccountStatus, | ||
centerBusinessRegistrationNumber: String, | ||
) { | ||
|
||
@Id | ||
@Column(nullable = false) | ||
var id: UUID = id | ||
private set | ||
|
||
@Column(nullable = false, columnDefinition = "varchar(255)") | ||
var identifier: String = identifier | ||
private set | ||
|
||
@Column(nullable = false, columnDefinition = "varchar(255)") | ||
var password: String = password | ||
private set | ||
|
||
@Column(nullable = false, columnDefinition = "varchar(255)") | ||
var managerName: String = managerName | ||
private set | ||
|
||
@Column(nullable = false, columnDefinition = "varchar(255)") | ||
var phoneNumber: String = phoneNumber | ||
private set | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(nullable = false, columnDefinition = "varchar(255)") | ||
var status: CenterAccountStatus = status | ||
private set | ||
|
||
@Column(nullable = false, columnDefinition = "varchar(255)") | ||
var centerBusinessRegistrationNumber: String = centerBusinessRegistrationNumber | ||
private set | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
idle-domain/src/main/kotlin/com/swm/idle/domain/center/enums/CenterAccountStatus.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,7 @@ | ||
package com.swm.idle.domain.center.enums | ||
|
||
enum class CenterAccountStatus { | ||
ACTIVE, | ||
PENDING, | ||
INACTIVE, | ||
} |
10 changes: 10 additions & 0 deletions
10
...omain/src/main/kotlin/com/swm/idle/domain/center/repository/CenterManagerJpaRepository.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,10 @@ | ||
package com.swm.idle.domain.center.repository | ||
|
||
import com.swm.idle.domain.center.entity.CenterManager | ||
import org.springframework.data.jpa.repository.JpaRepository | ||
import org.springframework.stereotype.Repository | ||
import java.util.* | ||
|
||
@Repository | ||
interface CenterManagerJpaRepository : JpaRepository<CenterManager, UUID> { | ||
} |
38 changes: 38 additions & 0 deletions
38
idle-domain/src/main/kotlin/com/swm/idle/domain/center/service/CenterManagerService.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,38 @@ | ||
package com.swm.idle.domain.center.service | ||
|
||
import com.swm.idle.domain.center.entity.CenterManager | ||
import com.swm.idle.domain.center.enums.CenterAccountStatus | ||
import com.swm.idle.domain.center.repository.CenterManagerJpaRepository | ||
import com.swm.idle.domain.center.vo.BusinessRegistrationNumber | ||
import com.swm.idle.domain.sms.vo.PhoneNumber | ||
import com.swm.idle.support.common.uuid.UuidCreator | ||
import org.springframework.stereotype.Service | ||
import org.springframework.transaction.annotation.Transactional | ||
|
||
@Service | ||
class CenterManagerService( | ||
private val centerManagerJpaRepository: CenterManagerJpaRepository, | ||
) { | ||
|
||
@Transactional | ||
fun save( | ||
identifier: String, | ||
password: String, | ||
phoneNumber: PhoneNumber, | ||
managerName: String, | ||
centerBusinessRegistrationNumber: BusinessRegistrationNumber, | ||
) { | ||
CenterManager( | ||
id = UuidCreator.create(), | ||
identifier = identifier, | ||
password = password, | ||
phoneNumber = phoneNumber.value, | ||
managerName = managerName, | ||
status = CenterAccountStatus.PENDING, | ||
centerBusinessRegistrationNumber = centerBusinessRegistrationNumber.value, | ||
).also { | ||
centerManagerJpaRepository.save(it) | ||
} | ||
} | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
idle-domain/src/main/kotlin/com/swm/idle/domain/center/vo/BusinessRegistrationNumber.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,13 @@ | ||
package com.swm.idle.domain.center.vo | ||
|
||
@JvmInline | ||
value class BusinessRegistrationNumber(val value: String) { | ||
|
||
init { | ||
require(value.matches(Regex(VALIDATION_REGEX))) | ||
} | ||
|
||
companion object { | ||
const val VALIDATION_REGEX = "^\\d{3}-\\d{2}-\\d{5}$" | ||
} | ||
} |