Skip to content

Commit

Permalink
Merge pull request #82 from datasci4health/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
lealfp authored Aug 30, 2020
2 parents 1d70f53 + 148efd5 commit 64b409f
Show file tree
Hide file tree
Showing 20 changed files with 61 additions and 8 deletions.
57 changes: 56 additions & 1 deletion src/adonisjs/app/Controllers/Http/v1/ArtifactController.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,64 @@ class ArtifactController {
console.log(e)
return response.status(e.status).json({ message: e.message })
}
}

// O CÓDIGO COMENTADO É PRA NO FUTURO QUANDO A PASTA DAS IMAGENS FOR RESOURCES INVES DE PUBLIC

}
// async store({ request, auth, response }) {
// try{

// const file = request.file('file', this.validationOptions)
// const case_id = request.input('case_id', null)

// var c = await Case.find(case_id)

// if (case_id != null && c == null){
// return response.json({ message: "Case id not found" })
// }

// let fs_path = Helpers.resourcesPath() + '/artifacts/'
// let case_relative_path = Helpers.resourcesPath() + '/artifacts/'
// if (case_id != null){
// fs_path += 'cases/' + case_id + '/'
// case_relative_path += 'cases/' + case_id + '/'
// }

// const artifact_id = await uuid4()
// const artifact_file_name = artifact_id + "." + file.extname

// await file.move(fs_path, {name: artifact_file_name, overwrite: false})

// const artifact = new Artifact()
// artifact.id = artifact_id
// artifact.fs_path = fs_path + artifact_file_name
// artifact.relative_path = case_relative_path + artifact_file_name
// artifact.case_id = c != null ? c.id : c;

// const base_url = Env.getOrFail('APP_URL')

// let bodyMessage = { message: "Artifact successfully stored",
// filename: artifact_file_name,
// case: c,
// size_in_bytes: file.size,
// type: file.type,
// subtype: file.subtype,
// extension: file.extname,
// status: file.status,
// relative_path: artifact.relative_path,
// url: base_url+artifact.relative_path
// }

// await auth.user.artifacts().save(artifact)

// return response.status(200).json(bodyMessage)
// } catch(e){
// console.log(e)
// return response.status(e.status).json({ message: e.message })
// }


// }

}

Expand Down
9 changes: 3 additions & 6 deletions src/adonisjs/database/seeds/InitialSeeder.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,6 @@ class UserSeeder {
cv.source = fs.readFileSync(RESOURCE_DIR + 'case.md', 'utf8')
cv.id = await uuidv4()

const artifact_id = await uuidv4()
let fileName = artifact_id + ".png"
let fs_path = Helpers.resourcesPath() + '/artifacts/cases/' + c.id + '/'
let case_relative_path = ARTIFACTS_DIR + 'cases/' + c.id + '/'

await c.versions().save(cv, trx)

return c
Expand All @@ -146,7 +141,9 @@ class UserSeeder {

const artifact_id = await uuidv4()
let fileName = artifact_id + ".png"
let fs_path = Helpers.resourcesPath() + '/artifacts/cases/' + c.id + '/'
// let fs_path = Helpers.resourcesPath() + '/artifacts/cases/'
let fs_path = Helpers.publicPath('/resources/artifacts/cases/') + c.id + '/'

let case_relative_path = ARTIFACTS_DIR + 'cases/' + c.id + '/'

let artifact = new Artifact()
Expand Down
2 changes: 1 addition & 1 deletion src/adonisjs/database/seeds/RollbackInitialSeeder.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class RollbackInitialSeeder {

await c.delete(trx)

let artifactPath = Helpers.resourcesPath() + '/artifacts/cases/' + c.id + '/'
let artifactPath = Helpers.publicPath('/resources/artifacts/cases/') + c.id + '/'

await Drive.delete(artifactPath)

Expand Down
1 change: 1 addition & 0 deletions src/adonisjs/public/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
resources
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 64b409f

Please sign in to comment.