-
Notifications
You must be signed in to change notification settings - Fork 2
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
add support for tracker v41 #156
base: development
Are you sure you want to change the base?
Conversation
Task linked: CU-86964a9ua A12: Testing and feedback |
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.
Some in-line comments:
src/api/common.ts
Outdated
}; | ||
} | ||
|
||
type TrackedKeys = "trackedEntities" | "enrollments" | "events"; |
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.
type TrackedKey
. It seems plural, because of the enumeration, but in fact it's describing a value that will have some of this value, not a collection.
…for previous versions
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.
Cool, just some minor changes (already commited) and comments that need no action:
total: data.total, | ||
pageCount: data.pageCount, | ||
}; | ||
} |
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 ? a : b
-> a || b
src/api/common.ts
Outdated
|
||
export type PublicTrackerResponse<M extends D2ModelSchemaBase, Fields> = { | ||
instances: SelectedPick<M, Fields>[]; | ||
interface ParamTracker extends TrackedPager { | ||
pager: TrackedPager; |
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.
We set this prop as optional, that was the logic what motivated the a || b
logic. And also pager?: TrackedPager
in the 3 tracker responses from the api.
src/api/trackerEnrollments.ts
Outdated
export interface TrackerEnrollmentsResponse<Fields> { | ||
page: number; | ||
pageSize: number; | ||
export interface TrackerEnrollmentsResponse<Fields> extends TrackedPager { |
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.
To be struct, now we don't have always TrackedPager, in the future it will disappear. But since the logic to handle this is not trivial, let's leave as is, the runtime logic is correct.
📌 References
📝 Implementation
/tracker/trackedEntities
,/tracker/events
and/tracker/enrollments
no longer returns the data in aninstances
array anymore. Now they are using a key named after the plural of the returned entity./tracker/trackedEntities
/tracker/events
/tracker/enrollments
In order to keep backwards compatibility and to avoid breaking changes in
d2-api
we'll keep theinstances
attribute checking for aninstances
array and if there's none we fall back totrackedEntities
,events
orenrollments
according to the requested endpoint.pager
object:They are also keeping the pagination information outside the object for now, but it will be removed in a future release.
📹 Screenshots/Screen capture
🔥 Notes to the tester
Can you help me with a beta version, please? @adrianq
#86964a9ua