code_corps v0.0.1 CodeCorps.GitHub.Sync.Comment View Source
In charge of syncing CodeCorps.Comment records with a GitHub comment
payload.
A single GitHub comment always matches a single CodeCorps.GithubComment, but
it can match multiple CodeCorps.Comment records. This module handles
creating or updating all those records.
Link to this section Summary
Functions
Deletes CodeCorps.Comment records associated to CodeCorps.GithubComment
with specified github_id
Creates or updates a CodeCorps.Comment for the specified CodeCorps.Task
Creates or updates CodeCorps.Comment records for the specified
CodeCorps.GithubRepo
Link to this section Types
commit_result() :: {:ok, CodeCorps.Comment.t()} | {:error, Ecto.Changeset.t()}
commit_result_aggregate() :: {:ok, [CodeCorps.Comment.t()]} | {:error, {[CodeCorps.Comment.t()], [Ecto.Changeset.t()]}}
Link to this section Functions
delete(String.t()) :: {:ok, [CodeCorps.Comment.t()]}
Deletes CodeCorps.Comment records associated to CodeCorps.GithubComment
with specified github_id
Since there can be 0 or 1 such records, returns {:ok, results} where
results is a 1-element or blank list of deleted records.
sync(CodeCorps.Task.t(), CodeCorps.GithubComment.t(), CodeCorps.User.t()) :: commit_result()
Creates or updates a CodeCorps.Comment for the specified CodeCorps.Task.
When provided a CodeCorps.Task, a CodeCorps.GithubComment, a
CodeCorps.User, and a GitHub API payload, it creates or updates a
CodeCorps.Comment record, using the provided GitHub API
payload, associated to the specified CodeCorps.GithubComment,
CodeCorps.Task and CodeCorps.User
sync_github_repo(CodeCorps.GithubRepo.t()) :: commit_result_aggregate()
Creates or updates CodeCorps.Comment records for the specified
CodeCorps.GithubRepo.
For each CodeCorps.GithubComment record that relates to the
CodeCorps.GithubRepo for a given CodeCorps.GithubRepo:
- Find the related
CodeCorps.Taskrecord - Create or update the related
CodeCorps.Commentrecord - Associate the
CodeCorps.Commentrecord with theCodeCorps.Userthat relates to theCodeCorps.GithubUserfor theCodeCorps.GithubComment