code-corps-api icon indicating copy to clipboard operation
code-corps-api copied to clipboard

Github-x model creation should be find or create by

Open joshsmith opened this issue 7 years ago • 1 comments

Problem

All our Github-x model creation should be done as a find or create by using the github_id. Right now, the assumption is that this is the first insert which is incorrect.

joshsmith avatar Oct 17 '17 22:10 joshsmith

This appears to be mostly fine for:

  • GithubAppInstallation (for unmatched users)
  • GithubPullRequest
  • GithubIssue
  • GithubComment
  • GithubRepo
  • GithubEvent (technically does not count since there is only a delivery id)

...which all use get_by with a case statement to create or update the record. We may want to consider rewriting these, though, to be more explicit.

I'm also a little confused right now about how GitHub.Event.Installation.MatchedUser works.

The GithubAppInstallation and GithubRepo need the syncing moved out of GitHub.Event into GitHub.Sync, where it will be much clearer that these are covered.

I'm moving this to another milestone since it appears that we're good enough right now.

joshsmith avatar Oct 22 '17 00:10 joshsmith