Skip to content

Commit

Permalink
#3 add mappers
Browse files Browse the repository at this point in the history
  • Loading branch information
nastix123 committed Jul 16, 2024
1 parent 87ac4ad commit 5898b20
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions android/app/src/main/java/by/eapp/musicroom/data/Mappers.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package by.eapp.musicroom.data

import by.eapp.musicroom.domain.model.LoginData
import by.eapp.musicroom.domain.model.RefreshToken
import by.eapp.musicroom.domain.model.RegistrationData
import by.eapp.musicroom.domain.model.SubmitData
import by.eapp.musicroom.domain.model.Tokens
import by.eapp.musicroom.network.model.LoginDataDto
import by.eapp.musicroom.network.model.RefreshTokenDto
import by.eapp.musicroom.network.model.RegistrationDataDto
import by.eapp.musicroom.network.model.SubmitDataDto
import by.eapp.musicroom.network.model.TokensDto

//Registration
fun RegistrationData.toDto() = RegistrationDataDto(
email = email,
password = password,
nickname = nickname
)

fun LoginData.toDto() = LoginDataDto(
email = email,
password = password
)

fun SubmitData.toDto() = SubmitDataDto(
userId = userId,
code = code
)

fun TokensDto.toDomain() = Tokens(
accessToken = accessToken,
refreshToken = refreshToken
)

fun RefreshToken.toDto() = RefreshTokenDto(
refreshToken = token
)





0 comments on commit 5898b20

Please sign in to comment.