-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SDMEXT354/Capability to attach same document to different entities #12
Conversation
const response = await axios.get(getFolderByPathURL, config); | ||
return response.data.properties["cmis:objectId"].value; | ||
} catch (error) { | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add console.log(error) here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
lib/handler/index.js
Outdated
@@ -64,7 +120,7 @@ async function createAttachment(data, credentials, token, attachments) { | |||
return response; | |||
} | |||
|
|||
async function deleteAttachment(credentials, token, objectId, attachments) { | |||
async function deleteAttachmentOrFolder(credentials, token, objectId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls rename it to deleteAttachmentsOfFolder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
lib/sdm.js
Outdated
this.isFileNameDuplicateInDrafts(attachment_val); | ||
if (duplicateDraftFilesErrMsg != "") { | ||
req.reject(409, duplicateDraftFileErr(duplicateDraftFilesErrMsg)); | ||
} | ||
//verify if duplicates exist for the drafts | ||
const duplicateFilesErrMsg = await this.isFileNameDuplicate( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will not be required now right as other entities you can add same files so we can remove this check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is for the case when user attaches same document multiple times in draft state.
Fix for this Bug: https://jira.tools.sap/browse/SDMEXT-383
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Removed isFileNameDuplicate()
lib/sdm.js
Outdated
parentId = response.data.succinctProperties["cmis:objectId"]; | ||
} | ||
} else { | ||
parentId = folderIds[0].folderId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we check if folderIds.? i mean not undefined and length>0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
lib/sdm.js
Outdated
@@ -103,6 +163,13 @@ module.exports = class SDMAttachmentsService extends ( | |||
if (attachmentsToDelete.length > 0) { | |||
req.attachmentsToDelete = attachmentsToDelete; | |||
} | |||
if (req.event == "DELETE") { | |||
const folderIds = await getFolderIdForEntity(attachments, req); | |||
if (folderIds.length > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check for undefined also
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Jira: https://jira.tools.sap/browse/SDMEXT-354
Bug: https://jira.tools.sap/browse/SDMEXT-381
Bug: https://jira.tools.sap/browse/SDMEXT-383
This PR includes: