aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/author.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-06-10 22:15:25 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-06-10 22:15:25 +0200
commit69818c9394366b954b6ba3bd697bd9d2b09f2a16 (patch)
treead199a18ec3c322460d6f9523fc383ee562554e0 /server/models/author.ts
parent4d4e5cd4dca78480ec7f40e747f424cd107376a4 (diff)
downloadPeerTube-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.ts15
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
77findOrCreateAuthor = function (name, podId, userId, transaction, callback) { 77findOrCreateAuthor = 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)