Showing 54 of 137 total issues
Function createAccomodation
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async createAccomodation(req) {
const { id: userId } = req.user;
const {
name,
cityId,
Function up
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('users', {
id: {
allowNull: false,
autoIncrement: true,
Function associate
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
users.associate = function(models) {
users.hasMany(
models.tripRequests,
{ targetKey: 'userId' },
{ onDelete: 'cascade' },
Function up
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('bookings', {
id: {
allowNull: false,
autoIncrement: true,
Function associate
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
accommodations.associate = function(models) {
accommodations.hasMany(models.accommodationImages,
{targetKey: 'accommodationId',
sourceKey:'id',
as:'imagesAccommodation'},
Function operateAcceptOrReject
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const operateAcceptOrReject = async (req, res, next) => {
const { id } = req.user;
const { tripRequestId } = req.params;
const users = await userProfiles.findAll({
where: { managerId: id }
Function up
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('comments', {
id: {
allowNull: false,
autoIncrement: true,
Function createNewTrip
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async createNewTrip(req, res, tripTypeId) {
try {
if (tripTypeId === 1) {
req.body.returnDate = null;
}
Function up
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('accommodations', {
id: {
allowNull: false,
autoIncrement: true,
Function up
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
up: (queryInterface, Sequelize) => {
return queryInterface.bulkInsert('roles', [
{
type: 'super admin',
createdAt: new Date(),
Function socialCallBack
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async socialCallBack(accessToken, refreshToken, profile, signupTypeParameter, done) {
try {
const data = {
id: profile.id,
firstName: profile.name.givenName,
Function editTripRequestToUser
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async editTripRequestToUser(req) {
const itinerary = req.body.itinerary ? req.body.itinerary : [req.body];
const findAllObjQuery = {
attributes: ['id'],
Function addCommentNotification
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async addCommentNotification(req) {
const { user, params } = req;
const tripRequestInfoObject = {
where: {
id: params.tripRequestId
Function getSingleTrip
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async getSingleTrip(tripRequestId) {
const singleTripObject = {
where: { id: tripRequestId },
include: [
{
Function managerRequests
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
let managerRequests = managerUsers.map(async user => {
const managerRequestsObj = {
where: { userId: user.userId, statusId: 1 },
attributes: ['id', 'updatedAt', 'createdAt'],
order: [
Function bookAccommodationService
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async bookAccommodationService(req, res) {
try {
const accommodationObj = {
raw: true
};
Function exports
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = (sequelize, DataTypes) => {
const tripRequests = sequelize.define('tripRequests', {
userId: DataTypes.INTEGER,
tripTypeId: DataTypes.INTEGER,
statusId: DataTypes.STRING,
Function up
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
up: (queryInterface, Sequelize) => {
return queryInterface.bulkInsert('users', [{
firstName: 'John',
lastName: 'Doe',
email: 'admin@gmail.com',
Function checkForSimilarRequests
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static async checkForSimilarRequests(req, res, next) {
const itinerary = req.body.itinerary ? req.body.itinerary : [req.body];
const allCitiess = await trips.findAll({
include: [{
Function up
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('rooms', {
id: {
allowNull: false,
autoIncrement: true,