aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-20 09:43:39 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:52 +0100
commit54141398354e6e7b94aa3065a705a1251390111c (patch)
tree8d30d1b9ea8acbe04f6d404125b04fc0c9897b70 /server/models/account
parenteb8b27c93e61a896a08923dc1ca3c87ba8cf4948 (diff)
downloadPeerTube-54141398354e6e7b94aa3065a705a1251390111c.tar.gz
PeerTube-54141398354e6e7b94aa3065a705a1251390111c.tar.zst
PeerTube-54141398354e6e7b94aa3065a705a1251390111c.zip
Refractor activity pub lib/helpers
Diffstat (limited to 'server/models/account')
-rw-r--r--server/models/account/account-follow.ts14
-rw-r--r--server/models/account/account-interface.ts2
-rw-r--r--server/models/account/account.ts3
3 files changed, 15 insertions, 4 deletions
diff --git a/server/models/account/account-follow.ts b/server/models/account/account-follow.ts
index cc9b7c42b..f00c7dcd9 100644
--- a/server/models/account/account-follow.ts
+++ b/server/models/account/account-follow.ts
@@ -78,7 +78,19 @@ loadByAccountAndTarget = function (accountId: number, targetAccountId: number) {
78 where: { 78 where: {
79 accountId, 79 accountId,
80 targetAccountId 80 targetAccountId
81 } 81 },
82 include: [
83 {
84 model: AccountFollow[ 'sequelize' ].models.Account,
85 required: true,
86 as: 'AccountFollower'
87 },
88 {
89 model: AccountFollow['sequelize'].models.Account,
90 required: true,
91 as: 'AccountFollowing'
92 }
93 ]
82 } 94 }
83 95
84 return AccountFollow.findOne(query) 96 return AccountFollow.findOne(query)
diff --git a/server/models/account/account-interface.ts b/server/models/account/account-interface.ts
index 1a567fb7a..e30260f76 100644
--- a/server/models/account/account-interface.ts
+++ b/server/models/account/account-interface.ts
@@ -37,7 +37,7 @@ export interface AccountClass {
37 37
38export interface AccountAttributes { 38export interface AccountAttributes {
39 name: string 39 name: string
40 url: string 40 url?: string
41 publicKey: string 41 publicKey: string
42 privateKey: string 42 privateKey: string
43 followersCount: number 43 followersCount: number
diff --git a/server/models/account/account.ts b/server/models/account/account.ts
index faf5fa841..9a2921501 100644
--- a/server/models/account/account.ts
+++ b/server/models/account/account.ts
@@ -1,5 +1,4 @@
1import * as Sequelize from 'sequelize' 1import * as Sequelize from 'sequelize'
2
3import { 2import {
4 activityPubContextify, 3 activityPubContextify,
5 isAccountFollowersCountValid, 4 isAccountFollowersCountValid,
@@ -15,7 +14,7 @@ import {
15 isUserUsernameValid 14 isUserUsernameValid
16} from '../../helpers' 15} from '../../helpers'
17import { CONFIG, CONSTRAINTS_FIELDS } from '../../initializers/constants' 16import { CONFIG, CONSTRAINTS_FIELDS } from '../../initializers/constants'
18import { sendDeleteAccount } from '../../lib/activitypub/send-request' 17import { sendDeleteAccount } from '../../lib/activitypub/send/send-delete'
19 18
20import { addMethodsToModel } from '../utils' 19import { addMethodsToModel } from '../utils'
21import { AccountAttributes, AccountInstance, AccountMethods } from './account-interface' 20import { AccountAttributes, AccountInstance, AccountMethods } from './account-interface'