Skip to content

Commit

Permalink
[TECH] Mise à jour des dépendances de l'API
Browse files Browse the repository at this point in the history
Merge pull request #694 from 1024pix/tech-update-api-dependencies
  • Loading branch information
laura-bergoens authored Sep 13, 2019
2 parents d9a9e90 + 730b6be commit a1d6b48
Show file tree
Hide file tree
Showing 29 changed files with 5,539 additions and 5,629 deletions.
20 changes: 8 additions & 12 deletions api/db/migrations/20170105153948_update_answers_timeout.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
const TABLE_NAME = 'answers';

exports.up = function(knex, Promise) {
return Promise.all([
knex.schema.table(TABLE_NAME, function(table) {
table.integer('timeout');
})
]);
exports.up = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.integer('timeout');
});
};

exports.down = function(knex, Promise) {
return Promise.all([
knex.schema.table(TABLE_NAME, function(table) {
table.dropColumn('timeout');
})
]);
exports.down = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.dropColumn('timeout');
});
};
20 changes: 8 additions & 12 deletions api/db/migrations/20170329112753_add_elapsedTime_to_answers.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
const TABLE_NAME = 'answers';

exports.up = function(knex, Promise) {
return Promise.all([
knex.schema.table(TABLE_NAME, function(table) {
table.integer('elapsedTime');
})
]);
exports.up = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.integer('elapsedTime');
});
};

exports.down = function(knex, Promise) {
return Promise.all([
knex.schema.table(TABLE_NAME, function(table) {
table.dropColumn('elapsedTime');
})
]);
exports.down = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.dropColumn('elapsedTime');
});
};
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
const TABLE_NAME = 'answers';

exports.up = function(knex, Promise) {
return Promise.all([
knex.schema.table(TABLE_NAME, function(table) {
table.text('resultDetails');
})
]);
exports.up = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.text('resultDetails');
});
};

exports.down = function(knex, Promise) {
return Promise.all([
knex.schema.table(TABLE_NAME, function(table) {
table.dropColumn('resultDetails');
})
]);
exports.down = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.dropColumn('resultDetails');
});
};
28 changes: 11 additions & 17 deletions api/db/migrations/20170418114929_remove_login_from_users.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
const TABLE_NAME = 'users';

exports.up = function(knex, Promise) {

return Promise.all([
knex.schema.table(TABLE_NAME, function(table) {
table.dropColumn('login');
table.boolean('cgu');
table.unique('email');
})
]);

exports.up = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.dropColumn('login');
table.boolean('cgu');
table.unique('email');
});
};

exports.down = function(knex, Promise) {
return Promise.all([
knex.schema.table(TABLE_NAME, function(table) {
table.string('login').defaultTo('').notNullable();
table.dropColumn('cgu');
})
]);
exports.down = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.string('login').defaultTo('').notNullable();
table.dropColumn('cgu');
});
};
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
const TABLE_NAME = 'assessments';

exports.up = function(knex, Promise) {
return Promise.all([
knex.schema.table(TABLE_NAME, function(table) {
table.bigInteger('userId').index().references('users.id');
table.dropColumn('userName');
table.dropColumn('userEmail');
})
]);
exports.up = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.bigInteger('userId').index().references('users.id');
table.dropColumn('userName');
table.dropColumn('userEmail');
});
};

exports.down = function(knex, Promise) {
return Promise.all([
knex.schema.table(TABLE_NAME, function(table) {
table.dropColumn('userId');
table.string('userName').notNull();
table.string('userEmail').notNull();
})
]);
exports.down = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.dropColumn('userId');
table.string('userName').notNull();
table.string('userEmail').notNull();
});
};
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
const TABLE_NAME = 'assessments';

exports.up = function(knex, Promise) {
return Promise.all([
knex.schema.table(TABLE_NAME, function(table) {
table.integer('estimatedLevel');
table.integer('pixScore');
})
]);
exports.up = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.integer('estimatedLevel');
table.integer('pixScore');
});
};

exports.down = function(knex, Promise) {
return Promise.all([
knex.schema.table(TABLE_NAME, function(table) {
table.dropColumn('estimatedLevel');
table.dropColumn('pixScore');
})
]);
exports.down = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.dropColumn('estimatedLevel');
table.dropColumn('pixScore');
});
};
6 changes: 2 additions & 4 deletions api/db/migrations/20170724181108_creating_organizations.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ exports.up = function(knex) {
console.log('organizations table is created!');
});};

