aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account/account-follow.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-14 17:31:26 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:51 +0100
commit350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad (patch)
treef4191f3c04a5230fcf8ca3d6ca3248643fc4151d /server/models/account/account-follow.ts
parente34c85e527100c0b5c44567bd951e95be41b8d7e (diff)
downloadPeerTube-350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad.tar.gz
PeerTube-350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad.tar.zst
PeerTube-350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad.zip
Follow works
Diffstat (limited to 'server/models/account/account-follow.ts')
-rw-r--r--server/models/account/account-follow.ts15
1 files changed, 9 insertions, 6 deletions
diff --git a/server/models/account/account-follow.ts b/server/models/account/account-follow.ts
index e6abc893a..7c129ab9d 100644
--- a/server/models/account/account-follow.ts
+++ b/server/models/account/account-follow.ts
@@ -19,11 +19,13 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da
19 { 19 {
20 indexes: [ 20 indexes: [
21 { 21 {
22 fields: [ 'accountId' ], 22 fields: [ 'accountId' ]
23 unique: true 23 },
24 {
25 fields: [ 'targetAccountId' ]
24 }, 26 },
25 { 27 {
26 fields: [ 'targetAccountId' ], 28 fields: [ 'accountId', 'targetAccountId' ],
27 unique: true 29 unique: true
28 } 30 }
29 ] 31 ]
@@ -31,7 +33,8 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da
31 ) 33 )
32 34
33 const classMethods = [ 35 const classMethods = [
34 associate 36 associate,
37 loadByAccountAndTarget
35 ] 38 ]
36 addMethodsToModel(AccountFollow, classMethods) 39 addMethodsToModel(AccountFollow, classMethods)
37 40
@@ -46,7 +49,7 @@ function associate (models) {
46 name: 'accountId', 49 name: 'accountId',
47 allowNull: false 50 allowNull: false
48 }, 51 },
49 as: 'followers', 52 as: 'accountFollowers',
50 onDelete: 'CASCADE' 53 onDelete: 'CASCADE'
51 }) 54 })
52 55
@@ -55,7 +58,7 @@ function associate (models) {
55 name: 'targetAccountId', 58 name: 'targetAccountId',
56 allowNull: false 59 allowNull: false
57 }, 60 },
58 as: 'following', 61 as: 'accountFollowing',
59 onDelete: 'CASCADE' 62 onDelete: 'CASCADE'
60 }) 63 })
61} 64}