Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions api/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"indent": ["error", 2],
"linebreak-style": ["error", "unix"],
"quotes": ["error", "single"],
"semi": ["error", "always"],
"no-unused-vars": "warn"
"semi": ["error", "always"]
},
"globals": {
"__dirname": true
Expand Down
34 changes: 11 additions & 23 deletions api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@babel/preset-env": "7.12.11",
"@babel/register": "7.12.10",
"babel-jest": "26.6.3",
"eslint": "^8.9.0",
"eslint": "^8.10.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.25.4",
"jest": "26.6.3",
Expand Down
1 change: 0 additions & 1 deletion api/src/controllers/auth.controllers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import passport from 'passport';
import { generateToken } from '../helpers/token';
import loginActivity from '../database/models/login_activity';
import { config } from 'dotenv';
Expand Down
1 change: 0 additions & 1 deletion api/src/controllers/user.controllers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import User from '../database/models/user';
import loginActivity from '../database/models/login_activity';

const allRoles = ['Standard', 'Administrator'];

Expand Down
2 changes: 1 addition & 1 deletion api/src/database/models/login_activity.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import mongoose, { Schema } from 'mongoose';
import uniqueValidator from 'mongoose-unique-validator';

const loginActivitySchema = new Schema(
{
userId: {
Expand Down
1 change: 1 addition & 0 deletions api/src/database/models/output.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import mongoose, { Schema } from 'mongoose';

const outputSchema = new Schema(
{
userId: {
Expand Down
3 changes: 2 additions & 1 deletion api/src/database/models/user.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import mongoose, { Schema } from 'mongoose';
import uniqueValidator from 'mongoose-unique-validator';

const userSchema = new Schema(
{
firstName: String,
Expand All @@ -22,6 +22,7 @@ const userSchema = new Schema(
},
{ timestamps: true }
);

userSchema.statics.findOneOrCreate = function findOneOrCreate(condition, doc) {
const self = this;
const newDocument = doc;
Expand Down
4 changes: 2 additions & 2 deletions api/src/helpers/filterOutputCategories.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const filterOutputCategories = (categories) => {
export const filterOutputCategories = (categories) => {
let filteredCategories = [];
categories.forEach(category => {
if (category.name[0] !== '_') {
Expand All @@ -9,4 +9,4 @@ export const filterOutputCategories = (categories) => {
}
});
return filteredCategories;
};
};
8 changes: 4 additions & 4 deletions api/src/helpers/formatString.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const formatAuthorsString = (authorsString) => {
//Get author and remove the last semi-colon and any whitespace after it:
// Get author and remove the last semi-colon and any whitespace after it:
authorsString.replace(/;\s*$/, '');

const authors = authorsString.split(';');
Expand All @@ -8,7 +8,7 @@ export const formatAuthorsString = (authorsString) => {
let authorsListWithKey = [];
authors.map((singleAuthor) => {
const authorInfos = singleAuthor.split(',');
if (authorInfos.length == 2) {
if (authorInfos.length === 2) {
authorsListWithout = [
...authorsListWithout,
`${authorInfos[0].replace(/\s/g, '')}, ${authorInfos[1].replace(
Expand Down Expand Up @@ -39,9 +39,9 @@ export const createCitation = async (data) => {
let authorsList = '';

await authors.map((author, index) => {
authorsList += ` ${author.lastName}, ${author.firstName[0].toUpperCase()}${(index==authors.length-2 && authorsList.length != 2)?'., &':'.,'}`;
authorsList += ` ${author.lastName}, ${author.firstName[0].toUpperCase()}${(index===authors.length-2 && authorsList.length !== 2)?'., &':'.,'}`;
});
//remove last comma
// remove last comma
authorsList = authorsList.replace(/,\s*$/, '');
return `${authorsList} (${year}). ${title}. ${categoryName} ${reportNumber}. https://doi.org/${DOI} Available at ${kerko_url}. Available under Creative Commons Attribution 4.0 International, https://creativecommons.org/licenses/by/4.0/.`;
};
2 changes: 1 addition & 1 deletion api/src/helpers/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ const { JWT_SECRET } = process.env;
export const generateToken = (userinfo) => {
const Issuetoken = jwt.sign(userinfo, JWT_SECRET, { expiresIn: '1d' });
return Issuetoken;
};
};
1 change: 0 additions & 1 deletion api/src/routes/auth.routes.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Router } from 'express';
import passport from 'passport';
import * as controller from '../controllers/auth.controllers';
import passportGoogle from '../helpers/google-passport';
import { verifyToken as authenticateUser } from '../middleware/auth.middleware';
const routes = Router();

Expand Down
Loading