-
Notifications
You must be signed in to change notification settings - Fork 0
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
MPA-90_refactor-kotlin-result-to-request-result #11
base: MPA-78_create-new-event
Are you sure you want to change the base?
MPA-90_refactor-kotlin-result-to-request-result #11
Conversation
…-to-request-result
class EventRepository(private val apiClient: IEventApiClient) : IEventRepository { | ||
override suspend fun getAllEventsForUser(userId: String): Result<List<EventDTO>> { | ||
return apiClient.getAllEventsForUser(userId) | ||
override suspend fun getAllEventsForUser(userId: String): RequestResult<List<EventDTO>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vão ter camada de domínio no projeto? Se sim, não faz muito sentido um repositório, que é suposto devolver domain models, devolver um RequestResult
. O domínio é agnóstico à origem dos dados.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A ideia era facilitar a passagem de erros para as camadas que chamam os repo
@@ -43,8 +49,8 @@ class EventRepository(private val apiClient: IEventApiClient) : IEventRepository | |||
includesBreakfast: Boolean?, | |||
city: String?, | |||
project: ProjectDTO? | |||
): Result<Nothing?> { | |||
): RequestResult<Nothing?> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isto não te vai rebentar sempre que chamares o método? Se queres devolver "nada" usa Unit
. O Nothing
dá trigger a excepções se bem me lembro.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mudar o Nothing
para Unit
…A-90_refactor-kotlin-result-to-request-result
This PR changes the return type of the repositories from Kotlin Result to RequestResult, which is equivalent to the former, and allows Swift code to access the Result value or error.