Skip to content

Commit

Permalink
Merge pull request #51 from datasci4health/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
matheusmota authored Mar 22, 2020
2 parents 91c3c6c + aa64568 commit 8b4d930
Show file tree
Hide file tree
Showing 31 changed files with 162 additions and 272 deletions.
17 changes: 13 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
FROM node:12
FROM node:10

WORKDIR /app

COPY ./src/adonisjs .

#RUN chown node:node /app

RUN npm i npm
RUN npm i -g @adonisjs/cli

COPY ./src/adonisjs .

RUN npm install

CMD [ "npm", "start"]
#RUN chown node:node /app

#USER node

#ENTRYPOINT ["tail", "-f", "/dev/null"]
#CMD [ "npm", "start"]

ENTRYPOINT ["./bootstrap.sh"]
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,8 @@ adonis serve --debug # starting server

### Running as Docker containers - Linux

You can run a containerized instance of this project with its required services (e.g., database) using Docker.
Please refer to this [link](https://docs.docker.com/install/) for installing Docker. Then, try:

```bash
You can run a containerized instance of this project with its required services (e.g., database) using Docker. Please refer to this link for installing Docker. Then, try:
```
sudo apt-get install docker-compose -y # installing docker-compose
git clone https://github.com/datasci4health/harena-manager
Expand All @@ -136,7 +134,6 @@ docker build . -t manager
docker-compose -f docker-compose-dev.yml up
```


## Dependencies

### System-wide
Expand Down
5 changes: 2 additions & 3 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: '3'
services:

harena-manager:
image: datasci4health/harena-manager:development
image: manager
ports:
- "10020:10020"
environment:
Expand All @@ -22,15 +22,14 @@ services:
- DB_USER=jacinto
- DB_PASSWORD=jacinto
- HASH_DRIVER=bcrypt
# env_file:
# - web-variables.env
depends_on:
- harena-manager-database
restart: always
networks:
- harena-manager
volumes:
- ./src/adonisjs:/app
- /app/node_modules

harena-manager-database:
image: mysql:5.7
Expand Down
3 changes: 2 additions & 1 deletion src/adonisjs/app/Controllers/Http/v1/ArtifactController.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class ArtifactController {
await file.move(fsPath, {name: artifactFileName, overwrite: false})

const artifact = new Artifact()
artifact.fs_path = fsPath + artifactFileName
artifact.id = artifactID
artifact.fs_path = fsPath + artifactFileName
artifact.relative_path = caseRelativePath + artifactFileName
artifact.case_id = linkedCase != null ? linkedCase.uuid : linkedCase;
await auth.user.artifacts().save(artifact)
Expand Down
5 changes: 3 additions & 2 deletions src/adonisjs/app/Controllers/Http/v1/CaseController.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ class CaseController {
c.user_id = auth.user.id

let cv = new CaseVersion()
cv.id = await uuidv4()

cv.source = request.input('source')

await c.versions().save(cv)
await c.versions().fetch()

Expand All @@ -85,7 +86,7 @@ class CaseController {

let cv = new CaseVersion()
cv.source = request.input('source')

cv.id = await uuidv4()
await c.versions().save(cv)
await c.save()
return response.json(c)
Expand Down
3 changes: 3 additions & 0 deletions src/adonisjs/app/Models/v1/Artifact.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
const Model = use('Model')

class Artifact extends Model {
static get incrementing () {
return false
}

user() {
return this.belongsTo('App/Models/v1/User');
Expand Down
4 changes: 4 additions & 0 deletions src/adonisjs/app/Models/v1/CaseVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
const Model = use('Model')

class CaseVersion extends Model {
static get incrementing () {
return false
}

case() {
return this.belongsTo('App/Models/v1/Case');
}
Expand Down
12 changes: 12 additions & 0 deletions src/adonisjs/app/Models/v1/Permission.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict'

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

class Permission extends Model {
static get incrementing () {
return false
}
}

module.exports = Permission
12 changes: 12 additions & 0 deletions src/adonisjs/app/Models/v1/Role.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict'

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

class Role extends Model {
static get incrementing () {
return false
}
}

module.exports = Role
4 changes: 4 additions & 0 deletions src/adonisjs/app/Models/v1/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ const Model = use('Model')
const Database = use('Database')

class User extends Model {
static get incrementing () {
return false
}

static async getAuthenticatedUser(email){
return await Database.table('users').select('username', 'email').where('email', email)
}
Expand Down
6 changes: 4 additions & 2 deletions src/adonisjs/database/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ Factory.blueprint('App/Models/v1/User', async (faker, i, data) => {
return {
username: faker.username(),
email: faker.email(),
password: await Hash.make(faker.password())
password: await Hash.make(faker.password()),
id: data.id
}
})

Expand All @@ -32,7 +33,8 @@ Factory.blueprint('App/Models/v1/Case', (faker, i, data) => {

Factory.blueprint('App/Models/v1/CaseVersion', async (faker, i, data) => {
return {
source: data.source
source: data.source,
id: data.id
}
})

Expand Down

This file was deleted.

This file was deleted.

20 changes: 0 additions & 20 deletions src/adonisjs/database/migrations/1557609096219_v_2_case_schema.js

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 8b4d930

Please sign in to comment.