diff options
Diffstat (limited to 'server/models/author.ts')
-rw-r--r-- | server/models/author.ts | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/server/models/author.ts b/server/models/author.ts index b543d17a0..3264d3a88 100644 --- a/server/models/author.ts +++ b/server/models/author.ts | |||
@@ -74,12 +74,13 @@ function associate (models) { | |||
74 | }) | 74 | }) |
75 | } | 75 | } |
76 | 76 | ||
77 | findOrCreateAuthor = function (name, podId, userId, transaction, callback) { | 77 | findOrCreateAuthor = function ( |
78 | if (!callback) { | 78 | name: string, |
79 | callback = transaction | 79 | podId: number, |
80 | transaction = null | 80 | userId: number, |
81 | } | 81 | transaction: Sequelize.Transaction, |
82 | 82 | callback: AuthorMethods.FindOrCreateAuthorCallback | |
83 | ) { | ||
83 | const author = { | 84 | const author = { |
84 | name, | 85 | name, |
85 | podId, | 86 | podId, |
@@ -91,7 +92,7 @@ findOrCreateAuthor = function (name, podId, userId, transaction, callback) { | |||
91 | defaults: author | 92 | defaults: author |
92 | } | 93 | } |
93 | 94 | ||
94 | if (transaction) query.transaction = transaction | 95 | if (transaction !== null) query.transaction = transaction |
95 | 96 | ||
96 | Author.findOrCreate(query).asCallback(function (err, result) { | 97 | Author.findOrCreate(query).asCallback(function (err, result) { |
97 | if (err) return callback(err) | 98 | if (err) return callback(err) |