aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/author.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-12-29 10:33:36 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-12-29 10:56:07 +0100
commit4712081f2a5f48749cf125d729e78b926ab28d6d (patch)
treeb0f2f380f6fe5403fb89fb5cfdbe9deafea1c889 /server/models/author.js
parent319d072e8eb7266cd8d33e0bb2fb5ebe76c487d1 (diff)
downloadPeerTube-4712081f2a5f48749cf125d729e78b926ab28d6d.tar.gz
PeerTube-4712081f2a5f48749cf125d729e78b926ab28d6d.tar.zst
PeerTube-4712081f2a5f48749cf125d729e78b926ab28d6d.zip
Server: add association between author and user
Diffstat (limited to 'server/models/author.js')
-rw-r--r--server/models/author.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/server/models/author.js b/server/models/author.js
index 8f5b598c8..5835ada99 100644
--- a/server/models/author.js
+++ b/server/models/author.js
@@ -23,6 +23,9 @@ module.exports = function (sequelize, DataTypes) {
23 }, 23 },
24 { 24 {
25 fields: [ 'podId' ] 25 fields: [ 'podId' ]
26 },
27 {
28 fields: [ 'userId' ]
26 } 29 }
27 ], 30 ],
28 classMethods: { 31 classMethods: {
@@ -44,4 +47,12 @@ function associate (models) {
44 }, 47 },
45 onDelete: 'cascade' 48 onDelete: 'cascade'
46 }) 49 })
50
51 this.belongsTo(models.User, {
52 foreignKey: {
53 name: 'userId',
54 allowNull: true
55 },
56 onDelete: 'cascade'
57 })
47} 58}