Open daniyelp opened 2 years ago
Good point with the nullable id's, opened a issue with the backend https://github.com/code4romania/teacher-workout-backend/issues/74
There is a small discussion that needs to happen here,
The fact that data
and model
are hosted in the commons/ui
module does not look right, even name wise :)
The usual approach I see in the wild is for this model
and data
projects / modules to be shared in the entire app and host all repos / mappers and models of the app.
There are a couple of issues that this approach has that I will try to very briefly summarize:
I've made a POC with a proposed approach to data access https://github.com/code4romania/teacher-workout-android/pull/50
Please take a look and let me know what you think.
Good points at first. At the moment, I'm really caught into something and I'll try to take a deeper look into the PR Monday or Tuesday.
@alexandru-calinoiu As I said in the other PR, what I did doesn't seem like the the way to go. It's too much of a REST approach :dizzy_face:. So I think that we should close this PR. But regarding the last question I've asked, how would we fetch all the data needed for the home screen in one go?
@daniyelp one can write a query similar to this one to fetch all the data
query {
lessonStatuses(lessonIds: ["1"]) {
currentLessonStep {
id
... on SlideStep {
__typename
title
description
}
... on ExerciseStep {
__typename
}
}
}
themes {
edges {
node {
id
title
thumbnail {
url
}
}
}
}
}
But I think we need to open a ticket with the backend so that the lessonStatuses
query will bring all lesson statuses for the current user.
What does it fix?
Resolves #38.
As a quick sum-up, I imported the GraphQL schema, created the repository to fetch the lessons and the lesson themes and updated the screens to the new model classes (*interfaces) created by Apollo. It might not be ready for merging yet, because there were some things that got me confused / I wasn't quite sure of: