Skip to content

Commit

Permalink
Merge pull request #24 from datasci4health/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
lealfp authored Jul 7, 2019
2 parents cdeaa13 + 1c708ed commit 564e871
Show file tree
Hide file tree
Showing 89 changed files with 248 additions and 9,499 deletions.
40 changes: 40 additions & 0 deletions .chglog/CHANGELOG.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{{ range .Versions }}
<a name="{{ .Tag.Name }}"></a>
## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }}

> {{ datetime "2006-01-02" .Tag.Date }}
{{ range .CommitGroups -}}
### {{ .Title }}

{{ range .Commits -}}
* {{ if .Scope }}**{{ .Scope }}:** {{ end }}{{ .Subject }}
{{ end }}
{{ end -}}

{{- if .RevertCommits -}}
### Reverts

{{ range .RevertCommits -}}
* {{ .Revert.Header }}
{{ end }}
{{ end -}}

{{- if .MergeCommits -}}
### Pull Requests

{{ range .MergeCommits -}}
* {{ .Header }}
{{ end }}
{{ end -}}

{{- if .NoteGroups -}}
{{ range .NoteGroups -}}
### {{ .Title }}

{{ range .Notes }}
{{ .Body }}
{{ end }}
{{ end -}}
{{ end -}}
{{ end -}}
28 changes: 28 additions & 0 deletions .chglog/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
style: github
template: CHANGELOG.tpl.md
info:
title: CHANGELOG
repository_url: https://github.com/datasci4health/harena-manager.git
options:
commits:
# filters:
# Type:
# - feat
# - fix
# - perf
# - refactor
commit_groups:
# title_maps:
# feat: Features
# fix: Bug Fixes
# perf: Performance Improvements
# refactor: Code Refactoring
header:
pattern: "^(\\w*)(?:\\(([\\w\\$\\.\\-\\*\\s]*)\\))?\\:\\s(.*)$"
pattern_maps:
- Type
- Scope
- Subject
notes:
keywords:
- BREAKING CHANGE
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<a name="v1.0.4"></a>
## [v1.0.4](https://github.com/datasci4health/harena-manager/compare/v1.0.3...v1.0.4)

> 2019-05-15

<a name="v1.0.3"></a>
## [v1.0.3](https://github.com/datasci4health/harena-manager/compare/v1.0.2...v1.0.3)

> 2019-05-14

<a name="v1.0.2"></a>
## [v1.0.2](https://github.com/datasci4health/harena-manager/compare/v1.0.1...v1.0.2)

> 2019-05-12

<a name="v1.0.1"></a>
## [v1.0.1](https://github.com/datasci4health/harena-manager/compare/v1.0.0...v1.0.1)

> 2019-05-12

<a name="v1.0.0"></a>
## [v1.0.0](https://github.com/datasci4health/harena-manager/compare/v0.1.0...v1.0.0)

> 2019-05-12

<a name="v0.1.0"></a>
## [v0.1.0](https://github.com/datasci4health/harena-manager/compare/v0.0.1...v0.1.0)

> 2019-05-05

<a name="v0.0.1"></a>
## v0.0.1

> 2019-04-15
18 changes: 18 additions & 0 deletions resources/scripts/generate_users.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from argparse import ArgumentParser
import requests
import json

parser = ArgumentParser()
parser.add_argument("-f", "--from", dest="range_from", help="starting range", type=int)
parser.add_argument("-t", "--to", dest="range_to", help="ending range", type=int)
parser.add_argument("-p", "--prefix", dest="prefix", help="user prefix", type=str)
parser.add_argument("-u", "--url", dest="url", help="manager url", type=str)
args = parser.parse_args()


for i in range(args.range_from, args.range_to):
payload = {'username': "{}{}".format(args.prefix,i),
'email' : "{}{}@harena.ds4h.org".format(args.prefix,i),
'password': "{}{}".format(args.prefix,i)}
response = requests.request('POST', args.url, data = payload)
print(response.text)
13 changes: 10 additions & 3 deletions src/adonisjs/app/Controllers/Http/v1/ArtifactController.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ const Artifact = use('App/Models/v1/Artifact');
const Case = use('App/Models/v1/Case');
const Env = use('Env')
const uuid4 = require('uuid/v4');
const fs = require('fs');


