diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-06-10 22:15:25 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-06-10 22:15:25 +0200 |
commit | 69818c9394366b954b6ba3bd697bd9d2b09f2a16 (patch) | |
tree | ad199a18ec3c322460d6f9523fc383ee562554e0 /server/models/author.ts | |
parent | 4d4e5cd4dca78480ec7f40e747f424cd107376a4 (diff) | |
download | PeerTube-69818c9394366b954b6ba3bd697bd9d2b09f2a16.tar.gz PeerTube-69818c9394366b954b6ba3bd697bd9d2b09f2a16.tar.zst PeerTube-69818c9394366b954b6ba3bd697bd9d2b09f2a16.zip |
Type functions
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) |