-
Notifications
You must be signed in to change notification settings - Fork 83
When creating a task, if it belongs to a GithubRepo, create associated issue on github #804
Copy link
Copy link
Closed
Milestone
Description
Problem
A project can be tied to one or more github repositories, through the ProjectGithubRepo relation
When creating a task for a project, the attributes should contain a github_repo_id, meaning a task should now belong to a GithubRepo (but the relationship can be nil).
While we're handling this, we should extract task controller behavior into a separate module.
Subtasks
- If it doesn't already exist, add
/lib/code_corps/task/task.exmodule (namespaceCodeCorps.Task - Add
create/2function to that module- Function accepts an attributes map and the current user
- Function initializes task (associated with
GithubRepo), creates an associated github issue for the assigned github repo, the stores that github issue number as the task:github_numberfield and finally saves the task - Function returns
{:ok, task}or{:error, changeset}or{:error, _} - If the current user is GitHub connected, the github API calls should be made on their behalf. If not, they should be made on the behalf of the identity provided in Provide default github user for the purposes of github integration #800
- Modify
TaskController.createto call the new module function - Add tests for new function which assert these four cases:
- Task with no github id is created,
{:ok, task}was returned, no github api call was made - Task with github id was created,
{:ok, task}was returned, a github call was made - There was a validation error
- There was some other error
- Task with no github id is created,
Reactions are currently unavailable