{"action":"created","comment":{"url":"https://api.github.com/repos/elifesciences/elife-xpub/pulls/comments/194473053","pull_request_review_id":127652383,"id":194473053,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NDQ3MzA1Mw==","diff_hunk":"@@ -167,4 +167,121 @@ const emptyManuscript = {\n   },\n }\n \n-module.exports = { typeDefs, emptyManuscript }\n+const possibleStages = ['INITIAL', 'QA']\n+const manuscriptSchema = Joi.object()\n+  .keys({\n+    id: Joi.string().required(),\n+    title: Joi.string().required(),\n+    manuscriptType: Joi.string().required(),\n+    files: Joi.array().min(1),\n+    submissionMeta: Joi.object()\n+      .keys({\n+        coverLetter: Joi.string().required(),\n+        author: Joi.object()\n+          .keys({\n+            firstName: Joi.string().required(),\n+            lastName: Joi.string().required(),\n+            email: Joi.string()\n+              .email()\n+              .required(),\n+            institution: Joi.string().required(),\n+          })\n+          .required(),\n+        hasCorrespondent: Joi.boolean().required(),\n+        correspondent: Joi.when('hasCorrespondent', {\n+          is: true,\n+          then: Joi.object()\n+            .keys({\n+              firstName: Joi.string().required(),\n+              lastName: Joi.string().required(),\n+              email: Joi.string().required(),\n+              institution: Joi.string().required(),\n+            })\n+            .required(),\n+        }),\n+        stage: Joi.string()\n+          .valid(possibleStages)\n+          .required(),\n+        discussedPreviously: Joi.boolean().required(),\n+        discussion: Joi.when('discussedPreviously', {\n+          is: true,\n+          then: Joi.string().required(),\n+        }),\n+        consideredPreviously: Joi.boolean().required(),\n+        previousArticle: Joi.when('consideredPreviously', {\n+          is: true,\n+          then: Joi.string().required(),\n+        }),\n+        cosubmission: Joi.boolean().required(),\n+        cosubmissionTitle: Joi.string().allow(''),\n+        cosubmissionId: Joi.string().allow(''),\n+      })\n+      .required(),\n+    suggestedSeniorEditors: Joi.array()\n+      .items(Joi.string().required())\n+      .required(),\n+    opposedSeniorEditors: Joi.array().items(\n+      Joi.object().keys({\n+        name: Joi.string().required(),\n+        reason: Joi.string().required(),\n+      }),\n+    ),\n+    suggestedReviewingEditors: Joi.array()\n+      .items(Joi.string().required())\n+      .required(),\n+    opposedReviewingEditors: Joi.array().items(\n+      Joi.object().keys({\n+        name: Joi.string().required(),\n+        reason: Joi.string().required(),\n+      }),\n+    ),\n+    suggestedReviewers: Joi.array().items(\n+      Joi.object()\n+        .keys({\n+          name: Joi.string().required(),\n+          email: Joi.string()\n+            .email()\n+            .required(),\n+        })\n+        .required(),\n+    ),\n+    opposedReviewers: Joi.array().items(\n+      Joi.object().keys({\n+        name: Joi.string().required(),\n+        email: Joi.string()\n+          .email()\n+          .required(),\n+        reason: Joi.string().required(),\n+      }),\n+    ),\n+    noConflictOfInterest: Joi.boolean().required(),\n+  })\n+  .required()\n+\n+const cosubmissionSchema = Joi.alternatives().try(\n+  Joi.object().keys({\n+    cosubmission: Joi.boolean().required(),\n+    cosubmissionTitle: Joi.string().when('cosubmission', {\n+      is: true,\n+      then: Joi.required(),\n+      otherwise: Joi.allow(''),\n+    }),\n+    cosubmissionId: Joi.string().allow(''),\n+  }),\n+  Joi.object().keys({\n+    cosubmission: Joi.boolean().required(),\n+    cosubmissionTitle: Joi.string().allow(''),\n+    cosubmissionId: Joi.string().when('a', {\n+      is: true,\n+      then: Joi.required(),\n+      otherwise: Joi.string().allow(''),\n+    }),\n+  }),\n+)","path":"server/submission/definitions.js","position":151,"original_position":151,"commit_id":"09f022832fe08802153330595027195a9a1cf6b2","original_commit_id":"09f022832fe08802153330595027195a9a1cf6b2","user":{"login":"dryhten","id":1497469,"node_id":"MDQ6VXNlcjE0OTc0Njk=","avatar_url":"https://avatars0.githubusercontent.com/u/1497469?v=4","gravatar_id":"","url":"https://api.github.com/users/dryhten","html_url":"https://github.com/dryhten","followers_url":"https://api.github.com/users/dryhten/followers","following_url":"https://api.github.com/users/dryhten/following{/other_user}","gists_url":"https://api.github.com/users/dryhten/gists{/gist_id}","starred_url":"https://api.github.com/users/dryhten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dryhten/subscriptions","organizations_url":"https://api.github.com/users/dryhten/orgs","repos_url":"https://api.github.com/users/dryhten/repos","events_url":"https://api.github.com/users/dryhten/events{/privacy}","received_events_url":"https://api.github.com/users/dryhten/received_events","type":"User","site_admin":false},"body":"I assume we still want to use Joi since this is backend stuff? I'll look into how we can easily convert between the two.","created_at":"2018-06-11T16:53:07Z","updated_at":"2018-06-11T16:53:07Z","html_url":"https://github.com/elifesciences/elife-xpub/pull/168#discussion_r194473053","pull_request_url":"https://api.github.com/repos/elifesciences/elife-xpub/pulls/168","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/elifesciences/elife-xpub/pulls/comments/194473053"},"html":{"href":"https://github.com/elifesciences/elife-xpub/pull/168#discussion_r194473053"},"pull_request":{"href":"https://api.github.com/repos/elifesciences/elife-xpub/pulls/168"}},"in_reply_to_id":194428142},"pull_request":{"url":"https://api.github.com/repos/elifesciences/elife-xpub/pulls/168","id":192378032,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyMzc4MDMy","html_url":"https://github.com/elifesciences/elife-xpub/pull/168","diff_url":"https://github.com/elifesciences/elife-xpub/pull/168.diff","patch_url":"https://github.com/elifesciences/elife-xpub/pull/168.patch","issue_url":"https://api.github.com/repos/elifesciences/elife-xpub/issues/168","number":168,"state":"open","locked":false,"title":"feat(submission): create graphql mutation for form submission on final page","user":{"login":"dryhten","id":1497469,"node_id":"MDQ6VXNlcjE0OTc0Njk=","avatar_url":"https://avatars0.githubusercontent.com/u/1497469?v=4","gravatar_id":"","url":"https://api.github.com/users/dryhten","html_url":"https://github.com/dryhten","followers_url":"https://api.github.com/users/dryhten/followers","following_url":"https://api.github.com/users/dryhten/following{/other_user}","gists_url":"https://api.github.com/users/dryhten/gists{/gist_id}","starred_url":"https://api.github.com/users/dryhten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dryhten/subscriptions","organizations_url":"https://api.github.com/users/dryhten/orgs","repos_url":"https://api.github.com/users/dryhten/repos","events_url":"https://api.github.com/users/dryhten/events{/privacy}","received_events_url":"https://api.github.com/users/dryhten/received_events","type":"User","site_admin":false},"body":"* like this *","created_at":"2018-06-04T11:29:45Z","updated_at":"2018-06-11T16:53:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a1f77df54db009b34e5a9e185093cf69ff8183e7","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/elifesciences/elife-xpub/pulls/168/commits","review_comments_url":"https://api.github.com/repos/elifesciences/elife-xpub/pulls/168/comments","review_comment_url":"https://api.github.com/repos/elifesciences/elife-xpub/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elifesciences/elife-xpub/issues/168/comments","statuses_url":"https://api.github.com/repos/elifesciences/elife-xpub/statuses/09f022832fe08802153330595027195a9a1cf6b2","head":{"label":"elifesciences:153-final-form-submission","ref":"153-final-form-submission","sha":"09f022832fe08802153330595027195a9a1cf6b2","user":{"login":"elifesciences","id":1777367,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3NzczNjc=","avatar_url":"https://avatars2.githubusercontent.com/u/1777367?v=4","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"repo":{"id":100492246,"node_id":"MDEwOlJlcG9zaXRvcnkxMDA0OTIyNDY=","name":"elife-xpub","full_name":"elifesciences/elife-xpub","owner":{"login":"elifesciences","id":1777367,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3NzczNjc=","avatar_url":"https://avatars2.githubusercontent.com/u/1777367?v=4","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elifesciences/elife-xpub","description":"eLife is an open-access journal and technology provider that publishes promising research in the life and biomedical sciences. This is their implementation of a submission and peer review system based on Coko PubSweet and xPub.","fork":false,"url":"https://api.github.com/repos/elifesciences/elife-xpub","forks_url":"https://api.github.com/repos/elifesciences/elife-xpub/forks","keys_url":"https://api.github.com/repos/elifesciences/elife-xpub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elifesciences/elife-xpub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elifesciences/elife-xpub/teams","hooks_url":"https://api.github.com/repos/elifesciences/elife-xpub/hooks","issue_events_url":"https://api.github.com/repos/elifesciences/elife-xpub/issues/events{/number}","events_url":"https://api.github.com/repos/elifesciences/elife-xpub/events","assignees_url":"https://api.github.com/repos/elifesciences/elife-xpub/assignees{/user}","branches_url":"https://api.github.com/repos/elifesciences/elife-xpub/branches{/branch}","tags_url":"https://api.github.com/repos/elifesciences/elife-xpub/tags","blobs_url":"https://api.github.com/repos/elifesciences/elife-xpub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elifesciences/elife-xpub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elifesciences/elife-xpub/git/refs{/sha}","trees_url":"https://api.github.com/repos/elifesciences/elife-xpub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elifesciences/elife-xpub/statuses/{sha}","languages_url":"https://api.github.com/repos/elifesciences/elife-xpub/languages","stargazers_url":"https://api.github.com/repos/elifesciences/elife-xpub/stargazers","contributors_url":"https://api.github.com/repos/elifesciences/elife-xpub/contributors","subscribers_url":"https://api.github.com/repos/elifesciences/elife-xpub/subscribers","subscription_url":"https://api.github.com/repos/elifesciences/elife-xpub/subscription","commits_url":"https://api.github.com/repos/elifesciences/elife-xpub/commits{/sha}","git_commits_url":"https://api.github.com/repos/elifesciences/elife-xpub/git/commits{/sha}","comments_url":"https://api.github.com/repos/elifesciences/elife-xpub/comments{/number}","issue_comment_url":"https://api.github.com/repos/elifesciences/elife-xpub/issues/comments{/number}","contents_url":"https://api.github.com/repos/elifesciences/elife-xpub/contents/{+path}","compare_url":"https://api.github.com/repos/elifesciences/elife-xpub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elifesciences/elife-xpub/merges","archive_url":"https://api.github.com/repos/elifesciences/elife-xpub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elifesciences/elife-xpub/downloads","issues_url":"https://api.github.com/repos/elifesciences/elife-xpub/issues{/number}","pulls_url":"https://api.github.com/repos/elifesciences/elife-xpub/pulls{/number}","milestones_url":"https://api.github.com/repos/elifesciences/elife-xpub/milestones{/number}","notifications_url":"https://api.github.com/repos/elifesciences/elife-xpub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elifesciences/elife-xpub/labels{/name}","releases_url":"https://api.github.com/repos/elifesciences/elife-xpub/releases{/id}","deployments_url":"https://api.github.com/repos/elifesciences/elife-xpub/deployments","created_at":"2017-08-16T13:26:53Z","updated_at":"2018-06-11T14:26:24Z","pushed_at":"2018-06-11T15:26:38Z","git_url":"git://github.com/elifesciences/elife-xpub.git","ssh_url":"git@github.com:elifesciences/elife-xpub.git","clone_url":"https://github.com/elifesciences/elife-xpub.git","svn_url":"https://github.com/elifesciences/elife-xpub","homepage":"https://elifesciences.org/","size":2952,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","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":60,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":60,"watchers":4,"default_branch":"develop"}},"base":{"label":"elifesciences:develop","ref":"develop","sha":"fab477ac1096787369b3afaf260ede2c30e07299","user":{"login":"elifesciences","id":1777367,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3NzczNjc=","avatar_url":"https://avatars2.githubusercontent.com/u/1777367?v=4","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"repo":{"id":100492246,"node_id":"MDEwOlJlcG9zaXRvcnkxMDA0OTIyNDY=","name":"elife-xpub","full_name":"elifesciences/elife-xpub","owner":{"login":"elifesciences","id":1777367,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3NzczNjc=","avatar_url":"https://avatars2.githubusercontent.com/u/1777367?v=4","gravatar_id":"","url":"https://api.github.com/users/elifesciences","html_url":"https://github.com/elifesciences","followers_url":"https://api.github.com/users/elifesciences/followers","following_url":"https://api.github.com/users/elifesciences/following{/other_user}","gists_url":"https://api.github.com/users/elifesciences/gists{/gist_id}","starred_url":"https://api.github.com/users/elifesciences/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elifesciences/subscriptions","organizations_url":"https://api.github.com/users/elifesciences/orgs","repos_url":"https://api.github.com/users/elifesciences/repos","events_url":"https://api.github.com/users/elifesciences/events{/privacy}","received_events_url":"https://api.github.com/users/elifesciences/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elifesciences/elife-xpub","description":"eLife is an open-access journal and technology provider that publishes promising research in the life and biomedical sciences. This is their implementation of a submission and peer review system based on Coko PubSweet and xPub.","fork":false,"url":"https://api.github.com/repos/elifesciences/elife-xpub","forks_url":"https://api.github.com/repos/elifesciences/elife-xpub/forks","keys_url":"https://api.github.com/repos/elifesciences/elife-xpub/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elifesciences/elife-xpub/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elifesciences/elife-xpub/teams","hooks_url":"https://api.github.com/repos/elifesciences/elife-xpub/hooks","issue_events_url":"https://api.github.com/repos/elifesciences/elife-xpub/issues/events{/number}","events_url":"https://api.github.com/repos/elifesciences/elife-xpub/events","assignees_url":"https://api.github.com/repos/elifesciences/elife-xpub/assignees{/user}","branches_url":"https://api.github.com/repos/elifesciences/elife-xpub/branches{/branch}","tags_url":"https://api.github.com/repos/elifesciences/elife-xpub/tags","blobs_url":"https://api.github.com/repos/elifesciences/elife-xpub/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elifesciences/elife-xpub/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elifesciences/elife-xpub/git/refs{/sha}","trees_url":"https://api.github.com/repos/elifesciences/elife-xpub/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elifesciences/elife-xpub/statuses/{sha}","languages_url":"https://api.github.com/repos/elifesciences/elife-xpub/languages","stargazers_url":"https://api.github.com/repos/elifesciences/elife-xpub/stargazers","contributors_url":"https://api.github.com/repos/elifesciences/elife-xpub/contributors","subscribers_url":"https://api.github.com/repos/elifesciences/elife-xpub/subscribers","subscription_url":"https://api.github.com/repos/elifesciences/elife-xpub/subscription","commits_url":"https://api.github.com/repos/elifesciences/elife-xpub/commits{/sha}","git_commits_url":"https://api.github.com/repos/elifesciences/elife-xpub/git/commits{/sha}","comments_url":"https://api.github.com/repos/elifesciences/elife-xpub/comments{/number}","issue_comment_url":"https://api.github.com/repos/elifesciences/elife-xpub/issues/comments{/number}","contents_url":"https://api.github.com/repos/elifesciences/elife-xpub/contents/{+path}","compare_url":"https://api.github.com/repos/elifesciences/elife-xpub/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elifesciences/elife-xpub/merges","archive_url":"https://api.github.com/repos/elifesciences/elife-xpub/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elifesciences/elife-xpub/downloads","issues_url":"https://api.github.com/repos/elifesciences/elife-xpub/issues{/number}","pulls_url":"https://api.github.com/repos/elifesciences/elife-xpub/pulls{/number}","milestones_url":"https://api.github.com/repos/elifesciences/elife-xpub/milestones{/number}","notifications_url":"https://api.github.com/repos/elifesciences/elife-xpub/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elifesciences/elife-xpub/labels{/name}","releases_url":"https://api.github.com/repos/elifesciences/elife-xpub/releases{/id}","deployments_url":"https://api.github.com/repos/elifesciences/elife-xpub/deployments","created_at":"2017-08-16T13:26:53Z","updated_at":"2018-06-11T14:26:24Z","pushed_at":"2018-06-11T15:26:38Z","git_url":"git://github.com/elifesciences/elife-xpub.git","ssh_url":"git@github.com:elifesciences/elife-xpub.git","clone_url":"https://github.com/elifesciences/elife-xpub.git","svn_url":"https://github.com/elifesciences/elife-xpub","homepage":"https://elifesciences.org/","size":2952,"stargazers_count":4,"watchers_count":4,"language":"JavaScript","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":60,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":60,"watchers":4,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/elifesciences/elife-xpub/pulls/168"},"html":{"href":"https://github.com/elifesciences/elife-xpub/pull/168"},"issue":{"href":"https://api.github.com/repos/elifesciences/elife-xpub/issues/168"},"comments":{"href":"https://api.github.com/repos/elifesciences/elife-xpub/issues/168/comments"},"review_comments":{"href":"https://api.github.com/repos/elifesciences/elife-xpub/pulls/168/comments"},"review_comment":{"href":"https://api.github.com/repos/elifesciences/elife-xpub/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elifesciences/elife-xpub/pulls/168/commits"},"statuses":{"href":"https://api.github.com/repos/elifesciences/elife-xpub/statuses/09f022832fe08802153330595027195a9a1cf6b2"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"dryhten"}}