Skip to content

Commit

Permalink
fix error by moving the function after the save method
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorCapCoder committed Sep 1, 2023
1 parent 7ad0804 commit 01930ed
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,15 @@ export class UserLoginMigrationService {
userLoginMigration.finishedAt = oauthMigrationFinished
? new Date(Date.now() + (Configuration.get('MIGRATION_END_GRACE_PERIOD_MS') as number))
: undefined;

await this.schoolService.removeFeature(schoolId, SchoolFeatures.ENABLE_LDAP_SYNC_DURING_MIGRATION);
}

const savedMigration: UserLoginMigrationDO = await this.userLoginMigrationRepo.save(userLoginMigration);

// userLoginMigration throws an error when saved, if this codeblock runs before the userLoginMigrationRepo.save method.
if (oauthMigrationFinished !== undefined) {
await this.schoolService.removeFeature(schoolId, SchoolFeatures.ENABLE_LDAP_SYNC_DURING_MIGRATION);
}

return savedMigration;
}

Expand Down

0 comments on commit 01930ed

Please sign in to comment.