exports.down = function(knex, Promise) {
return Promise.all([
knex.schema.dropTable('organizations')
]);
exports.down = function(knex) {
return knex.schema.dropTable('organizations');
};
4 changes: 2 additions & 2 deletions api/db/migrations/20171113101130_certification-courses.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const TABLE_NAME = 'certification-courses';

exports.up = function(knex, Promise) {
exports.up = function(knex) {
function table(t) {
t.increments().primary();
t.dateTime('createdAt').notNullable().defaultTo(knex.fn.now());
Expand All @@ -14,7 +14,7 @@ exports.up = function(knex, Promise) {
});
};

exports.down = function(knex, Promise) {
exports.down = function(knex) {
return knex.schema
.dropTable(TABLE_NAME)
.then(() => {
Expand Down
4 changes: 2 additions & 2 deletions api/db/migrations/20171113101244_certification-challenges.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const TABLE_NAME = 'certification-challenges';

exports.up = function(knex, Promise) {
exports.up = function(knex) {
function table(t) {
t.increments().primary();
t.string('challengeId');
Expand All @@ -18,7 +18,7 @@ exports.up = function(knex, Promise) {
});
};

exports.down = function(knex, Promise) {
exports.down = function(knex) {
return knex.schema
.dropTable(TABLE_NAME)
.then(() => {
Expand Down
20 changes: 8 additions & 12 deletions api/db/migrations/20171113103608_add_type_to_assessments.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
const TABLE_NAME = 'assessments';

exports.up = function(knex, Promise) {
return Promise.all([
knex.schema.table(TABLE_NAME, function(table) {
table.string('type');
})
]);
exports.up = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.string('type');
});
};

exports.down = function(knex, Promise) {
return Promise.all([
knex.schema.table(TABLE_NAME, function(table) {
table.dropColumn('type');
})
]);
exports.down = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.dropColumn('type');
});
};
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
const TABLE_NAME = 'certification-courses';

exports.up = function(knex, Promise) {
return Promise.all([
knex.schema.table(TABLE_NAME, function(table) {
table.integer('userId').references('users.id').index();
})
]);
exports.up = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.integer('userId').references('users.id').index();
});
};

exports.down = function(knex, Promise) {
return Promise.all([
knex.schema.table(TABLE_NAME, function(table) {
table.dropColumn('userId');
})
]);
exports.down = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.dropColumn('userId');
});
};
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
const TABLE_NAME = 'certification-courses';

exports.up = function(knex, Promise) {
return Promise.all([
knex.schema.table(TABLE_NAME, function(table) {
table.string('status');
})
]);
exports.up = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.string('status');
});
};

exports.down = function(knex, Promise) {
return Promise.all([
knex.schema.table(TABLE_NAME, function(table) {
table.dropColumn('status');
})
]);
exports.down = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.dropColumn('status');
});
};
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
const TABLE_NAME = 'certification-courses';

exports.up = function(knex, Promise) {
return Promise.all([
knex.schema.table(TABLE_NAME, function(table) {
table.dateTime('completedAt');
})
]);
exports.up = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.dateTime('completedAt');
});
};

exports.down = function(knex, Promise) {
return Promise.all([
knex.schema.table(TABLE_NAME, function(table) {
table.dropColumn('completedAt');
})
]);
exports.down = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.dropColumn('completedAt');
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const NUMBER_OF_COMPETENCES = 16;
const MULTIPLICATOR_PERCENTAGE_TO_COMPETENCES = NUMBER_OF_COMPETENCES / 100;
const MULTIPLICATOR_COMPETENCES_TO_PERCENTAGE = 100 / NUMBER_OF_COMPETENCES;

exports.up = function(knex, Promise) {
exports.up = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.integer('testsFinished');
}).then(() => {
Expand All @@ -20,7 +20,7 @@ exports.up = function(knex, Promise) {
});
};

exports.down = function(knex, Promise) {
exports.down = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.integer('completionPercentage');
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const TYPE_CERTIFICATION = 'CERTIFICATION';
const TYPE_DEMO = 'DEMO';
const TYPE_PREVIEW = 'PREVIEW';

exports.up = function(knex, Promise) {
exports.up = function(knex) {

// XXX : Modify PREVIEW assessments
return knex(TABLE_NAME_ASSESSMENTS)
Expand Down Expand Up @@ -96,5 +96,5 @@ exports.up = function(knex, Promise) {

};

exports.down = function(knex, Promise) {
exports.down = function(knex) {
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { batch } = require('../batchTreatment');

const TABLE_NAME_ASSESSMENTS = 'assessments';

exports.up = function(knex, Promise) {
exports.up = function(knex) {
return knex(TABLE_NAME_ASSESSMENTS)
.select('id', 'estimatedLevel', 'pixScore', 'type')
.where('type', '=', 'PLACEMENT')
Expand All @@ -22,6 +22,6 @@ exports.up = function(knex, Promise) {
});
};

exports.down = function(knex, Promise) {
exports.down = function(knex) {

};
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
const TABLE_NAME = 'sessions';

exports.up = function(knex, Promise) {
exports.up = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.string('accessCode');
});
};

exports.down = function(knex, Promise) {
exports.down = function(knex) {
return knex.schema.table(TABLE_NAME, function(table) {
table.dropColumn('accessCode');
});
Expand Down
Loading

0 comments on commit a1d6b48

Please sign in to comment.