diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-12-29 10:33:36 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-12-29 10:56:07 +0100 |
commit | 4712081f2a5f48749cf125d729e78b926ab28d6d (patch) | |
tree | b0f2f380f6fe5403fb89fb5cfdbe9deafea1c889 /server/models/user.js | |
parent | 319d072e8eb7266cd8d33e0bb2fb5ebe76c487d1 (diff) | |
download | PeerTube-4712081f2a5f48749cf125d729e78b926ab28d6d.tar.gz PeerTube-4712081f2a5f48749cf125d729e78b926ab28d6d.tar.zst PeerTube-4712081f2a5f48749cf125d729e78b926ab28d6d.zip |
Server: add association between author and user
Diffstat (limited to 'server/models/user.js')
-rw-r--r-- | server/models/user.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/server/models/user.js b/server/models/user.js index 631cd96c9..36ed723cc 100644 --- a/server/models/user.js +++ b/server/models/user.js | |||
@@ -94,6 +94,11 @@ function toFormatedJSON () { | |||
94 | // ------------------------------ STATICS ------------------------------ | 94 | // ------------------------------ STATICS ------------------------------ |
95 | 95 | ||
96 | function associate (models) { | 96 | function associate (models) { |
97 | this.hasOne(models.Author, { | ||
98 | foreignKey: 'userId', | ||
99 | onDelete: 'cascade' | ||
100 | }) | ||
101 | |||
97 | this.hasMany(models.OAuthToken, { | 102 | this.hasMany(models.OAuthToken, { |
98 | foreignKey: 'userId', | 103 | foreignKey: 'userId', |
99 | onDelete: 'cascade' | 104 | onDelete: 'cascade' |