Skip to content

Commit

Permalink
refactor(src-files): refactor to comply with object-shorthand eslint …
Browse files Browse the repository at this point in the history
…rule
  • Loading branch information
FlorentinTh committed Feb 2, 2022
1 parent ae23ed3 commit 094c431
Show file tree
Hide file tree
Showing 14 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/helpers/file.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class FileHelper {
const error = errors[i];
const entry = error.dataPath.split('/').slice(-1)[0];
const message = error.message;
errorsArray.push({ entry: entry, message: message });
errorsArray.push({ entry, message });
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/helpers/job.logs.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class JobLogsHelper {

try {
await FileHelper.writeToJobsLog({
action: action,
action,
date: dayjs().format('DD-MM-YYYY HH:mm'),
job: jobObj
});
Expand Down
4 changes: 2 additions & 2 deletions src/server/algorithm/algo.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AlgoController {
};

res.status(httpStatus.OK).json({
data: data,
data,
message: 'success'
});
} catch (error) {
Expand Down Expand Up @@ -119,7 +119,7 @@ class AlgoController {

res.status(httpStatus.OK).json({
data: {
algo: algo
algo
},
message: `Algorithm successfully updated`
});
Expand Down
6 changes: 3 additions & 3 deletions src/server/app/app.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AppController {
};

res.status(httpStatus.OK).json({
data: data,
data,
message: 'success'
});
} catch (error) {
Expand Down Expand Up @@ -78,7 +78,7 @@ class AppController {
res.status(httpStatus.OK).json({
data: {
app: {
key: key
key
}
},
message: 'App key successfully generated'
Expand Down Expand Up @@ -114,7 +114,7 @@ class AppController {

res.status(httpStatus.OK).json({
data: {
appKey: appKey
appKey
},
message: `App key successfully updated`
});
Expand Down
2 changes: 1 addition & 1 deletion src/server/auth/auth.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class AuthController {

try {
const user = await User.findOne()
.where({ email: email })
.where({ email })
.where({ isDeleted: false })
.exec();

Expand Down
6 changes: 3 additions & 3 deletions src/server/data-source/data-source.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ class DataSourceController {

const data = {
total: sources.length,
sources: sources
sources
};

res.status(httpStatus.OK).json({
data: data,
data,
message: 'success'
});
} catch (error) {
Expand Down Expand Up @@ -84,7 +84,7 @@ class DataSourceController {

res.status(httpStatus.OK).json({
data: {
source: source
source
},
message: 'Data source successfully updated'
});
Expand Down
12 changes: 6 additions & 6 deletions src/server/feature/feature.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class FeatureController {
try {
const features = await Feature.find()
.select()
.where({ isDeleted: false, source: source })
.where({ isDeleted: false, source })
.exec();

if (!features) {
Expand All @@ -20,11 +20,11 @@ class FeatureController {

const data = {
total: features.length,
features: features
features
};

res.status(httpStatus.OK).json({
data: data,
data,
message: 'success'
});
} catch (error) {
Expand All @@ -51,11 +51,11 @@ class FeatureController {

const data = {
total: features.length,
features: features
features
};

res.status(httpStatus.OK).json({
data: data,
data,
message: 'success'
});
} catch (error) {
Expand Down Expand Up @@ -126,7 +126,7 @@ class FeatureController {

res.status(httpStatus.OK).json({
data: {
feature: feature
feature
},
message: `Feature successfully updated`
});
Expand Down
6 changes: 3 additions & 3 deletions src/server/file/data/data.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class DataController {
}

res.status(httpStatus.OK).json({
data: data,
data,
message: 'success'
});
}
Expand Down Expand Up @@ -181,7 +181,7 @@ class DataController {
}

res.status(httpStatus.OK).json({
data: data,
data,
message: 'success'
});
} catch (error) {
Expand Down Expand Up @@ -432,7 +432,7 @@ class DataController {

res.status(httpStatus.OK).json({
data: {
file: file
file
},
message: 'File successfully modified.'
});
Expand Down
4 changes: 2 additions & 2 deletions src/server/job/job.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class JobController {

res.status(httpStatus.OK).json({
data: {
jobs: jobs
jobs
},
message: 'success'
});
Expand Down Expand Up @@ -494,7 +494,7 @@ class JobController {

res.status(httpStatus.OK).json({
data: {
job: job
job
},
message: `Job successfully deleted`
});
Expand Down
2 changes: 1 addition & 1 deletion src/server/job/log/log.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class JobController {
res.write(
'data: ' +
JSON.stringify({
action: action,
action,
date: dayjs().format('DD-MM-YYYY HH:mm'),
job: jobObj
}) +
Expand Down
12 changes: 6 additions & 6 deletions src/server/user/admin/admin.user.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AdminController {
try {
const user = await User.findOne()
.select(['lastname', 'firstname', 'email'])
.where({ email: email })
.where({ email })
.where({ isDeleted: false })
.exec();

Expand All @@ -23,7 +23,7 @@ class AdminController {

res.status(httpStatus.OK).json({
data: {
user: user
user
},
message: 'success'
});
Expand Down Expand Up @@ -79,11 +79,11 @@ class AdminController {

const data = {
total: users.length,
users: users
users
};

res.status(httpStatus.OK).json({
data: data,
data,
message: 'success'
});
} catch (error) {
Expand Down Expand Up @@ -116,7 +116,7 @@ class AdminController {

res.status(httpStatus.OK).json({
data: {
user: user
user
},
message: `User successfully updated`
});
Expand Down Expand Up @@ -207,7 +207,7 @@ class AdminController {

res.status(httpStatus.OK).json({
data: {
user: user
user
},
message: 'Temporary password successfully applied'
});
Expand Down
6 changes: 3 additions & 3 deletions src/server/user/user.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class UserController {

res.status(httpStatus.OK).json({
data: {
user: user
user
},
message: 'success'
});
Expand Down Expand Up @@ -72,7 +72,7 @@ class UserController {
res.status(httpStatus.OK).json({
data: {
user: {
token: token
token
}
},
message: 'User successfully updated'
Expand Down Expand Up @@ -135,7 +135,7 @@ class UserController {
res.status(httpStatus.OK).json({
data: {
user: {
token: token
token
}
},
message: 'Password successfully modified'
Expand Down
2 changes: 1 addition & 1 deletion src/server/user/user.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class User extends Schema {
return {
data: {
user: {
token: token
token
}
},
message: 'User successfully authenticated.'
Expand Down
4 changes: 2 additions & 2 deletions src/server/window/window.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ class WindowController {

const data = {
total: functions.length,
functions: functions
functions
};

res.status(httpStatus.OK).json({
data: data,
data,
message: 'success'
});
} catch (error) {
Expand Down

0 comments on commit 094c431

Please sign in to comment.