{"action":"created","comment":{"url":"https://api.github.com/repos/profefe/profefe/pulls/comments/242230726","pull_request_review_id":185694005,"id":242230726,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MjIzMDcyNg==","diff_hunk":"@@ -5,56 +5,115 @@ import (\n \t\"context\"\n \t\"errors\"\n \t\"fmt\"\n-\t\"log\"\n+\t\"io\"\n \t\"time\"\n \n \t\"github.com/google/pprof/profile\"\n-)\n-\n-var (\n-\tErrNotFound = errors.New(\"profile not found\")\n-\tErrEmpty    = errors.New(\"profile is empty\")\n+\t\"github.com/profefe/profefe/pkg/logger\"\n )\n \n type Repository struct {\n+\tlogger  *logger.Logger\n \tstorage Storage\n }\n \n-func NewRepository(st Storage) *Repository {\n+func NewRepository(log *logger.Logger, st Storage) *Repository {\n \treturn &Repository{\n+\t\tlogger:  log,\n \t\tstorage: st,\n \t}\n }\n \n-func (repo *Repository) ListProfiles(ctx context.Context) ([]*Profile, error) {\n-\treturn nil, fmt.Errorf(\"not implemented\")\n+type CreateProfileRequest struct {\n+\tID      string\n+\tService string\n+\tLabels  Labels\n }\n \n-type CreateProfileRequest struct {\n-\tMeta map[string]interface{} `json:\"meta\"`\n-\tData []byte                 `json:\"data\"`\n+func (req *CreateProfileRequest) Validate() error {\n+\tif req == nil {\n+\t\treturn errors.New(\"nil request\")\n+\t}\n+\n+\tif req.ID == \"\" {\n+\t\treturn fmt.Errorf(\"id empty: req %v\", req)\n+\t}\n+\tif req.Service == \"\" {\n+\t\treturn fmt.Errorf(\"service empty: req %v\", req)\n+\t}\n+\treturn nil\n }\n \n-func (repo *Repository) CreateProfile(ctx context.Context, req *CreateProfileRequest) (*Profile, error) {\n-\tif len(req.Data) == 0 {\n-\t\treturn nil, ErrEmpty\n+func (repo *Repository) CreateProfile(ctx context.Context, req *CreateProfileRequest) (token string, err error) {\n+\tservice := NewService(req.Service, req.ID, req.Labels)\n+\tprof := &Profile{\n+\t\tCreatedAt:  time.Now().UTC(),\n+\t\tReceivedAt: time.Now().UTC(),\n+\t\tService:    service,\n \t}\n \n-\tprof, err := profile.ParseData(req.Data)\n-\tif err != nil {\n-\t\treturn nil, fmt.Errorf(\"could not parse profile: %v\", err)\n+\tif err := repo.storage.Create(ctx, prof); err != nil {\n+\t\treturn \"\", err\n+\t}\n+\n+\trepo.logger.Debugw(\"create profile\", \"profile\", prof)\n+\n+\treturn service.Token.String(), nil\n+}\n+\n+type UpdateProfileRequest struct {","path":"pkg/profile/repository.go","position":78,"original_position":78,"commit_id":"0a19146bbaabb74ebe8d7822477d2c1320758aba","original_commit_id":"0a19146bbaabb74ebe8d7822477d2c1320758aba","user":{"login":"fixmie[bot]","id":44270338,"node_id":"MDM6Qm90NDQyNzAzMzg=","avatar_url":"https://avatars0.githubusercontent.com/in/19360?v=4","gravatar_id":"","url":"https://api.github.com/users/fixmie%5Bbot%5D","html_url":"https://github.com/apps/fixmie","followers_url":"https://api.github.com/users/fixmie%5Bbot%5D/followers","following_url":"https://api.github.com/users/fixmie%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/fixmie%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/fixmie%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fixmie%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/fixmie%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/fixmie%5Bbot%5D/repos","events_url":"https://api.github.com/users/fixmie%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/fixmie%5Bbot%5D/received_events","type":"Bot","site_admin":false},"body":"exported identifier \"UpdateProfileRequest\" should have comment\n```suggestion\n// UpdateProfileRequest ...\ntype UpdateProfileRequest struct {\n```","created_at":"2018-12-17T16:58:27Z","updated_at":"2018-12-17T16:58:30Z","html_url":"https://github.com/profefe/profefe/pull/1#discussion_r242230726","pull_request_url":"https://api.github.com/repos/profefe/profefe/pulls/1","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/profefe/profefe/pulls/comments/242230726"},"html":{"href":"https://github.com/profefe/profefe/pull/1#discussion_r242230726"},"pull_request":{"href":"https://api.github.com/repos/profefe/profefe/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/profefe/profefe/pulls/1","id":239216099,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM5MjE2MDk5","html_url":"https://github.com/profefe/profefe/pull/1","diff_url":"https://github.com/profefe/profefe/pull/1.diff","patch_url":"https://github.com/profefe/profefe/pull/1.patch","issue_url":"https://api.github.com/repos/profefe/profefe/issues/1","number":1,"state":"open","locked":false,"title":"Split profile creation request into create and update","user":{"login":"narqo","id":88045,"node_id":"MDQ6VXNlcjg4MDQ1","avatar_url":"https://avatars1.githubusercontent.com/u/88045?v=4","gravatar_id":"","url":"https://api.github.com/users/narqo","html_url":"https://github.com/narqo","followers_url":"https://api.github.com/users/narqo/followers","following_url":"https://api.github.com/users/narqo/following{/other_user}","gists_url":"https://api.github.com/users/narqo/gists{/gist_id}","starred_url":"https://api.github.com/users/narqo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/narqo/subscriptions","organizations_url":"https://api.github.com/users/narqo/orgs","repos_url":"https://api.github.com/users/narqo/repos","events_url":"https://api.github.com/users/narqo/events{/privacy}","received_events_url":"https://api.github.com/users/narqo/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-12-17T16:58:10Z","updated_at":"2018-12-17T16:58:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8014da1059eee17c9a663350c73aec9b8b95a781","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/profefe/profefe/pulls/1/commits","review_comments_url":"https://api.github.com/repos/profefe/profefe/pulls/1/comments","review_comment_url":"https://api.github.com/repos/profefe/profefe/pulls/comments{/number}","comments_url":"https://api.github.com/repos/profefe/profefe/issues/1/comments","statuses_url":"https://api.github.com/repos/profefe/profefe/statuses/0a19146bbaabb74ebe8d7822477d2c1320758aba","head":{"label":"profefe:collector-create-meta","ref":"collector-create-meta","sha":"0a19146bbaabb74ebe8d7822477d2c1320758aba","user":{"login":"profefe","id":39351927,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MzUxOTI3","avatar_url":"https://avatars3.githubusercontent.com/u/39351927?v=4","gravatar_id":"","url":"https://api.github.com/users/profefe","html_url":"https://github.com/profefe","followers_url":"https://api.github.com/users/profefe/followers","following_url":"https://api.github.com/users/profefe/following{/other_user}","gists_url":"https://api.github.com/users/profefe/gists{/gist_id}","starred_url":"https://api.github.com/users/profefe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/profefe/subscriptions","organizations_url":"https://api.github.com/users/profefe/orgs","repos_url":"https://api.github.com/users/profefe/repos","events_url":"https://api.github.com/users/profefe/events{/privacy}","received_events_url":"https://api.github.com/users/profefe/received_events","type":"Organization","site_admin":false},"repo":{"id":133731466,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM3MzE0NjY=","name":"profefe","full_name":"profefe/profefe","private":false,"owner":{"login":"profefe","id":39351927,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MzUxOTI3","avatar_url":"https://avatars3.githubusercontent.com/u/39351927?v=4","gravatar_id":"","url":"https://api.github.com/users/profefe","html_url":"https://github.com/profefe","followers_url":"https://api.github.com/users/profefe/followers","following_url":"https://api.github.com/users/profefe/following{/other_user}","gists_url":"https://api.github.com/users/profefe/gists{/gist_id}","starred_url":"https://api.github.com/users/profefe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/profefe/subscriptions","organizations_url":"https://api.github.com/users/profefe/orgs","repos_url":"https://api.github.com/users/profefe/repos","events_url":"https://api.github.com/users/profefe/events{/privacy}","received_events_url":"https://api.github.com/users/profefe/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/profefe/profefe","description":"wip! Collect profiling data for long-term analysis","fork":false,"url":"https://api.github.com/repos/profefe/profefe","forks_url":"https://api.github.com/repos/profefe/profefe/forks","keys_url":"https://api.github.com/repos/profefe/profefe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/profefe/profefe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/profefe/profefe/teams","hooks_url":"https://api.github.com/repos/profefe/profefe/hooks","issue_events_url":"https://api.github.com/repos/profefe/profefe/issues/events{/number}","events_url":"https://api.github.com/repos/profefe/profefe/events","assignees_url":"https://api.github.com/repos/profefe/profefe/assignees{/user}","branches_url":"https://api.github.com/repos/profefe/profefe/branches{/branch}","tags_url":"https://api.github.com/repos/profefe/profefe/tags","blobs_url":"https://api.github.com/repos/profefe/profefe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/profefe/profefe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/profefe/profefe/git/refs{/sha}","trees_url":"https://api.github.com/repos/profefe/profefe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/profefe/profefe/statuses/{sha}","languages_url":"https://api.github.com/repos/profefe/profefe/languages","stargazers_url":"https://api.github.com/repos/profefe/profefe/stargazers","contributors_url":"https://api.github.com/repos/profefe/profefe/contributors","subscribers_url":"https://api.github.com/repos/profefe/profefe/subscribers","subscription_url":"https://api.github.com/repos/profefe/profefe/subscription","commits_url":"https://api.github.com/repos/profefe/profefe/commits{/sha}","git_commits_url":"https://api.github.com/repos/profefe/profefe/git/commits{/sha}","comments_url":"https://api.github.com/repos/profefe/profefe/comments{/number}","issue_comment_url":"https://api.github.com/repos/profefe/profefe/issues/comments{/number}","contents_url":"https://api.github.com/repos/profefe/profefe/contents/{+path}","compare_url":"https://api.github.com/repos/profefe/profefe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/profefe/profefe/merges","archive_url":"https://api.github.com/repos/profefe/profefe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/profefe/profefe/downloads","issues_url":"https://api.github.com/repos/profefe/profefe/issues{/number}","pulls_url":"https://api.github.com/repos/profefe/profefe/pulls{/number}","milestones_url":"https://api.github.com/repos/profefe/profefe/milestones{/number}","notifications_url":"https://api.github.com/repos/profefe/profefe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/profefe/profefe/labels{/name}","releases_url":"https://api.github.com/repos/profefe/profefe/releases{/id}","deployments_url":"https://api.github.com/repos/profefe/profefe/deployments","created_at":"2018-05-16T22:58:24Z","updated_at":"2018-12-11T00:22:50Z","pushed_at":"2018-12-17T16:58:11Z","git_url":"git://github.com/profefe/profefe.git","ssh_url":"git@github.com:profefe/profefe.git","clone_url":"https://github.com/profefe/profefe.git","svn_url":"https://github.com/profefe/profefe","homepage":"","size":1342,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"profefe:master","ref":"master","sha":"3efb002cca41ca453bfd1384ae6ec82e79c62044","user":{"login":"profefe","id":39351927,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MzUxOTI3","avatar_url":"https://avatars3.githubusercontent.com/u/39351927?v=4","gravatar_id":"","url":"https://api.github.com/users/profefe","html_url":"https://github.com/profefe","followers_url":"https://api.github.com/users/profefe/followers","following_url":"https://api.github.com/users/profefe/following{/other_user}","gists_url":"https://api.github.com/users/profefe/gists{/gist_id}","starred_url":"https://api.github.com/users/profefe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/profefe/subscriptions","organizations_url":"https://api.github.com/users/profefe/orgs","repos_url":"https://api.github.com/users/profefe/repos","events_url":"https://api.github.com/users/profefe/events{/privacy}","received_events_url":"https://api.github.com/users/profefe/received_events","type":"Organization","site_admin":false},"repo":{"id":133731466,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM3MzE0NjY=","name":"profefe","full_name":"profefe/profefe","private":false,"owner":{"login":"profefe","id":39351927,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MzUxOTI3","avatar_url":"https://avatars3.githubusercontent.com/u/39351927?v=4","gravatar_id":"","url":"https://api.github.com/users/profefe","html_url":"https://github.com/profefe","followers_url":"https://api.github.com/users/profefe/followers","following_url":"https://api.github.com/users/profefe/following{/other_user}","gists_url":"https://api.github.com/users/profefe/gists{/gist_id}","starred_url":"https://api.github.com/users/profefe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/profefe/subscriptions","organizations_url":"https://api.github.com/users/profefe/orgs","repos_url":"https://api.github.com/users/profefe/repos","events_url":"https://api.github.com/users/profefe/events{/privacy}","received_events_url":"https://api.github.com/users/profefe/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/profefe/profefe","description":"wip! Collect profiling data for long-term analysis","fork":false,"url":"https://api.github.com/repos/profefe/profefe","forks_url":"https://api.github.com/repos/profefe/profefe/forks","keys_url":"https://api.github.com/repos/profefe/profefe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/profefe/profefe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/profefe/profefe/teams","hooks_url":"https://api.github.com/repos/profefe/profefe/hooks","issue_events_url":"https://api.github.com/repos/profefe/profefe/issues/events{/number}","events_url":"https://api.github.com/repos/profefe/profefe/events","assignees_url":"https://api.github.com/repos/profefe/profefe/assignees{/user}","branches_url":"https://api.github.com/repos/profefe/profefe/branches{/branch}","tags_url":"https://api.github.com/repos/profefe/profefe/tags","blobs_url":"https://api.github.com/repos/profefe/profefe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/profefe/profefe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/profefe/profefe/git/refs{/sha}","trees_url":"https://api.github.com/repos/profefe/profefe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/profefe/profefe/statuses/{sha}","languages_url":"https://api.github.com/repos/profefe/profefe/languages","stargazers_url":"https://api.github.com/repos/profefe/profefe/stargazers","contributors_url":"https://api.github.com/repos/profefe/profefe/contributors","subscribers_url":"https://api.github.com/repos/profefe/profefe/subscribers","subscription_url":"https://api.github.com/repos/profefe/profefe/subscription","commits_url":"https://api.github.com/repos/profefe/profefe/commits{/sha}","git_commits_url":"https://api.github.com/repos/profefe/profefe/git/commits{/sha}","comments_url":"https://api.github.com/repos/profefe/profefe/comments{/number}","issue_comment_url":"https://api.github.com/repos/profefe/profefe/issues/comments{/number}","contents_url":"https://api.github.com/repos/profefe/profefe/contents/{+path}","compare_url":"https://api.github.com/repos/profefe/profefe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/profefe/profefe/merges","archive_url":"https://api.github.com/repos/profefe/profefe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/profefe/profefe/downloads","issues_url":"https://api.github.com/repos/profefe/profefe/issues{/number}","pulls_url":"https://api.github.com/repos/profefe/profefe/pulls{/number}","milestones_url":"https://api.github.com/repos/profefe/profefe/milestones{/number}","notifications_url":"https://api.github.com/repos/profefe/profefe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/profefe/profefe/labels{/name}","releases_url":"https://api.github.com/repos/profefe/profefe/releases{/id}","deployments_url":"https://api.github.com/repos/profefe/profefe/deployments","created_at":"2018-05-16T22:58:24Z","updated_at":"2018-12-11T00:22:50Z","pushed_at":"2018-12-17T16:58:11Z","git_url":"git://github.com/profefe/profefe.git","ssh_url":"git@github.com:profefe/profefe.git","clone_url":"https://github.com/profefe/profefe.git","svn_url":"https://github.com/profefe/profefe","homepage":"","size":1342,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/profefe/profefe/pulls/1"},"html":{"href":"https://github.com/profefe/profefe/pull/1"},"issue":{"href":"https://api.github.com/repos/profefe/profefe/issues/1"},"comments":{"href":"https://api.github.com/repos/profefe/profefe/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/profefe/profefe/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/profefe/profefe/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/profefe/profefe/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/profefe/profefe/statuses/0a19146bbaabb74ebe8d7822477d2c1320758aba"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"fixmie"}}