code-corps-api
code-corps-api copied to clipboard
Github-x model creation should be find or create by
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.
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.