Skip to content

Commit

Permalink
Format code consistently and fix trailing comma issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nlisgo committed Dec 6, 2024
1 parent 4237680 commit 3f6ed29
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/form-validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ export const scriptFormSchema = Joi.object<PrepareManuscriptData>({
msid: Joi.string().trim().required(),
overridePreprints: Joi.string().optional().empty(''),
datePublished: Joi.string().trim().isoDate().required(),
dateRevised: Joi.string().trim().isoDate().optional().empty(''),
dateRevised: Joi.string().trim().isoDate().optional()
.empty(''),
evaluationSummaryId: Joi.string().trim().required(),
peerReviewId: Joi.string().trim().optional().empty(''),
authorResponseId: Joi.string().trim().optional().empty(''),
Expand Down
8 changes: 4 additions & 4 deletions src/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export const generateForm = (defaultValue?: string) => htmlPage(
<label for="manuscript-data">Input JSON:</label>
<textarea id="manuscript-data" style="width: 600px; height: 280px;" name="manuscript[data]" required>
${defaultValue ?? JSON.stringify({
id: '[ID]',
versions: [],
}, undefined, 2)}</textarea>
id: '[ID]',
versions: [],
}, undefined, 2)}</textarea>
<br/>
<label for="temporal_namespace">Select a Namespace:</label>
<select id="temporal_namespace" name="temporalNamespace" required>
Expand All @@ -34,7 +34,7 @@ export const generateForm = (defaultValue?: string) => htmlPage(
<br><br>
<button type="submit">Submit</button>
</form>`
</form>`,
);

export const generateScriptForm = () => htmlPage(
Expand Down
9 changes: 4 additions & 5 deletions src/manuscriptData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const hypothesis = async (id: string) => axios.get<{
return {
preprint: null,
date: null,
error: `Resource with ID ${id} not found.`
error: `Resource with ID ${id} not found.`,
};
}
throw error;
Expand Down Expand Up @@ -191,7 +191,7 @@ export const prepareManuscript = async (
date: null,
error: null,
};

const [
{
preprint: evaluationSummaryPreprint,
Expand All @@ -213,17 +213,16 @@ export const prepareManuscript = async (
...[
peerReview,
authorResponse,
].map((evaluationId) => evaluationId ? hypothesis(evaluationId) : hypothesisDefault)
].map((evaluationId) => (evaluationId ? hypothesis(evaluationId) : hypothesisDefault)),
]);

const errors = [
evaluationSummaryError,
peerReviewError,
authorResponseError,
]
.filter((e) => e !== null);


if (evaluationSummary === null || evaluationSummaryDate === null || errors.length > 0) {
if (errors.length === 0) {
errors.push('Evaluation summary not found!');
Expand Down

0 comments on commit 3f6ed29

Please sign in to comment.