From 9090b9be09021e118c08f2da9a4e7cc6661beaa3 Mon Sep 17 00:00:00 2001 From: shadrach Date: Wed, 30 Oct 2024 09:31:58 -0500 Subject: [PATCH] fix: author id is missing from metadata extraction automation --- desci-server/src/controllers/nodes/doi.ts | 2 ++ desci-server/src/services/AutomatedMetadata.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/desci-server/src/controllers/nodes/doi.ts b/desci-server/src/controllers/nodes/doi.ts index 2a03e164..fcbbd47e 100644 --- a/desci-server/src/controllers/nodes/doi.ts +++ b/desci-server/src/controllers/nodes/doi.ts @@ -10,6 +10,7 @@ import { import { NextFunction, Response } from 'express'; import { Request } from 'express'; import _ from 'lodash'; +import { v4 as uuidv4 } from 'uuid'; import { z } from 'zod'; import { BadRequestError, NotFoundError, UnProcessableRequestError } from '../../core/ApiError.js'; @@ -182,6 +183,7 @@ export const automateManuscriptDoi = async (req: RequestWithNode, res: Response, actions.push({ type: 'Set Contributors', contributors: authors.map((author) => ({ + id: uuidv4(), name: author.name, role: ResearchObjectV1AuthorRole.AUTHOR, ...(author.affiliations.length > 0 && { organizations: author.affiliations }), diff --git a/desci-server/src/services/AutomatedMetadata.ts b/desci-server/src/services/AutomatedMetadata.ts index 1775ca5a..889e5021 100644 --- a/desci-server/src/services/AutomatedMetadata.ts +++ b/desci-server/src/services/AutomatedMetadata.ts @@ -4,6 +4,7 @@ import { DocumentId } from '@automerge/automerge-repo'; import { ManifestActions, ResearchObjectV1Author, ResearchObjectV1AuthorRole } from '@desci-labs/desci-models'; import axios from 'axios'; import FormData from 'form-data'; +import { v4 as uuidv4 } from 'uuid'; import { logger as parentLogger } from '../logger.js'; import { ONE_DAY_TTL, getFromCache, setToCache } from '../redisClient.js'; @@ -314,6 +315,7 @@ export class AutomatedMetadataClient { contributors: metadata.authors.map( (author) => ({ + id: uuidv4(), name: author.name, role: ResearchObjectV1AuthorRole.AUTHOR, ...(author.affiliations.length > 0 && { organizations: author.affiliations }),