Skip to content

Commit 1b4015d

Browse files
authored
Refactoring & bug-fixes (#18)
* Bug-fix * Added Copy to Clipboard functionality. * Updated schema * Refactoring * Updated schema added attribute „published“ to comments, if review is still in progress * Updated queries * Adopted comments in apiControllers * Renamed admin into member-client (will also be done for user-client) * Adopted commentControllers and service in user-client * fixed portugese document generation * Added German and Portuguese Project Descriptions to Review Page Added missing Concerns to Review Page Improved Layout * Updated setup.js added config.js support * Renamed user in user-client * Updated schema renamed Reviews to Reviewers * Updated queries * Updated apiControllers regarding renamed reviewers * Updated templates in user-client added „general_comment“ and „reviewer(s)“ to submission-view * Updated schema Added attribute „updated“ to Revisions to show the submitted timestamp inside the user-/admin-clients * Updated queries * Updated templates * Added missing fields in accountEditController * Refactoring - integrated navController inside mainController - fixed promises in documentDetailsController - fixed editDocument-template * Changes * Added Authorization to apiControllers - updated apiControllers - updated routes - updated queries * Bug-fixes * Fixes * Started admin-client implementation * Fixed queries & apiControllers * Added services, templates and controllers to member-client (still in progress) * fixed new user creation. * added missing English translations. refactored all text on site into languages.js * Fixed document Creation. Fixed infinite loading screen after User Creation. * Changes * Changes * Changes * Changes * Changes * Fixed registration & sign-up in user-client * Changes * Changes * Updated queries and apiController with authorization * Updated queries and apiControllers for filtering documents by user or course * Implemented controllers and services in admin-client (still in progress) * fixed wrong symbols. * Added missing English Translations. * Improved Layout. * Altered Login-Message on Member client. * Changes * Changes * Changes * Added missing translations * Changes * Updated schema - Renamed „Research_Groups“ as „Working_Groups“ (for better name convention, regarding non-research-groups, like the webteam) - Renamed „deleted“ as „former“ in Members, Institutes, Working_Groups - Renamed „deleted“ as „blocked“ in Users - Set „university_id“, „institute_id“, „working_group_id“ as real reference keys in Members and Users * Renaming research_groups as working_groups * Changes * Fixed queries * Cleaned up repository deleted old admin-client * Updated schema * Fixed queries (updating apiControllers is still in progress) * Fixed apiControllers * Fixed templates and controllers in user-client * Added reviewController and updated templates in admin-client (still in progress) * Template improvements * Updated queries, apiControllers and routes * Implemented reviewController (still in progress) * Translations * Implemented reviewController & apiControllers (reviewing is finally working, but some parts are still in progress) * Added missing controllers in admin-client & template improvements (still in progress) * Fixed and added missing apiControllers (still in progress) * Template and controller improvements (still not finished) * removed 'Signature of Participant' from Statement of Researcher * Updated dependencies * Improvements for createCourseController and template (adding responsibilities is still in progress) * Code-cleaning * Template improvements * Fixed filtering for documents With this fix, documents will be always filter by the institute, the institute_id is given by the authenticated member, so that documents of other institutes can not be seen and reviewed * Fixed queries * Template improvements * Typo-fix * Fixed Authorization for admins * Fixed apiControllers and queries Users, members and courses will be filtered by the institute, which the authenticated member belongs to * Template and controller improvements * Fixed document in navbar * Caching filter settings * Code-cleaning * Added missing controllers and templates in member-client * Template improvements in member-client * Template improvements in member-client * Added Introduction to App to UC. * fixed constraints in SQL Schema. * Refactored group_id to working_group_id in API controller. * Added Delete Functionality for Universities, Institutes, WorkingGroups. - Added controllers - Added Templates - Activated routes - Activated in index.html * Template improvements * Added warning-boxes before deleting administrative entries * Implemented pagination for documents * Updated languages * Template improvements * Fixes * Added missing English Translations. fixed typo in Template * fixed typo. Added link to User-Client on login Page of MC * Added automatic refresh for documents in documentListController * Updated queries and apiControllers for creating and editing Courses and their corresponding Responsibilities * Typo-fixes * Implemented create- and editCourseController in member-client * Updated services in member-client * Updated translations and templates * Typo-fixes * Typo-fixes * Updated queries for application-wide paginations * Updated apiControllers (still in progress) * Implemented application-wide paginations (universityDetailsController and instituteDetailsController are temporary not fully working, will be fixed soon, after the server-side implementation) * Changes * Added createUniversity Functionality. * Fixes * bugfixes. * Added editUniversity Functionality. * Fixed queries and apiControllers * Fixed related institutes of a university in the member-client * Changes * Implemented missing apiControllers * Typo-fixes * Updated queries and apiControllers * Improvements for services, controllers and templates in member- and user-client * Typo-fix * Typo-fixes * Added manual * Template improvements * Added createInstitute Functionality. * fixed typo. * Added createWorkingGroup Functionality. * added Edit Functionality for Institutes and Working Groups. Fixed API Controller for institutes.put. * Typo-fixes * Updated queries and apiControllers * Added pagination for members in user-client * Fixed apiController * Updated translations * Updated languages and templates * Changes * Updated languages and templates * Updated languages and templates * Updated languages and templates * Updated languages and templates * Updated queries and apiControllers * Updated apiControllers * Template improvements * Updated schema * Implemented documentDeleteController in member-client * Implemented documentFilesController in member-client * Implemented userCreate- & userEditController in member-client * Updated email-templates * Added ngCloak to the user- and member-client * Improved email-templates (still in progress) * Improved and added new email-templates * Updated apiControllers revised controllers and added email-support * Added FAQ, Troubleshooting, Contact. * bugfixes. * bugfix. * Added missing translations. * Fixed typos. Uncommented Test Placeholders. Added final Submit Warning. * Updated apiControllers & fixed queries * Updated languages * Improved & fixed email-templates * Changes * Changes * Updated queries and apiControllers * Implemented memberCreate- & memberEditController in member-client (editAccountController in member-client is still in progress) * Typo-fixes * Implemented accountEditController in member-client * Bug-fixes * Implemented server-side sorting updated queries & apiControllers * Fixed queries and apiControllers * Added sorting in all templates of the member-client * Added information before overwriting a review * Fixed queries * Updated services * Fixed queries * Added sorting and pagination to detailsController in member-client * Updated defaults.sql.sample and examples.sql.sample * Implemented login by document in member-client * Improved templates - Added info-fields to document edit template in user-client - Added info-field to document review template * Fixes * Implemented recovery and reset password controllers in API and member-client * Fixed JWTs * Improved templates in user-client * Template improvements * Updated schema Added new relation „Notes“ * Implemented apiControllers for notes and updated queries and other apiControllers * Implemented notes in member-client for auto-saving working-notes * Added missing apiController to retrieve a course by document * Added editSettingsController for a document in member-client (still in progress) * Improved templates * Updated queries * Updated languages * Updated schema Added „secret“ attribute members to setup one administrator, which can not be deleted * Updated queries and apiController to filter documents also with/without a course * Improved templates * Updated queries and apiController to filter all accepted by review and auto accepted documents * Added reviseController in user-client * Removed hard-coded port * Typo-fixes in services * Implemented editSettingsController in member-client * Added server-port * Fixed queries and apiControllers Improved the filtering by an attribute for 3 cases: attribute is „true“ or „false“ or „both“ (=when the boolean is „undefined“) * Fixed services and controllers - renamed global „filter“ to „cached_filter“, as well as corresponding functions, „getFilter“ and „setFilter“ to „getCachedFilter“, „setCachedFilter“ to different the global filters setting from the local filters - fixed filtering by former/blocked attribute * Improved templates * Typo-fixes * Fixed createDocumentController in user-client * Fixed apiControllers * Fixes for connecting a document to a course * Fixed controllers and improved templates * Fixed queries and apiController * Fixed controllers and templates in member- and user-client - Updated local filters to retrieve the correct list of dropdown-options (without „former“, „blocked“ status in createControllers - with „former“, „blocked“ status in editControllers) - Fixed autocompletes in templates * Implemented full text search for documents in member-client #15 * Cleaned up repository * Updated services for full text search * Fixed queries * Typo-fixes * Implemented full text search for universities, institutes & workingGroups in member-client #15 * Implemented full text search for courses in member-client #15 * Implemented full text search for members in member-client #15 * Implemented full text search for users in member-client #15 * Improved templates and controllers * Bug-fixes Fixed bug in dropdowns, caused by options, which have been set in the meantime to former * Improved MC Manual. * fixed. * Updated queries and apiController * Template improvements * Implemented reviseController in user-client (still in progress) * Implemented reviseController in user-client * Added translations * Changes * Updated README * Update README.md * Bug-fix in apiController * fixed typos. rephrased to proper English. * - Fixed the missing translation on submit page. - Moved the "Start Review"/"Open Review" Buttons to top of the page - Added subtitles to Files at download (provided by fhillen) * updated showfiles template. * fixed typo. * Template improvements * Updated language.js * Updated config.js * Bug-fixes and refactoring - deleted config.js and replaced it with an .env-file, following the dotenv-guidline - Code-cleaning - bug-fixes in email-templates and notifications
1 parent 62b6c9b commit 1b4015d

73 files changed

Lines changed: 205 additions & 352 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.sample

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
NODE_ENV='development'
2+
SERVER_URL='http://localhost'
3+
SERVER_PORT=5000
4+
HTTP_PORT=5000
5+
HTTPS_PORT=5443
6+
POSTGRES_HOST='localhost'
7+
POSTGRES_PORT=5432
8+
POSTGRES_DB_NAME='ethics-app'
9+
POSTGRES_USERNAME='username'
10+
POSTGRES_PASSWORD='password'
11+
POSTGRES_SSL=false
12+
DEFAULTS=true
13+
EXAMPLES=false
14+
SENDER_NAME='Ethics-App'
15+
SENDER_EMAIL_ADDRESS='ifgi-ethics@uni-muenster.de'
16+
SMTP_HOST='smtp.gmail.com'
17+
SMTP_PORT=465
18+
SMTP_SSL=true
19+
SMTP_EMAIL_ADDRESS='example@gmail.com'
20+
SMTP_PASSWORD='password'
21+
JWTSECRET='secret'

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ node_modules/*
22
ssl/*
33
public/bower_components/*
44
public/files/temp/*
5-
.DS_Store
6-
/config.js
75
sql/schema/examples.sql
86
sql/schema/defaults.sql
7+
.env
8+
.DS_Store

README.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,22 +116,24 @@ CREATE DATABASE ethics-app;
116116
node setup.js
117117
```
118118

119-
* Before you execute the `setup.js`, please make sure, that you have already created the `/sql/schema/defaults.sql` file or follow the instructions of [1.4.](#default-values) first. Check also if you have already created the `config.js` file or provide the following **NODE ENVIRONMENT VARIABLES** before you run the script:
119+
* Before you execute the `setup.js`, please make sure, that you have already created the `/sql/schema/defaults.sql` file or follow the instructions of [1.4.](#default-values) first. Check also if you have already created the `.env` file or provide the following **NODE ENVIRONMENT VARIABLES** before you run the script:
120120
* `POSTGRES_HOST`: Postgres host address (default: `localhost`)
121121
* `POSTGRES_PORT`: Postgres port number (default: `5432`)
122122
* `POSTGRES_DB_NAME`: Postgres database name (default: `ethics-app`)
123123
* `POSTGRES_USERNAME`: Postgres username (default: `admin `)
124124
* `POSTGRES_PASSWORD`: Postgres password (default: `admin`)
125125
* `POSTGRES_SSL`: Postgres ssl connection (default: `false`)
126+
* `DEFAULTS`: Load default entries for the database with the file `sql/schema/defaults.sql` (see [1.4.](#default-values) for reference) (default: `false`)
127+
* `EXAMPLES`: Load example entries for the database with the file`sql/schema/examples.sql` (see [1.5.](#example-values) for reference) (default: `false`)
126128

127-
* If you are using NODE ENVIRONMENT VARIABLES, instead of the `config.js`, then start the script with the following command:
129+
* If you are using NODE ENVIRONMENT VARIABLES, instead of the `.env`, then start the script with the following command:
128130

129131
```
130132
# Linux & macOS
131-
node setup.js
133+
DEFAULTS=true node setup.js
132134
133135
# Windows
134-
set node setup.js
136+
set DEFAULTS=true node setup.js
135137
```
136138

137139
##### 1.4. Default values (administrator account)
@@ -143,6 +145,7 @@ cp defaults.sql.sample defaults.sql
143145
```
144146

145147
* Next create inside the `/sql/schema/defaults.sql` file an overall administrator account. This account needs to be `secret`, which will be hidden from the view of the users. The secret administrator is NOT a part of the Ethics committee and only there for hosting and administrating the app. There can be more administrators, if it is required, but it is recommended to split administrators from committee members. Administrators have full access to all data inside the application, which is critical, when entries, like universities, institutes, working groups, members and users would be deleted. Please checkout the upper database schema to get a full overview about all required attributes and dependencies.
148+
* Don't forget to update the settings `DEFAULTS=true` inside the `.env`.
146149

147150
##### 1.5. Example values
148151

@@ -152,6 +155,8 @@ cp defaults.sql.sample defaults.sql
152155
cp examples.sql.sample examples.sql
153156
```
154157

158+
* Don't forget to update the settings `EXAMPLES=true` inside the `.env`!
159+
155160
### 2. Ethics-app
156161

157162
##### 2.1. Git/GitHub
@@ -199,15 +204,15 @@ bower install
199204
sudo bower install --allow-root
200205
```
201206

202-
##### 2.3. Node-server configuration
207+
##### 2.3. Server configuration
203208

204209
Execute the following command inside our local repository-folder:
205210

206211
```
207-
cp config.js.sample config.js
212+
cp .env.sample .env
208213
```
209214

210-
Open the `config.js` with your preferred text editor and configure the app appropiately for your host-server.
215+
Open the `.env` with your preferred text editor and configure the app appropriately for your host-server.
211216

212217

213218
##### 2.4 Host-server configuration
@@ -246,7 +251,7 @@ Open the `config.js` with your preferred text editor and configure the app appro
246251
node server.js
247252
```
248253

249-
* Before you start the server, please create a `config.js` file or start the websever with the following **NODE ENVIRONMENT VARIABLES**:
254+
* Before you start the server, please create a `.env` file or start the websever with the following **NODE ENVIRONMENT VARIABLES**:
250255
* `NODE_ENV`: server environment (default: `development`, option: `production`, which uses https with a certificate)
251256
* `SERVER_URL`: url/domain of the host-server (default: `http://ethics-app.uni-muenster.de`)
252257
* `SERVER_PORT`: port number of the host-server (default: `80`)
@@ -258,7 +263,8 @@ node server.js
258263
* `POSTGRES_USERNAME`: Postgres username (default: `admin `)
259264
* `POSTGRES_PASSWORD`: Postgres password (default: `admin`)
260265
* `POSTGRES_SSL`: Postgres ssl connection (default: `false`)
261-
* `FROM`: Email-address for users to reply, if they have question (default: `ifgi-ethics@uni-muenster.de`)
266+
* `SENDER_NAME`: Name of the sender for Emails (default: `Ethics-App`)
267+
* `SENDER_EMAIL_ADDRESS`: Email-address of the sender, so users can reply to it, if they have question (default: `ifgi-ethics@uni-muenster.de`)
262268
* `SMTP_HOST`: SMTP host address (default: `smtp.gmail.com`)
263269
* `SMTP_PORT`: SMTP port number (default: `465`)
264270
* `SMTP_SSL`: SMTP ssl connection (default: `true`)
@@ -268,7 +274,7 @@ node server.js
268274

269275
* If you want to run the application, you need to specify the `SMTP_EMAIL_ADDRESS` and `SMTP_PASSWORD`, otherwise no Emails with the document-IDs can be sent.
270276

271-
* If you are using NODE ENVIRONMENT VARIABLES instead of the `config.js`, then start the script with the following command:
277+
* If you are using NODE ENVIRONMENT VARIABLES instead of the `.env`, then start the script with the following command:
272278

273279
```
274280
# Linux & macOS

config.js.sample

Lines changed: 0 additions & 24 deletions
This file was deleted.

controllers/comments/put.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ types.setTypeParser(1700, 'text', parseFloat);
66
var _ = require('underscore');
77
var jwt = require('jsonwebtoken');
88
var pool = require('../../server.js').pool;
9-
var server_url = require('../../server.js').server_url;
10-
var jwtSecret = require('../../server.js').jwtSecret;
119

1210
var fs = require("fs");
1311
var dir = "/../../sql/queries/comments/";
@@ -35,7 +33,7 @@ exports.request = function(req, res) {
3533
var token = req.headers.authorization.substring(7);
3634

3735
// Verify token
38-
jwt.verify(token, jwtSecret, function(err, decoded) {
36+
jwt.verify(token, process.env.JWTSECRET, function(err, decoded) {
3937
if(err){
4038
callback(new Error("Authorization failed"), 401);
4139
} else {

controllers/concerns/put.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ exports.request = function(req, res) {
2626
}
2727
});
2828
},
29-
function(client, done, callback) {
30-
// TODO: Authentication
31-
callback(null, client, done);
32-
},
3329
function(client, done, callback) {
3430
// Database query
3531
client.query(query_get_concern, [

controllers/courses/delete.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ types.setTypeParser(1700, 'text', parseFloat);
66
var _ = require('underscore');
77
var jwt = require('jsonwebtoken');
88
var pool = require('../../server.js').pool;
9-
var server_url = require('../../server.js').server_url;
10-
var jwtSecret = require('../../server.js').jwtSecret;
119

1210
var fs = require("fs");
1311
var dir = "/../../sql/queries/courses/";
@@ -35,7 +33,7 @@ exports.request = function(req, res) {
3533
var token = req.headers.authorization.substring(7);
3634

3735
// Verify token
38-
jwt.verify(token, jwtSecret, function(err, decoded) {
36+
jwt.verify(token, process.env.JWTSECRET, function(err, decoded) {
3937
if(err){
4038
callback(new Error("Authorization failed"), 401);
4139
} else {

controllers/courses/get_by_document.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ types.setTypeParser(1700, 'text', parseFloat);
66
var _ = require('underscore');
77
var jwt = require('jsonwebtoken');
88
var pool = require('../../server.js').pool;
9-
var server_url = require('../../server.js').server_url;
10-
var jwtSecret = require('../../server.js').jwtSecret;
119

1210
var fs = require("fs");
1311
var dir_1 = "/../../sql/queries/documents/";
@@ -36,7 +34,7 @@ exports.request = function(req, res) {
3634
var token = req.headers.authorization.substring(7);
3735

3836
// Verify token
39-
jwt.verify(token, jwtSecret, function(err, decoded) {
37+
jwt.verify(token, process.env.JWTSECRET, function(err, decoded) {
4038
if(err){
4139
callback(new Error("Authorization failed"), 401);
4240
} else {

controllers/courses/list.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ types.setTypeParser(1700, 'text', parseFloat);
66
var _ = require('underscore');
77
var jwt = require('jsonwebtoken');
88
var pool = require('../../server.js').pool;
9-
var server_url = require('../../server.js').server_url;
10-
var jwtSecret = require('../../server.js').jwtSecret;
119

1210
var fs = require("fs");
1311
var dir_1 = "/../../sql/queries/members/";
@@ -37,7 +35,7 @@ exports.request = function(req, res) {
3735
var token = req.headers.authorization.substring(7);
3836

3937
// Verify token
40-
jwt.verify(token, jwtSecret, function(err, decoded) {
38+
jwt.verify(token, process.env.JWTSECRET, function(err, decoded) {
4139
if(err){
4240
callback(new Error("Authorization failed"), 401);
4341
} else {

controllers/courses/list_by_institute.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ var pg = require('pg');
44
var types = require('pg').types;
55
types.setTypeParser(1700, 'text', parseFloat);
66
var _ = require('underscore');
7-
var jwt = require('jsonwebtoken');
87
var pool = require('../../server.js').pool;
9-
var server_url = require('../../server.js').server_url;
10-
var jwtSecret = require('../../server.js').jwtSecret;
118

129
var fs = require("fs");
1310
var dir_1 = "/../../sql/queries/institutes/";

0 commit comments

Comments
 (0)