0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Replace knex.transaction by models.Base.transaction

no issue

- there was mixed usage of how we instantiate a transaction
- with fb79f24316 (diff-f8d02ad12b13d44b912bbf46cf7193b6) it's becoming important
  to use bookshelf transactions
This commit is contained in:
kirrg001 2018-05-03 11:44:32 +02:00
parent ac8272a383
commit b0de6eaf87
2 changed files with 2 additions and 4 deletions

View file

@ -5,12 +5,11 @@ var oauth2orize = require('oauth2orize'),
authUtils = require('./utils'),
spamPrevention = require('../../web/middleware/api/spam-prevention'),
common = require('../../lib/common'),
knex = require('../../data/db').knex,
oauthServer,
oauth;
function exchangeRefreshToken(client, refreshToken, scope, body, authInfo, done) {
knex.transaction(function (transacting) {
models.Base.transaction(function (transacting) {
var options = {
transacting: transacting
};

View file

@ -4,7 +4,6 @@ var Promise = require('bluebird'),
models = require('../../models'),
security = require('../../lib/security'),
constants = require('../../lib/constants'),
knex = require('../../data/db').knex,
_private = {};
/**
@ -106,7 +105,7 @@ module.exports.createTokens = function createTokens(data, modelOptions) {
return _private.handleTokenCreation(data, modelOptions);
}
return knex.transaction(function (transaction) {
return models.Base.transaction(function (transaction) {
modelOptions.transacting = transaction;
return _private.handleTokenCreation(data, modelOptions);