Skip to content
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-77_get-events-by-policy #8

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from

Conversation

DaniCamelo
Copy link

getEventsByPolicy
Implementation of getting events of an user filtered by a policy

@@ -11,6 +11,19 @@ class EventApiClient(engine: HttpClientEngine) : IEventApiClient {

private val apiHttpClient = ApiHttpClient(engine)
private val httpClient = apiHttpClient.httpClient
override suspend fun getEventsByPolicy(userId: String, policyId: String): Result<List<EventDTO>> {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline? :)

if (response.status == HttpStatusCode.OK) {
Result.success(response.body())
} else {
Result.failure(Exception(response.status.description))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Há algum tipo de documentação ou swagger que diga o tipo de excepções que podem ocorrer?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Não, é por isso que decidimos criar uma exception com a mensagem que vem da API

Copy link

@rcosteira79 rcosteira79 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Só um aparte na organização do projecto: evitem ter packages com nomes genéricos tipo "interfaces". Com o tempo, acabam por ficar cheios de ficheiros baseados no tipo de ficheiro (neste caso, interfaces), em vez de baseado no comportamento/propósito dos ficheiros. Por outras palavras, é mais fácil manter o código a longo prazo se os ficheiros que estão tightly coupled estiverem perto uns dos outros.

Base automatically changed from MPA-71_get-specific-event to develop May 11, 2023 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants