{"action":"created","comment":{"url":"https://api.github.com/repos/traPtitech/traQ/pulls/comments/177435932","pull_request_review_id":107304523,"id":177435932,"diff_hunk":"@@ -32,28 +32,25 @@ func (channel *Channel) TableName() string {\n \treturn \"channels\"\n }\n \n+// Validate 構造体を検証します\n+func (channel *Channel) Validate() error {\n+\treturn validator.ValidateStruct(channel)\n+}\n+\n // Create チャンネル作成を行うメソッド\n func (channel *Channel) Create() error {\n \tif channel.ID != \"\" {\n \t\treturn fmt.Errorf(\"ID is not empty! You can use Update()\")\n \t}\n \n-\tif channel.Name == \"\" {\n-\t\treturn fmt.Errorf(\"name is empty\")\n-\t}\n-\n-\tif channel.CreatorID == \"\" {\n-\t\treturn fmt.Errorf(\"creatorID is empty\")\n-\t}\n-\n-\tif err := validateChannelName(channel.Name); err != nil {\n-\t\treturn err\n-\t}\n-\n \tchannel.ID = CreateUUID()\n \tchannel.IsVisible = true\n \tchannel.UpdaterID = channel.CreatorID\n \n+\tif err := channel.Validate(); err != nil {\n+\t\treturn err\n+\t}\n+\n \t// ここまでで入力されない要素は初期値(\"\"や0)で格納される\n \tif _, err := db.Insert(channel); err != nil {\n \t\treturn fmt.Errorf(\"failed to create channel: %v\", err)","path":"model/channels.go","position":null,"original_position":68,"commit_id":"e2e91ca214ed376df980986f51e473f906a50592","original_commit_id":"aa14044ed55aa9c2bd93a5fb24ecdf72099afe39","user":{"login":"wtks","id":30363887,"avatar_url":"https://avatars0.githubusercontent.com/u/30363887?v=4","gravatar_id":"","url":"https://api.github.com/users/wtks","html_url":"https://github.com/wtks","followers_url":"https://api.github.com/users/wtks/followers","following_url":"https://api.github.com/users/wtks/following{/other_user}","gists_url":"https://api.github.com/users/wtks/gists{/gist_id}","starred_url":"https://api.github.com/users/wtks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wtks/subscriptions","organizations_url":"https://api.github.com/users/wtks/orgs","repos_url":"https://api.github.com/users/wtks/repos","events_url":"https://api.github.com/users/wtks/events{/privacy}","received_events_url":"https://api.github.com/users/wtks/received_events","type":"User","site_admin":false},"body":"直した","created_at":"2018-03-27T14:03:36Z","updated_at":"2018-03-27T14:03:36Z","html_url":"https://github.com/traPtitech/traQ/pull/213#discussion_r177435932","pull_request_url":"https://api.github.com/repos/traPtitech/traQ/pulls/213","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/traPtitech/traQ/pulls/comments/177435932"},"html":{"href":"https://github.com/traPtitech/traQ/pull/213#discussion_r177435932"},"pull_request":{"href":"https://api.github.com/repos/traPtitech/traQ/pulls/213"}},"in_reply_to_id":177424329},"pull_request":{"url":"https://api.github.com/repos/traPtitech/traQ/pulls/213","id":177647623,"html_url":"https://github.com/traPtitech/traQ/pull/213","diff_url":"https://github.com/traPtitech/traQ/pull/213.diff","patch_url":"https://github.com/traPtitech/traQ/pull/213.patch","issue_url":"https://api.github.com/repos/traPtitech/traQ/issues/213","number":213,"state":"open","locked":false,"title":"refactoring","user":{"login":"wtks","id":30363887,"avatar_url":"https://avatars0.githubusercontent.com/u/30363887?v=4","gravatar_id":"","url":"https://api.github.com/users/wtks","html_url":"https://github.com/wtks","followers_url":"https://api.github.com/users/wtks/followers","following_url":"https://api.github.com/users/wtks/following{/other_user}","gists_url":"https://api.github.com/users/wtks/gists{/gist_id}","starred_url":"https://api.github.com/users/wtks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wtks/subscriptions","organizations_url":"https://api.github.com/users/wtks/orgs","repos_url":"https://api.github.com/users/wtks/repos","events_url":"https://api.github.com/users/wtks/events{/privacy}","received_events_url":"https://api.github.com/users/wtks/received_events","type":"User","site_admin":false},"body":"一部機能をモジュール化してutils内に移動させた。\r\nmodelのバリデーションを`go-playground/validator.v9`で書き換えた。\r\nmodelのリファクタリングをした","created_at":"2018-03-27T07:00:14Z","updated_at":"2018-03-27T14:03:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"15ff62e6f074709e2d4d7db80c7c023953aeb7f6","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/traPtitech/traQ/pulls/213/commits","review_comments_url":"https://api.github.com/repos/traPtitech/traQ/pulls/213/comments","review_comment_url":"https://api.github.com/repos/traPtitech/traQ/pulls/comments{/number}","comments_url":"https://api.github.com/repos/traPtitech/traQ/issues/213/comments","statuses_url":"https://api.github.com/repos/traPtitech/traQ/statuses/e2e91ca214ed376df980986f51e473f906a50592","head":{"label":"traPtitech:refactoring","ref":"refactoring","sha":"e2e91ca214ed376df980986f51e473f906a50592","user":{"login":"traPtitech","id":33317158,"avatar_url":"https://avatars2.githubusercontent.com/u/33317158?v=4","gravatar_id":"","url":"https://api.github.com/users/traPtitech","html_url":"https://github.com/traPtitech","followers_url":"https://api.github.com/users/traPtitech/followers","following_url":"https://api.github.com/users/traPtitech/following{/other_user}","gists_url":"https://api.github.com/users/traPtitech/gists{/gist_id}","starred_url":"https://api.github.com/users/traPtitech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/traPtitech/subscriptions","organizations_url":"https://api.github.com/users/traPtitech/orgs","repos_url":"https://api.github.com/users/traPtitech/repos","events_url":"https://api.github.com/users/traPtitech/events{/privacy}","received_events_url":"https://api.github.com/users/traPtitech/received_events","type":"Organization","site_admin":false},"repo":{"id":109331379,"name":"traQ","full_name":"traPtitech/traQ","owner":{"login":"traPtitech","id":33317158,"avatar_url":"https://avatars2.githubusercontent.com/u/33317158?v=4","gravatar_id":"","url":"https://api.github.com/users/traPtitech","html_url":"https://github.com/traPtitech","followers_url":"https://api.github.com/users/traPtitech/followers","following_url":"https://api.github.com/users/traPtitech/following{/other_user}","gists_url":"https://api.github.com/users/traPtitech/gists{/gist_id}","starred_url":"https://api.github.com/users/traPtitech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/traPtitech/subscriptions","organizations_url":"https://api.github.com/users/traPtitech/orgs","repos_url":"https://api.github.com/users/traPtitech/repos","events_url":"https://api.github.com/users/traPtitech/events{/privacy}","received_events_url":"https://api.github.com/users/traPtitech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/traPtitech/traQ","description":null,"fork":false,"url":"https://api.github.com/repos/traPtitech/traQ","forks_url":"https://api.github.com/repos/traPtitech/traQ/forks","keys_url":"https://api.github.com/repos/traPtitech/traQ/keys{/key_id}","collaborators_url":"https://api.github.com/repos/traPtitech/traQ/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/traPtitech/traQ/teams","hooks_url":"https://api.github.com/repos/traPtitech/traQ/hooks","issue_events_url":"https://api.github.com/repos/traPtitech/traQ/issues/events{/number}","events_url":"https://api.github.com/repos/traPtitech/traQ/events","assignees_url":"https://api.github.com/repos/traPtitech/traQ/assignees{/user}","branches_url":"https://api.github.com/repos/traPtitech/traQ/branches{/branch}","tags_url":"https://api.github.com/repos/traPtitech/traQ/tags","blobs_url":"https://api.github.com/repos/traPtitech/traQ/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/traPtitech/traQ/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/traPtitech/traQ/git/refs{/sha}","trees_url":"https://api.github.com/repos/traPtitech/traQ/git/trees{/sha}","statuses_url":"https://api.github.com/repos/traPtitech/traQ/statuses/{sha}","languages_url":"https://api.github.com/repos/traPtitech/traQ/languages","stargazers_url":"https://api.github.com/repos/traPtitech/traQ/stargazers","contributors_url":"https://api.github.com/repos/traPtitech/traQ/contributors","subscribers_url":"https://api.github.com/repos/traPtitech/traQ/subscribers","subscription_url":"https://api.github.com/repos/traPtitech/traQ/subscription","commits_url":"https://api.github.com/repos/traPtitech/traQ/commits{/sha}","git_commits_url":"https://api.github.com/repos/traPtitech/traQ/git/commits{/sha}","comments_url":"https://api.github.com/repos/traPtitech/traQ/comments{/number}","issue_comment_url":"https://api.github.com/repos/traPtitech/traQ/issues/comments{/number}","contents_url":"https://api.github.com/repos/traPtitech/traQ/contents/{+path}","compare_url":"https://api.github.com/repos/traPtitech/traQ/compare/{base}...{head}","merges_url":"https://api.github.com/repos/traPtitech/traQ/merges","archive_url":"https://api.github.com/repos/traPtitech/traQ/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/traPtitech/traQ/downloads","issues_url":"https://api.github.com/repos/traPtitech/traQ/issues{/number}","pulls_url":"https://api.github.com/repos/traPtitech/traQ/pulls{/number}","milestones_url":"https://api.github.com/repos/traPtitech/traQ/milestones{/number}","notifications_url":"https://api.github.com/repos/traPtitech/traQ/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/traPtitech/traQ/labels{/name}","releases_url":"https://api.github.com/repos/traPtitech/traQ/releases{/id}","deployments_url":"https://api.github.com/repos/traPtitech/traQ/deployments","created_at":"2017-11-03T00:00:46Z","updated_at":"2018-03-27T11:37:45Z","pushed_at":"2018-03-27T14:03:29Z","git_url":"git://github.com/traPtitech/traQ.git","ssh_url":"git@github.com:traPtitech/traQ.git","clone_url":"https://github.com/traPtitech/traQ.git","svn_url":"https://github.com/traPtitech/traQ","homepage":null,"size":3963,"stargazers_count":5,"watchers_count":5,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":34,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":1,"open_issues":34,"watchers":5,"default_branch":"master"}},"base":{"label":"traPtitech:master","ref":"master","sha":"c8437a4edf9079f69c260bbff491ca2e9f1c2f63","user":{"login":"traPtitech","id":33317158,"avatar_url":"https://avatars2.githubusercontent.com/u/33317158?v=4","gravatar_id":"","url":"https://api.github.com/users/traPtitech","html_url":"https://github.com/traPtitech","followers_url":"https://api.github.com/users/traPtitech/followers","following_url":"https://api.github.com/users/traPtitech/following{/other_user}","gists_url":"https://api.github.com/users/traPtitech/gists{/gist_id}","starred_url":"https://api.github.com/users/traPtitech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/traPtitech/subscriptions","organizations_url":"https://api.github.com/users/traPtitech/orgs","repos_url":"https://api.github.com/users/traPtitech/repos","events_url":"https://api.github.com/users/traPtitech/events{/privacy}","received_events_url":"https://api.github.com/users/traPtitech/received_events","type":"Organization","site_admin":false},"repo":{"id":109331379,"name":"traQ","full_name":"traPtitech/traQ","owner":{"login":"traPtitech","id":33317158,"avatar_url":"https://avatars2.githubusercontent.com/u/33317158?v=4","gravatar_id":"","url":"https://api.github.com/users/traPtitech","html_url":"https://github.com/traPtitech","followers_url":"https://api.github.com/users/traPtitech/followers","following_url":"https://api.github.com/users/traPtitech/following{/other_user}","gists_url":"https://api.github.com/users/traPtitech/gists{/gist_id}","starred_url":"https://api.github.com/users/traPtitech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/traPtitech/subscriptions","organizations_url":"https://api.github.com/users/traPtitech/orgs","repos_url":"https://api.github.com/users/traPtitech/repos","events_url":"https://api.github.com/users/traPtitech/events{/privacy}","received_events_url":"https://api.github.com/users/traPtitech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/traPtitech/traQ","description":null,"fork":false,"url":"https://api.github.com/repos/traPtitech/traQ","forks_url":"https://api.github.com/repos/traPtitech/traQ/forks","keys_url":"https://api.github.com/repos/traPtitech/traQ/keys{/key_id}","collaborators_url":"https://api.github.com/repos/traPtitech/traQ/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/traPtitech/traQ/teams","hooks_url":"https://api.github.com/repos/traPtitech/traQ/hooks","issue_events_url":"https://api.github.com/repos/traPtitech/traQ/issues/events{/number}","events_url":"https://api.github.com/repos/traPtitech/traQ/events","assignees_url":"https://api.github.com/repos/traPtitech/traQ/assignees{/user}","branches_url":"https://api.github.com/repos/traPtitech/traQ/branches{/branch}","tags_url":"https://api.github.com/repos/traPtitech/traQ/tags","blobs_url":"https://api.github.com/repos/traPtitech/traQ/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/traPtitech/traQ/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/traPtitech/traQ/git/refs{/sha}","trees_url":"https://api.github.com/repos/traPtitech/traQ/git/trees{/sha}","statuses_url":"https://api.github.com/repos/traPtitech/traQ/statuses/{sha}","languages_url":"https://api.github.com/repos/traPtitech/traQ/languages","stargazers_url":"https://api.github.com/repos/traPtitech/traQ/stargazers","contributors_url":"https://api.github.com/repos/traPtitech/traQ/contributors","subscribers_url":"https://api.github.com/repos/traPtitech/traQ/subscribers","subscription_url":"https://api.github.com/repos/traPtitech/traQ/subscription","commits_url":"https://api.github.com/repos/traPtitech/traQ/commits{/sha}","git_commits_url":"https://api.github.com/repos/traPtitech/traQ/git/commits{/sha}","comments_url":"https://api.github.com/repos/traPtitech/traQ/comments{/number}","issue_comment_url":"https://api.github.com/repos/traPtitech/traQ/issues/comments{/number}","contents_url":"https://api.github.com/repos/traPtitech/traQ/contents/{+path}","compare_url":"https://api.github.com/repos/traPtitech/traQ/compare/{base}...{head}","merges_url":"https://api.github.com/repos/traPtitech/traQ/merges","archive_url":"https://api.github.com/repos/traPtitech/traQ/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/traPtitech/traQ/downloads","issues_url":"https://api.github.com/repos/traPtitech/traQ/issues{/number}","pulls_url":"https://api.github.com/repos/traPtitech/traQ/pulls{/number}","milestones_url":"https://api.github.com/repos/traPtitech/traQ/milestones{/number}","notifications_url":"https://api.github.com/repos/traPtitech/traQ/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/traPtitech/traQ/labels{/name}","releases_url":"https://api.github.com/repos/traPtitech/traQ/releases{/id}","deployments_url":"https://api.github.com/repos/traPtitech/traQ/deployments","created_at":"2017-11-03T00:00:46Z","updated_at":"2018-03-27T11:37:45Z","pushed_at":"2018-03-27T14:03:29Z","git_url":"git://github.com/traPtitech/traQ.git","ssh_url":"git@github.com:traPtitech/traQ.git","clone_url":"https://github.com/traPtitech/traQ.git","svn_url":"https://github.com/traPtitech/traQ","homepage":null,"size":3963,"stargazers_count":5,"watchers_count":5,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":34,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":1,"open_issues":34,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/traPtitech/traQ/pulls/213"},"html":{"href":"https://github.com/traPtitech/traQ/pull/213"},"issue":{"href":"https://api.github.com/repos/traPtitech/traQ/issues/213"},"comments":{"href":"https://api.github.com/repos/traPtitech/traQ/issues/213/comments"},"review_comments":{"href":"https://api.github.com/repos/traPtitech/traQ/pulls/213/comments"},"review_comment":{"href":"https://api.github.com/repos/traPtitech/traQ/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/traPtitech/traQ/pulls/213/commits"},"statuses":{"href":"https://api.github.com/repos/traPtitech/traQ/statuses/e2e91ca214ed376df980986f51e473f906a50592"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"wtks"}}