add services
This commit is contained in:
parent
4e786dbbf5
commit
532475fb91
@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
|
@ -10,6 +10,7 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("io.github.serpro69:kotlin-faker:2.0.0-rc.7")
|
||||
testImplementation(kotlin("test"))
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,16 @@
|
||||
package org.example
|
||||
|
||||
import org.example.data.features.authorize.AuthorizeRepositoryImpl
|
||||
import org.example.domain.Service.AuthorizeServiceImpl
|
||||
import org.example.ui.model.AuthorizeUI
|
||||
|
||||
fun main() {
|
||||
println("Hello World!")
|
||||
|
||||
val authorizeRepository = AuthorizeRepositoryImpl()
|
||||
val authorizeServiceImpl = AuthorizeServiceImpl(authorizeRepository)
|
||||
val authorizeUI = AuthorizeUI(authorizeServiceImpl)
|
||||
|
||||
authorizeUI.registration()
|
||||
authorizeUI.authorize()
|
||||
|
||||
}
|
@ -1,13 +1,15 @@
|
||||
package org.example.data.features.authorize
|
||||
|
||||
import io.github.serpro69.kfaker.Faker
|
||||
import org.example.data.features.model.UserDTO
|
||||
import org.example.domain.Request.AuthorizeRequest
|
||||
import org.example.domain.Request.RegistrationRequest
|
||||
import org.example.domain.Response.UserResponse
|
||||
|
||||
class AuthorizeRepositoryImpl: AuthorizeRepository {
|
||||
val faker = Faker()
|
||||
val user = mutableListOf<UserDTO>(
|
||||
UserDTO()
|
||||
|
||||
)
|
||||
override fun auth(authorizeRequest: AuthorizeRequest): UserResponse {
|
||||
TODO("Not yet implemented")
|
||||
|
10
src/main/kotlin/domain/Service/AuthorizeService.kt
Normal file
10
src/main/kotlin/domain/Service/AuthorizeService.kt
Normal file
@ -0,0 +1,10 @@
|
||||
package org.example.domain.Service
|
||||
|
||||
import org.example.domain.Request.AuthorizeRequest
|
||||
import org.example.domain.Request.RegistrationRequest
|
||||
import org.example.ui.model.UserPresenter
|
||||
|
||||
interface AuthorizeService {
|
||||
fun auth(authorizeRequest: AuthorizeRequest): UserPresenter
|
||||
fun registration(registrationRequest: RegistrationRequest): UserPresenter
|
||||
}
|
17
src/main/kotlin/domain/Service/AuthorizeServiceImpl.kt
Normal file
17
src/main/kotlin/domain/Service/AuthorizeServiceImpl.kt
Normal file
@ -0,0 +1,17 @@
|
||||
package org.example.domain.Service
|
||||
|
||||
import org.example.data.features.authorize.AuthorizeRepository
|
||||
import org.example.domain.Request.AuthorizeRequest
|
||||
import org.example.domain.Request.RegistrationRequest
|
||||
import org.example.ui.model.UserPresenter
|
||||
|
||||
class AuthorizeServiceImpl(private val authorizeRepository: AuthorizeRepository):AuthorizeService {
|
||||
override fun auth(authorizeRequest: AuthorizeRequest): UserPresenter {
|
||||
val user = authorizeRepository.auth(authorizeRequest)
|
||||
return UserPresenter()
|
||||
}
|
||||
|
||||
override fun registration(registrationRequest: RegistrationRequest): UserPresenter {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
}
|
19
src/main/kotlin/ui/model/AuthorizeUI.kt
Normal file
19
src/main/kotlin/ui/model/AuthorizeUI.kt
Normal file
@ -0,0 +1,19 @@
|
||||
package org.example.ui.model
|
||||
|
||||
import org.example.domain.Request.AuthorizeRequest
|
||||
import org.example.domain.Service.AuthorizeService
|
||||
|
||||
class AuthorizeUI(val authorizeService: AuthorizeService) {
|
||||
fun authorize(){
|
||||
println("Enter the email")
|
||||
val email = readlnOrNull()
|
||||
println("Enter the password")
|
||||
val password = readlnOrNull()
|
||||
checkNotNull(email)
|
||||
checkNotNull(password)
|
||||
authorizeService.auth(AuthorizeRequest(email = email, password = password))
|
||||
}
|
||||
fun registration(){
|
||||
|
||||
}
|
||||
}
|
3
src/main/kotlin/ui/model/UserPresenter.kt
Normal file
3
src/main/kotlin/ui/model/UserPresenter.kt
Normal file
@ -0,0 +1,3 @@
|
||||
package org.example.ui.model
|
||||
|
||||
data class UserPresenter()
|
Loading…
Reference in New Issue
Block a user