diff --git a/services/web/app/src/models/DeletedProject.js b/services/web/app/src/models/DeletedProject.js index f961c69ebf..19659406c3 100644 --- a/services/web/app/src/models/DeletedProject.js +++ b/services/web/app/src/models/DeletedProject.js @@ -1,5 +1,3 @@ -// TODO: This file was created by bulk-decaffeinate. -// Sanity-check the conversion and remove this comment. const mongoose = require('mongoose') const Settings = require('settings-sharelatex') const { ProjectSchema } = require('./Project') diff --git a/services/web/app/src/models/Doc.js b/services/web/app/src/models/Doc.js index 93aa99c2cc..6b9c0c0eb2 100644 --- a/services/web/app/src/models/Doc.js +++ b/services/web/app/src/models/Doc.js @@ -1,13 +1,6 @@ -/* eslint-disable - no-unused-vars, -*/ -// TODO: This file was created by bulk-decaffeinate. -// Fix any style issues and re-enable lint. const mongoose = require('mongoose') -const Settings = require('settings-sharelatex') const { Schema } = mongoose -const { ObjectId } = Schema const DocSchema = new Schema({ name: { type: String, default: 'new doc' } diff --git a/services/web/app/src/models/File.js b/services/web/app/src/models/File.js index f089f13cf7..3c4d50eeea 100644 --- a/services/web/app/src/models/File.js +++ b/services/web/app/src/models/File.js @@ -1,13 +1,6 @@ -/* eslint-disable - no-unused-vars, -*/ -// TODO: This file was created by bulk-decaffeinate. -// Fix any style issues and re-enable lint. const mongoose = require('mongoose') -const Settings = require('settings-sharelatex') const { Schema } = mongoose -const { ObjectId } = Schema const FileSchema = new Schema({ name: { diff --git a/services/web/app/src/models/Folder.js b/services/web/app/src/models/Folder.js index efd0608ec3..5f371b4201 100644 --- a/services/web/app/src/models/Folder.js +++ b/services/web/app/src/models/Folder.js @@ -1,15 +1,8 @@ -/* eslint-disable - no-unused-vars, -*/ -// TODO: This file was created by bulk-decaffeinate. -// Fix any style issues and re-enable lint. const mongoose = require('mongoose') -const Settings = require('settings-sharelatex') const { DocSchema } = require('./Doc') const { FileSchema } = require('./File') const { Schema } = mongoose -const { ObjectId } = Schema const FolderSchema = new Schema({ name: { type: String, default: 'new folder' } diff --git a/services/web/app/src/models/Institution.js b/services/web/app/src/models/Institution.js index 7425989d62..1fcd3470f0 100644 --- a/services/web/app/src/models/Institution.js +++ b/services/web/app/src/models/Institution.js @@ -1,15 +1,6 @@ /* eslint-disable - handle-callback-err, - max-len, + handle-callback-err */ -// TODO: This file was created by bulk-decaffeinate. -// Fix any style issues and re-enable lint. -/* - * decaffeinate suggestions: - * DS102: Remove unnecessary code created because of implicit returns - * DS207: Consider shorter variations of null checks - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md - */ const mongoose = require('mongoose') const { Schema } = mongoose const { ObjectId } = Schema diff --git a/services/web/app/src/models/OauthAccessToken.js b/services/web/app/src/models/OauthAccessToken.js index 61011aa3cb..ab17f23048 100644 --- a/services/web/app/src/models/OauthAccessToken.js +++ b/services/web/app/src/models/OauthAccessToken.js @@ -1,5 +1,3 @@ -// TODO: This file was created by bulk-decaffeinate. -// Sanity-check the conversion and remove this comment. const mongoose = require('mongoose') const Settings = require('settings-sharelatex') diff --git a/services/web/app/src/models/OauthApplication.js b/services/web/app/src/models/OauthApplication.js index 5c728f6ae1..cdc99b8961 100644 --- a/services/web/app/src/models/OauthApplication.js +++ b/services/web/app/src/models/OauthApplication.js @@ -1,13 +1,7 @@ -/* eslint-disable - no-unused-vars, -*/ -// TODO: This file was created by bulk-decaffeinate. -// Fix any style issues and re-enable lint. const mongoose = require('mongoose') const Settings = require('settings-sharelatex') const { Schema } = mongoose -const { ObjectId } = Schema const OauthApplicationSchema = new Schema( { diff --git a/services/web/app/src/models/OauthAuthorizationCode.js b/services/web/app/src/models/OauthAuthorizationCode.js index 003606c3ef..c1e4e800ce 100644 --- a/services/web/app/src/models/OauthAuthorizationCode.js +++ b/services/web/app/src/models/OauthAuthorizationCode.js @@ -1,8 +1,3 @@ -/* eslint-disable - max-len, -*/ -// TODO: This file was created by bulk-decaffeinate. -// Fix any style issues and re-enable lint. const mongoose = require('mongoose') const Settings = require('settings-sharelatex') diff --git a/services/web/app/src/models/Project.js b/services/web/app/src/models/Project.js index 6f85970c76..b776fd40eb 100644 --- a/services/web/app/src/models/Project.js +++ b/services/web/app/src/models/Project.js @@ -1,21 +1,7 @@ -/* eslint-disable - camelcase, - max-len, - no-unused-vars, -*/ -// TODO: This file was created by bulk-decaffeinate. -// Fix any style issues and re-enable lint. -/* - * decaffeinate suggestions: - * DS102: Remove unnecessary code created because of implicit returns - * DS207: Consider shorter variations of null checks - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md - */ const mongoose = require('mongoose') const Settings = require('settings-sharelatex') const _ = require('underscore') const { FolderSchema } = require('./Folder.js') -const logger = require('logger-sharelatex') const concreteObjectId = require('mongoose').Types.ObjectId const Errors = require('../Features/Errors/Errors') @@ -132,16 +118,16 @@ const ProjectSchema = new Schema({ auditLog: [AuditLogEntrySchema] }) -ProjectSchema.statics.getProject = function(project_or_id, fields, callback) { - if (project_or_id._id != null) { - return callback(null, project_or_id) +ProjectSchema.statics.getProject = function(projectOrId, fields, callback) { + if (projectOrId._id != null) { + return callback(null, projectOrId) } else { try { - concreteObjectId(project_or_id.toString()) + concreteObjectId(projectOrId.toString()) } catch (e) { return callback(new Errors.NotFoundError(e.message)) } - return this.findById(project_or_id, fields, callback) + return this.findById(projectOrId, fields, callback) } } diff --git a/services/web/app/src/models/ProjectInvite.js b/services/web/app/src/models/ProjectInvite.js index 03a8d1b873..f19043607f 100644 --- a/services/web/app/src/models/ProjectInvite.js +++ b/services/web/app/src/models/ProjectInvite.js @@ -1,8 +1,3 @@ -/* eslint-disable - max-len, -*/ -// TODO: This file was created by bulk-decaffeinate. -// Fix any style issues and re-enable lint. const mongoose = require('mongoose') const Settings = require('settings-sharelatex') diff --git a/services/web/app/src/models/Publisher.js b/services/web/app/src/models/Publisher.js index 8efa962f63..5510bc697d 100644 --- a/services/web/app/src/models/Publisher.js +++ b/services/web/app/src/models/Publisher.js @@ -1,15 +1,6 @@ /* eslint-disable - handle-callback-err, - max-len, + handle-callback-err */ -// TODO: This file was created by bulk-decaffeinate. -// Fix any style issues and re-enable lint. -/* - * decaffeinate suggestions: - * DS102: Remove unnecessary code created because of implicit returns - * DS207: Consider shorter variations of null checks - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md - */ const mongoose = require('mongoose') const { Schema } = mongoose const { ObjectId } = Schema diff --git a/services/web/app/src/models/Subscription.js b/services/web/app/src/models/Subscription.js index 0e5d9c9f82..735302de9a 100644 --- a/services/web/app/src/models/Subscription.js +++ b/services/web/app/src/models/Subscription.js @@ -1,15 +1,6 @@ /* eslint-disable - handle-callback-err, - max-len, + handle-callback-err */ -// TODO: This file was created by bulk-decaffeinate. -// Fix any style issues and re-enable lint. -/* - * decaffeinate suggestions: - * DS102: Remove unnecessary code created because of implicit returns - * DS207: Consider shorter variations of null checks - * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md - */ const mongoose = require('mongoose') const Settings = require('settings-sharelatex') const { TeamInviteSchema } = require('./TeamInvite') diff --git a/services/web/app/src/models/SystemMessage.js b/services/web/app/src/models/SystemMessage.js index 5b61f96a8f..464b06fa3b 100644 --- a/services/web/app/src/models/SystemMessage.js +++ b/services/web/app/src/models/SystemMessage.js @@ -1,13 +1,7 @@ -/* eslint-disable - no-unused-vars, -*/ -// TODO: This file was created by bulk-decaffeinate. -// Fix any style issues and re-enable lint. const mongoose = require('mongoose') const Settings = require('settings-sharelatex') const { Schema } = mongoose -const { ObjectId } = Schema const SystemMessageSchema = new Schema({ content: { type: String, default: '' } diff --git a/services/web/app/src/models/TeamInvite.js b/services/web/app/src/models/TeamInvite.js index d0a1ab7cd0..e8b75630cb 100644 --- a/services/web/app/src/models/TeamInvite.js +++ b/services/web/app/src/models/TeamInvite.js @@ -1,13 +1,6 @@ -/* eslint-disable - no-unused-vars, -*/ -// TODO: This file was created by bulk-decaffeinate. -// Fix any style issues and re-enable lint. const mongoose = require('mongoose') -const Settings = require('settings-sharelatex') const { Schema } = mongoose -const { ObjectId } = Schema const TeamInviteSchema = new Schema({ email: { type: String, required: true }, diff --git a/services/web/app/src/models/User.js b/services/web/app/src/models/User.js index cb3b96032b..99468bf4b5 100644 --- a/services/web/app/src/models/User.js +++ b/services/web/app/src/models/User.js @@ -1,12 +1,4 @@ -/* eslint-disable - max-len, - no-unused-vars, -*/ -// TODO: This file was created by bulk-decaffeinate. -// Fix any style issues and re-enable lint. -const { Project } = require('./Project') const Settings = require('settings-sharelatex') -const _ = require('underscore') const mongoose = require('mongoose') const uuid = require('uuid') const { Schema } = mongoose @@ -134,6 +126,6 @@ const conn = mongoose.createConnection(Settings.mongo.url, { const User = conn.model('User', UserSchema) -const model = mongoose.model('User', UserSchema) +mongoose.model('User', UserSchema) exports.User = User exports.UserSchema = UserSchema diff --git a/services/web/app/src/models/UserStub.js b/services/web/app/src/models/UserStub.js index 89e5f1bea5..36f5a2b812 100644 --- a/services/web/app/src/models/UserStub.js +++ b/services/web/app/src/models/UserStub.js @@ -1,12 +1,6 @@ -/* eslint-disable - no-unused-vars, -*/ -// TODO: This file was created by bulk-decaffeinate. -// Fix any style issues and re-enable lint. const Settings = require('settings-sharelatex') const mongoose = require('mongoose') const { Schema } = mongoose -const { ObjectId } = Schema const UserStubSchema = new Schema({ email: { type: String, default: '' }, @@ -24,5 +18,6 @@ const conn = mongoose.createConnection(Settings.mongo.url, { const UserStub = conn.model('UserStub', UserStubSchema) -const model = mongoose.model('UserStub', UserStubSchema) +mongoose.model('UserStub', UserStubSchema) exports.UserStub = UserStub +exports.UserStubSchema = UserStubSchema