adding the UI and other
This commit is contained in:
parent
7eee6518e8
commit
36ec674811
@ -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>
|
||||
|
@ -1,5 +1,14 @@
|
||||
package org.example
|
||||
|
||||
import org.example.data.faetures.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.faetures.authorize
|
||||
|
||||
import io.github.serpro69.kfaker.Faker
|
||||
import org.example.data.faetures.model.UserDTO
|
||||
import org.example.domain.Request.AuthorizeRequest
|
||||
import org.example.domain.Request.RegistrationRequest
|
||||
import org.example.domain.Response.UserResponse
|
||||
|
||||
class AuthorizeRepositoryImpl: AuthorizeRepository {
|
||||
class AuthorizeRepositoryImpl: AuthorizeRepository {
|
||||
val faker = Faker()
|
||||
val user = mutableListOf<UserDTO>(
|
||||
UserDTO()
|
||||
|
||||
)
|
||||
override fun auth(authorizeRequest: AuthorizeRequest): UserResponse {
|
||||
TODO("Not yet implemented")
|
||||
|
11
src/main/kotlin/domain/Service/AuthorizeService.kt
Normal file
11
src/main/kotlin/domain/Service/AuthorizeService.kt
Normal file
@ -0,0 +1,11 @@
|
||||
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.faetures.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