ossn / fixme_backend

6 stars 17 forks source link

Fix issue sorting #5

Closed alexdor closed 4 years ago

alexdor commented 6 years ago

Each github issue has an updatedAt field. That field should be stored on a new database column. Once this is done the issue listing should sort the issues based on that column

NemoMarx commented 6 years ago

The UpdatedAt field already exists in schema.sql and issue.go. The only work that could be done here is sorting the issue listing, and I'm not sure if that belongs in the backend or the frontend. If the data is there the sorting doesn't sound complex though.

alexdor commented 6 years ago

@NemoMarx the existing updatedAt field shouldn't be changed. The purpose of the existing field is to keep track of when the database row is changed. A new column needs to be added (something like GithubUpdatedAt) to store the github updated at value

NemoMarx commented 6 years ago

Thanks for that clarification, that helps a lot!

NemoMarx commented 6 years ago

One more question, related to that.

In issue.go, the Issue struct lists UpdatedAt time.Time 'json:"updated_at" db:"updated_at" My reading of this is that it's pulling from the github apis JSON object for the updated at value, which seems to mean that it would be setting updatedAt based on what github has stored. Would it make more sense to point this at the new github_updated_at db entry instead, and then leave updatedAt for the time when the row in the db was updated?

alexdor commented 6 years ago

This UpdatedAt time.Time 'json:"updated_at" db:"updated_at" means that there will be a field in the model called UpdatedAt, with a type time.Time, when this field is rendered to json it would be called updated_at and when this field is passed to the database is should be called updated_at.

Each issue is populated with github info here

NemoMarx commented 6 years ago

So worker.go is pulling from the github API, then?

alexdor commented 6 years ago

Yeah worker.go is the one consuming GitHub’s GraphQL api On Thu, 27 Sep 2018 at 21.15, NemoMarx notifications@github.com wrote:

So worker.go is pulling from the github API, then?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ossn/fixme_backend/issues/5#issuecomment-425210873, or mute the thread https://github.com/notifications/unsubscribe-auth/AICth_0blf5A-ch1yP_ZZKDnUgKQp1X_ks5ufSPWgaJpZM4W8ooV .

alexdor commented 6 years ago

Do you have any familiarity with GraphQL? Is there something that I can help with? On Thu, 27 Sep 2018 at 21.17, Alexandros aldor94@gmail.com wrote:

Yeah worker.go is the one consuming GitHub’s GraphQL api On Thu, 27 Sep 2018 at 21.15, NemoMarx notifications@github.com wrote:

So worker.go is pulling from the github API, then?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ossn/fixme_backend/issues/5#issuecomment-425210873, or mute the thread https://github.com/notifications/unsubscribe-auth/AICth_0blf5A-ch1yP_ZZKDnUgKQp1X_ks5ufSPWgaJpZM4W8ooV .

NemoMarx commented 6 years ago

I have never used GraphQL before, unfortunately. I was assuming it was similar to a normal REST API, where there's a set JSON structure that you're expecting and pulling data out of it, but it doesn't look like that?

NemoMarx commented 6 years ago

Wait! Nevermind, I finally found the right page in the GraphQL documentation, I think I have a tentative change that would add it to schema.sql, issue.go, and worker.go.