update create article api
This commit is contained in:
@ -340,29 +340,12 @@ export const createArticleResolver = authorized<
|
||||
}
|
||||
}
|
||||
|
||||
let libraryItemToReturn: LibraryItem
|
||||
|
||||
const existingLibraryItem = await findLibraryItemByUrl(
|
||||
libraryItemToSave.originalUrl,
|
||||
uid
|
||||
// create new item in database
|
||||
const libraryItemToReturn = await createOrUpdateLibraryItem(
|
||||
libraryItemToSave,
|
||||
uid,
|
||||
pubsub
|
||||
)
|
||||
articleSavingRequestId = existingLibraryItem?.id || articleSavingRequestId
|
||||
if (articleSavingRequestId) {
|
||||
// update existing item's state from processing to succeeded
|
||||
libraryItemToReturn = await updateLibraryItem(
|
||||
articleSavingRequestId,
|
||||
libraryItemToSave as QueryDeepPartialEntity<LibraryItem>,
|
||||
uid,
|
||||
pubsub
|
||||
)
|
||||
} else {
|
||||
// create new item in database
|
||||
libraryItemToReturn = await createOrUpdateLibraryItem(
|
||||
libraryItemToSave,
|
||||
uid,
|
||||
pubsub
|
||||
)
|
||||
}
|
||||
|
||||
await createAndSaveLabelsInLibraryItem(
|
||||
libraryItemToReturn.id,
|
||||
@ -371,14 +354,6 @@ export const createArticleResolver = authorized<
|
||||
rssFeedUrl
|
||||
)
|
||||
|
||||
log.info(
|
||||
'item created in database',
|
||||
libraryItemToReturn.id,
|
||||
libraryItemToReturn.originalUrl,
|
||||
libraryItemToReturn.slug,
|
||||
libraryItemToReturn.title
|
||||
)
|
||||
|
||||
return {
|
||||
user,
|
||||
created: true,
|
||||
|
||||
Reference in New Issue
Block a user