class ArtifactController {

Expand All @@ -25,9 +27,13 @@ class ArtifactController {
async store({ request, auth, response }) {
try{

const file = request.file('file', this.validationOptions)
const caseID = request.input('case_uuid', null)

const fileLocation = request.body.file
const caseID = request.body.case_uuid
// request.input('case_uuid', null)
console.log(fileLocation)
console.log(caseID)

fs.openSync(fileLocation)
var linkedCase = await Case.find(caseID)

if (caseID != null && linkedCase == null){
Expand All @@ -42,6 +48,7 @@ class ArtifactController {
}

const artifactID = await uuid4()
// console.log("file " +file)
const artifactFileName = artifactID + "." + file.extname

await file.move(fsPath, {name: artifactFileName, overwrite: false})
Expand Down
4 changes: 3 additions & 1 deletion src/adonisjs/app/Controllers/Http/v1/CaseController.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@ class CaseController {
*/
async destroy({ params, response }) {
try {
await Case.find(params.id).delete()
let c = await Case.findBy('uuid', params.id)
c.delete()
return response.json({ message: 'Case deleted!' })
} catch (e) {
console.log(e)
return response.status(e.status).json({ message: e.message })
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
'use strict'

/** @type {import('@adonisjs/lucid/src/Schema')} */
const Schema = use('Schema')

class ExecutionSchema extends Schema {
up () {
this.table('executions', (table) => {
table.dropForeign('case_version_id', 'executions_case_version_id_foreign')
table.dropIndex('case_id', 'caseversion_id')
table.dropColumn('case_version_id')
table.uuid('case_id')
table.index('case_id', 'case_id')
table.foreign('case_id ', 'executions_case_id').references('uuid').inTable('cases')

table.dropForeign('user_id', 'executions_user_id_foreign')
table.foreign('user_id','executions_user_id').references('users.id').onDelete('cascade')
})
}

down () {
this.table('executions', (table) => {
table.dropForeign('user_id', 'executions_user_id')
table.foreign('user_id','executions_user_id_foreign').references('users.id').onDelete('cascade')



table.dropForeign('case_id', 'executions_case_id')
table.dropIndex('case_id', 'case_id')
table.dropColumn('case_id')
table.integer('case_version_id').unsigned()
table.index('case_version_id', 'caseversion_id')
table.foreign('case_version_id').references('case_versions.id').onDelete('cascade')

})
}
}

module.exports = ExecutionSchema
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
'use strict'

/** @type {import('@adonisjs/lucid/src/Schema')} */
const Schema = use('Schema')
const Database = use('Database')

class CaseVersionSchema extends Schema {
async up () {
const trx = await Database.beginTransaction()

let sql = "ALTER TABLE case_versions DROP FOREIGN KEY case_id"
await trx.raw(sql)

sql = "ALTER TABLE case_versions ADD CONSTRAINT case_id FOREIGN KEY (case_id) REFERENCES cases(uuid) ON DELETE CASCADE"
await trx.raw(sql)

trx.commit()
trx.rollback()
}

async down () {
const trx = await Database.beginTransaction()

let sql = "ALTER TABLE case_versions DROP FOREIGN KEY case_id"
await trx.raw(sql)

sql = "ALTER TABLE case_versions ADD CONSTRAINT case_id FOREIGN KEY (case_id) REFERENCES cases(uuid)"
await trx.raw(sql)

trx.commit()
trx.rollback()
}
}

module.exports = CaseVersionSchema
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
'use strict'

/** @type {import('@adonisjs/lucid/src/Schema')} */
const Schema = use('Schema')
const Database = use('Database')

class ArtifactSchema extends Schema {
async up () {
const trx = await Database.beginTransaction()

let sql = "ALTER TABLE artifacts DROP FOREIGN KEY artifacts_case_id_foreign"
await trx.raw(sql)

sql = "ALTER TABLE artifacts ADD CONSTRAINT artifacts_case_id_foreign FOREIGN KEY (case_id) REFERENCES cases(uuid) ON DELETE CASCADE"
await trx.raw(sql)

trx.commit()
trx.rollback()
}

async down () {
const trx = await Database.beginTransaction()

let sql = "ALTER TABLE artifacts DROP FOREIGN KEY artifacts_case_id_foreign"
await trx.raw(sql)

sql = "ALTER TABLE artifacts ADD CONSTRAINT artifacts_case_id_foreign FOREIGN KEY (case_id) REFERENCES cases(uuid)"
await trx.raw(sql)

trx.commit()
trx.rollback()
}
}

module.exports = ArtifactSchema
10 changes: 0 additions & 10 deletions templates/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions templates/classic/README.md

This file was deleted.

68 changes: 0 additions & 68 deletions templates/classic/css/player.css

This file was deleted.

Loading

0 comments on commit 564e871

Please sign in to comment.