tnc-ca-geo / animl-api

Backend for https://animl.camera
4 stars 0 forks source link

getStats fails with date filters #166

Closed nathanielrindlaub closed 3 months ago

nathanielrindlaub commented 3 months ago

Typically, when ISO date time strings are passed into animl-api via GraphQL queries, we parse and convert those dates to Luxon DateTimes here.

So when we are consuming and using raw, un-parsed filter payloads (like those that we peel off of the GetStats task's SQS messages' config fields), some unexpected things can happen downstream with those dates. For example the buildPipeline() function converts what it expects to be Luxon DateTimes to JS Date objects here, which of course breaks when the createdStart isn't a Luxon DateTime but instead an ISO string.

nathanielrindlaub commented 3 months ago

The question is, where's the appropriate place to convert dates to Luxon DateTimes. I suppose we should do this in the task handler right after it reads in an SQS message?