{"action":"created","comment":{"url":"https://api.github.com/repos/code-corps/code-corps-phoenix/pulls/comments/74686219","id":74686219,"diff_hunk":"@@ -0,0 +1,68 @@\n+defmodule CodeCorps.Project do\n+  @moduledoc \"\"\"\n+  \b\bRepresents a project on Code Corps, e.g. the \"Code Corps\" project itself.\n+  \"\"\"\n+\n+  use CodeCorps.Web, :model\n+\n+  import CodeCorps.Validators.SlugValidator\n+\n+  schema \"projects\" do\n+    field :description, :string\n+    field :icon_large_url, :string\n+    field :icon_thumb_url, :string\n+    field :long_description_body, :string\n+    field :long_description_markdown, :string\n+    field :slug, :string\n+    field :title, :string\n+\n+    belongs_to :organization, CodeCorps.Organization\n+\n+    timestamps()\n+  end\n+\n+  def changeset(struct, params) do\n+    struct\n+  \t|> cast(params, [:title, :description, :long_description_markdown])\n+    |> validate_required(:title)\n+    |> generate_slug()\n+    |> validate_slug(:slug)\n+    |> add_project_icons(Map.get(params, :base64_icon_data))\n+    |> render_markdown_to_html\n+  end\n+\n+  defp add_project_icons(changeset, nil), do: changeset\n+  defp add_project_icons(changeset, base64_icon_data) do\n+    # TODO: Deal with base64 conversion to image file\n+    # TODO: Deal with image file upload\n+    changeset\n+  end\n+\n+  defp generate_slug(changeset) do\n+    slug =\n+      get_change(changeset, :title)\n+      |> do_generate_slug\n+\n+    changeset\n+    |> put_change(:slug, slug)\n+  end\n+  defp do_generate_slug(nil), do: nil\n+  defp do_generate_slug(value), do: Inflex.parameterize(value)","path":"web/models/project.ex","position":50,"original_position":50,"commit_id":"971f8104288ee7992d26008c9fe17761af46a0da","original_commit_id":"830cfa55b6ac508f3db98087b6f3543a61ee36ca","user":{"login":"begedin","id":1925540,"avatar_url":"https://avatars.githubusercontent.com/u/1925540?v=3","gravatar_id":"","url":"https://api.github.com/users/begedin","html_url":"https://github.com/begedin","followers_url":"https://api.github.com/users/begedin/followers","following_url":"https://api.github.com/users/begedin/following{/other_user}","gists_url":"https://api.github.com/users/begedin/gists{/gist_id}","starred_url":"https://api.github.com/users/begedin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/begedin/subscriptions","organizations_url":"https://api.github.com/users/begedin/orgs","repos_url":"https://api.github.com/users/begedin/repos","events_url":"https://api.github.com/users/begedin/events{/privacy}","received_events_url":"https://api.github.com/users/begedin/received_events","type":"User","site_admin":false},"body":"Didn't realise we now have the function in a separate module. Switched to using that now.","created_at":"2016-08-13T12:20:43Z","updated_at":"2016-08-13T12:20:43Z","html_url":"https://github.com/code-corps/code-corps-phoenix/pull/62#discussion_r74686219","pull_request_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/pulls/62","_links":{"self":{"href":"https://api.github.com/repos/code-corps/code-corps-phoenix/pulls/comments/74686219"},"html":{"href":"https://github.com/code-corps/code-corps-phoenix/pull/62#discussion_r74686219"},"pull_request":{"href":"https://api.github.com/repos/code-corps/code-corps-phoenix/pulls/62"}}},"pull_request":{"url":"https://api.github.com/repos/code-corps/code-corps-phoenix/pulls/62","id":80817827,"html_url":"https://github.com/code-corps/code-corps-phoenix/pull/62","diff_url":"https://github.com/code-corps/code-corps-phoenix/pull/62.diff","patch_url":"https://github.com/code-corps/code-corps-phoenix/pull/62.patch","issue_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/issues/62","number":62,"state":"open","locked":false,"title":"Add projects API initial commit","user":{"login":"begedin","id":1925540,"avatar_url":"https://avatars.githubusercontent.com/u/1925540?v=3","gravatar_id":"","url":"https://api.github.com/users/begedin","html_url":"https://github.com/begedin","followers_url":"https://api.github.com/users/begedin/followers","following_url":"https://api.github.com/users/begedin/following{/other_user}","gists_url":"https://api.github.com/users/begedin/gists{/gist_id}","starred_url":"https://api.github.com/users/begedin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/begedin/subscriptions","organizations_url":"https://api.github.com/users/begedin/orgs","repos_url":"https://api.github.com/users/begedin/repos","events_url":"https://api.github.com/users/begedin/events{/privacy}","received_events_url":"https://api.github.com/users/begedin/received_events","type":"User","site_admin":false},"body":"This should now have everything except for conversion of base64 into an image and upload to AWS","created_at":"2016-08-10T15:43:19Z","updated_at":"2016-08-13T12:20:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"37fc79f532c9d9d01d21019b2b24cbdce6240a79","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/pulls/62/commits","review_comments_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/pulls/62/comments","review_comment_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/pulls/comments{/number}","comments_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/issues/62/comments","statuses_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/statuses/971f8104288ee7992d26008c9fe17761af46a0da","head":{"label":"code-corps:34-add-projects-api","ref":"34-add-projects-api","sha":"971f8104288ee7992d26008c9fe17761af46a0da","user":{"login":"code-corps","id":12991115,"avatar_url":"https://avatars.githubusercontent.com/u/12991115?v=3","gravatar_id":"","url":"https://api.github.com/users/code-corps","html_url":"https://github.com/code-corps","followers_url":"https://api.github.com/users/code-corps/followers","following_url":"https://api.github.com/users/code-corps/following{/other_user}","gists_url":"https://api.github.com/users/code-corps/gists{/gist_id}","starred_url":"https://api.github.com/users/code-corps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-corps/subscriptions","organizations_url":"https://api.github.com/users/code-corps/orgs","repos_url":"https://api.github.com/users/code-corps/repos","events_url":"https://api.github.com/users/code-corps/events{/privacy}","received_events_url":"https://api.github.com/users/code-corps/received_events","type":"Organization","site_admin":false},"repo":{"id":63497734,"name":"code-corps-phoenix","full_name":"code-corps/code-corps-phoenix","owner":{"login":"code-corps","id":12991115,"avatar_url":"https://avatars.githubusercontent.com/u/12991115?v=3","gravatar_id":"","url":"https://api.github.com/users/code-corps","html_url":"https://github.com/code-corps","followers_url":"https://api.github.com/users/code-corps/followers","following_url":"https://api.github.com/users/code-corps/following{/other_user}","gists_url":"https://api.github.com/users/code-corps/gists{/gist_id}","starred_url":"https://api.github.com/users/code-corps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-corps/subscriptions","organizations_url":"https://api.github.com/users/code-corps/orgs","repos_url":"https://api.github.com/users/code-corps/repos","events_url":"https://api.github.com/users/code-corps/events{/privacy}","received_events_url":"https://api.github.com/users/code-corps/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/code-corps/code-corps-phoenix","description":"Phoenix API for the Code Corps platform.","fork":false,"url":"https://api.github.com/repos/code-corps/code-corps-phoenix","forks_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/forks","keys_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/teams","hooks_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/hooks","issue_events_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/issues/events{/number}","events_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/events","assignees_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/assignees{/user}","branches_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/branches{/branch}","tags_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/tags","blobs_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/git/refs{/sha}","trees_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/statuses/{sha}","languages_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/languages","stargazers_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/stargazers","contributors_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/contributors","subscribers_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/subscribers","subscription_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/subscription","commits_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/commits{/sha}","git_commits_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/git/commits{/sha}","comments_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/comments{/number}","issue_comment_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/issues/comments{/number}","contents_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/contents/{+path}","compare_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/merges","archive_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/downloads","issues_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/issues{/number}","pulls_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/pulls{/number}","milestones_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/milestones{/number}","notifications_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/labels{/name}","releases_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/releases{/id}","deployments_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/deployments","created_at":"2016-07-16T18:49:25Z","updated_at":"2016-08-12T05:53:31Z","pushed_at":"2016-08-13T12:06:50Z","git_url":"git://github.com/code-corps/code-corps-phoenix.git","ssh_url":"git@github.com:code-corps/code-corps-phoenix.git","clone_url":"https://github.com/code-corps/code-corps-phoenix.git","svn_url":"https://github.com/code-corps/code-corps-phoenix","homepage":null,"size":159,"stargazers_count":9,"watchers_count":9,"language":"Elixir","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":48,"forks":2,"open_issues":48,"watchers":9,"default_branch":"develop"}},"base":{"label":"code-corps:develop","ref":"develop","sha":"4580b34e794671666c37629d1d534baef2bae130","user":{"login":"code-corps","id":12991115,"avatar_url":"https://avatars.githubusercontent.com/u/12991115?v=3","gravatar_id":"","url":"https://api.github.com/users/code-corps","html_url":"https://github.com/code-corps","followers_url":"https://api.github.com/users/code-corps/followers","following_url":"https://api.github.com/users/code-corps/following{/other_user}","gists_url":"https://api.github.com/users/code-corps/gists{/gist_id}","starred_url":"https://api.github.com/users/code-corps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-corps/subscriptions","organizations_url":"https://api.github.com/users/code-corps/orgs","repos_url":"https://api.github.com/users/code-corps/repos","events_url":"https://api.github.com/users/code-corps/events{/privacy}","received_events_url":"https://api.github.com/users/code-corps/received_events","type":"Organization","site_admin":false},"repo":{"id":63497734,"name":"code-corps-phoenix","full_name":"code-corps/code-corps-phoenix","owner":{"login":"code-corps","id":12991115,"avatar_url":"https://avatars.githubusercontent.com/u/12991115?v=3","gravatar_id":"","url":"https://api.github.com/users/code-corps","html_url":"https://github.com/code-corps","followers_url":"https://api.github.com/users/code-corps/followers","following_url":"https://api.github.com/users/code-corps/following{/other_user}","gists_url":"https://api.github.com/users/code-corps/gists{/gist_id}","starred_url":"https://api.github.com/users/code-corps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-corps/subscriptions","organizations_url":"https://api.github.com/users/code-corps/orgs","repos_url":"https://api.github.com/users/code-corps/repos","events_url":"https://api.github.com/users/code-corps/events{/privacy}","received_events_url":"https://api.github.com/users/code-corps/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/code-corps/code-corps-phoenix","description":"Phoenix API for the Code Corps platform.","fork":false,"url":"https://api.github.com/repos/code-corps/code-corps-phoenix","forks_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/forks","keys_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/teams","hooks_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/hooks","issue_events_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/issues/events{/number}","events_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/events","assignees_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/assignees{/user}","branches_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/branches{/branch}","tags_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/tags","blobs_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/git/refs{/sha}","trees_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/statuses/{sha}","languages_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/languages","stargazers_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/stargazers","contributors_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/contributors","subscribers_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/subscribers","subscription_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/subscription","commits_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/commits{/sha}","git_commits_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/git/commits{/sha}","comments_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/comments{/number}","issue_comment_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/issues/comments{/number}","contents_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/contents/{+path}","compare_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/merges","archive_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/downloads","issues_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/issues{/number}","pulls_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/pulls{/number}","milestones_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/milestones{/number}","notifications_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/labels{/name}","releases_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/releases{/id}","deployments_url":"https://api.github.com/repos/code-corps/code-corps-phoenix/deployments","created_at":"2016-07-16T18:49:25Z","updated_at":"2016-08-12T05:53:31Z","pushed_at":"2016-08-13T12:06:50Z","git_url":"git://github.com/code-corps/code-corps-phoenix.git","ssh_url":"git@github.com:code-corps/code-corps-phoenix.git","clone_url":"https://github.com/code-corps/code-corps-phoenix.git","svn_url":"https://github.com/code-corps/code-corps-phoenix","homepage":null,"size":159,"stargazers_count":9,"watchers_count":9,"language":"Elixir","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":48,"forks":2,"open_issues":48,"watchers":9,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/code-corps/code-corps-phoenix/pulls/62"},"html":{"href":"https://github.com/code-corps/code-corps-phoenix/pull/62"},"issue":{"href":"https://api.github.com/repos/code-corps/code-corps-phoenix/issues/62"},"comments":{"href":"https://api.github.com/repos/code-corps/code-corps-phoenix/issues/62/comments"},"review_comments":{"href":"https://api.github.com/repos/code-corps/code-corps-phoenix/pulls/62/comments"},"review_comment":{"href":"https://api.github.com/repos/code-corps/code-corps-phoenix/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/code-corps/code-corps-phoenix/pulls/62/commits"},"statuses":{"href":"https://api.github.com/repos/code-corps/code-corps-phoenix/statuses/971f8104288ee7992d26008c9fe17761af46a0da"}}}}
{"actor":{"display_login":"begedin"}}