Fix validation of project-output-file, no build_id for imported v1 projects

This commit is contained in:
Shane Kilkelly 2018-06-25 12:27:56 +01:00
parent f6424ada40
commit 04be842b30
2 changed files with 12 additions and 7 deletions

View file

@ -93,8 +93,14 @@ module.exports = ProjectOutputFileAgent = {
_getSourceProject: LinkedFilesHandler.getSourceProject
_validate: (data) ->
return (
(data.source_project_id? || data.v1_source_doc_id?) &&
if data.v1_source_doc_id?
(
data.v1_source_doc_id? &&
data.source_output_file_path?
)
else
(
data.source_project_id? &&
data.source_output_file_path? &&
data.build_id?
)

View file

@ -428,8 +428,7 @@ describe "LinkedFiles", ->
linkedFileData: {
provider: "project_output_file",
v1_source_doc_id: 9999999, # We won't find this id in the database
source_output_file_path: "project.pdf",
build_id: '123'
source_output_file_path: "project.pdf"
},
_id: "abcdef",
rev: 0,