chore: upgrade sequelize (#965)

* 0.18.0

* chore: Upgrade sequelize 4 -> 5

* fix: migrations v5 support

* fix: Majority of test failures

* fix: the rest of v5 tests
This commit is contained in:
Tom Moor
2019-06-23 15:49:45 -07:00
committed by GitHub
parent 595adeb55f
commit 32f83311f6
35 changed files with 260 additions and 7662 deletions

View File

@ -119,10 +119,10 @@ router.post('users.promote', auth(), async ctx => {
const teamId = ctx.state.user.teamId;
ctx.assertPresent(userId, 'id is required');
const user = await User.findById(userId);
const user = await User.findByPk(userId);
authorize(ctx.state.user, 'promote', user);
const team = await Team.findById(teamId);
const team = await Team.findByPk(teamId);
await team.addAdmin(user);
ctx.body = {
@ -135,10 +135,10 @@ router.post('users.demote', auth(), async ctx => {
const teamId = ctx.state.user.teamId;
ctx.assertPresent(userId, 'id is required');
const user = await User.findById(userId);
const user = await User.findByPk(userId);
authorize(ctx.state.user, 'demote', user);
const team = await Team.findById(teamId);
const team = await Team.findByPk(teamId);
try {
await team.removeAdmin(user);
} catch (err) {
@ -161,10 +161,10 @@ router.post('users.suspend', auth(), async ctx => {
const teamId = ctx.state.user.teamId;
ctx.assertPresent(userId, 'id is required');
const user = await User.findById(userId);
const user = await User.findByPk(userId);
authorize(ctx.state.user, 'suspend', user);
const team = await Team.findById(teamId);
const team = await Team.findByPk(teamId);
try {
await team.suspendUser(user, admin);
} catch (err) {
@ -188,10 +188,10 @@ router.post('users.activate', auth(), async ctx => {
const teamId = ctx.state.user.teamId;
ctx.assertPresent(userId, 'id is required');
const user = await User.findById(userId);
const user = await User.findByPk(userId);
authorize(ctx.state.user, 'activate', user);
const team = await Team.findById(teamId);
const team = await Team.findByPk(teamId);
await team.activateUser(user, admin);
ctx.body = {