From bcd5ba8448d008be4de7d8103736ad40827a858b Mon Sep 17 00:00:00 2001
From: ManifoldFR <wilson.jallet@gmail.com>
Date: Thu, 1 Mar 2018 19:26:26 +0100
Subject: [PATCH] Fixed ES6 exports

---
 .gitignore             |  3 ++-
 .gitlab-ci.yml         |  6 +++---
 sigma-back-dev.service | 13 +++++++++++++
 src/graphql/schema.js  |  3 +--
 src/ldap/ldap_data.js  |  2 +-
 webpack.config.js      |  9 ++++++++-
 6 files changed, 28 insertions(+), 8 deletions(-)
 create mode 100644 sigma-back-dev.service

diff --git a/.gitignore b/.gitignore
index b773762..2ff2621 100644
--- a/.gitignore
+++ b/.gitignore
@@ -69,4 +69,5 @@ typings/
 # Generated files
 doc/
 build/
-ldap_config.json
\ No newline at end of file
+ldap_config.json
+sigma-back.service
\ No newline at end of file
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f24be03..6c59f25 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -32,7 +32,7 @@ build:
     paths:
       - build/
       - node_modules/
-    expire_in: 40 min
+    expire_in: 240   min
   tags:
     - database
     - build
@@ -48,8 +48,8 @@ test:lint:
 deploy_staging:
   stage: deploy
   script:
-    - npm start & sleep 5
-    - exit 0
+    - npm run build
+    - cp --parents -r build/ /opt/sigma-back/build/
   environment:
     name: staging
     url: http://129.104.210.10:3000
diff --git a/sigma-back-dev.service b/sigma-back-dev.service
new file mode 100644
index 0000000..118eacb
--- /dev/null
+++ b/sigma-back-dev.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=Sigma-back
+Wants=network-online.target
+After=network-online.target
+
+[Service]
+Environment=NODE_ENV=development
+WorkingDirectory=/opt/sigma-back
+ExecStart=/usr/bin/node app.js
+Restart=always
+
+[Install]
+WantedBy=multi-user.target
\ No newline at end of file
diff --git a/src/graphql/schema.js b/src/graphql/schema.js
index eaa9bab..ca3ad80 100644
--- a/src/graphql/schema.js
+++ b/src/graphql/schema.js
@@ -111,7 +111,6 @@ const getAvailableGroupUID = (initialUID) => {
             return(getAvailableGroupUID(rasUID + 'n'));
         }
     });
-    return rasUID;
 };
 
 const createGroupIfLegal = (user, args) => {
@@ -136,7 +135,7 @@ const createGroupIfLegal = (user, args) => {
                 description : args.description,
                 school : args.school
             }).then( res => {
-            return getGroupIfVisible(user, rasUID);
+                return getGroupIfVisible(user, rasUID);
             });
         })); 
     });
diff --git a/src/ldap/ldap_data.js b/src/ldap/ldap_data.js
index a0be107..801a565 100644
--- a/src/ldap/ldap_data.js
+++ b/src/ldap/ldap_data.js
@@ -293,6 +293,6 @@ function creerGroupe(param) {
 //rechercheLDAP(user, "uid=quentin.chevalier,ou=eleves,dc=frankiz,dc=net","(displayName=${cn})",{ cn: "Sire hawkspar" }, ["jpegPhoto"]).then(res => console.log(res));
 
 /* Partage pour le reste du monde ; même remarque synthaxe que pour l'import */
-export { listGroups, listMembers, TOL };
+export { rens, listAdmins, listGroups, listMembers, TOL };
 
 /*module.exports ={ listGroups, listMembers, listAdmins, rens, idTOL, TOL }; */
diff --git a/webpack.config.js b/webpack.config.js
index 9ccf107..eb89149 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -8,7 +8,14 @@ var config = {
         filename: 'bundle.js',
         path: path.resolve(__dirname, 'build')
     },
-    externals: [nodeExternals()]
+    externals: [nodeExternals()],
+    module: {
+        loaders: [{
+            test: /\.(png|jpg|ico)/,
+            exclude: /node_modules/,
+            loader: 'url-loader'
+        }]
+    }
 };
 
 module.exports = config;
\ No newline at end of file
-- 
GitLab