diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-15 11:53:26 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-08-19 17:26:35 +0200 |
commit | 453e83ea5d81d203ba34bc43cd5c2c750ba40568 (patch) | |
tree | 604e02f4343d13a4ba42e1fb7527ba6ab9111712 /server/lib/blocklist.ts | |
parent | 13176a07a95984a53cc59aec5217f2ce9806d1bc (diff) | |
download | PeerTube-453e83ea5d81d203ba34bc43cd5c2c750ba40568.tar.gz PeerTube-453e83ea5d81d203ba34bc43cd5c2c750ba40568.tar.zst PeerTube-453e83ea5d81d203ba34bc43cd5c2c750ba40568.zip |
Stronger model typings
Diffstat (limited to 'server/lib/blocklist.ts')
-rw-r--r-- | server/lib/blocklist.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/server/lib/blocklist.ts b/server/lib/blocklist.ts index 1633e500c..28c69b46e 100644 --- a/server/lib/blocklist.ts +++ b/server/lib/blocklist.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { sequelizeTypescript } from '../initializers' | 1 | import { sequelizeTypescript } from '../initializers' |
2 | import { AccountBlocklistModel } from '../models/account/account-blocklist' | 2 | import { AccountBlocklistModel } from '../models/account/account-blocklist' |
3 | import { ServerBlocklistModel } from '../models/server/server-blocklist' | 3 | import { ServerBlocklistModel } from '../models/server/server-blocklist' |
4 | import { MAccountBlocklist, MServerBlocklist } from '@server/typings/models' | ||
4 | 5 | ||
5 | function addAccountInBlocklist (byAccountId: number, targetAccountId: number) { | 6 | function addAccountInBlocklist (byAccountId: number, targetAccountId: number) { |
6 | return sequelizeTypescript.transaction(async t => { | 7 | return sequelizeTypescript.transaction(async t => { |
@@ -20,13 +21,13 @@ function addServerInBlocklist (byAccountId: number, targetServerId: number) { | |||
20 | }) | 21 | }) |
21 | } | 22 | } |
22 | 23 | ||
23 | function removeAccountFromBlocklist (accountBlock: AccountBlocklistModel) { | 24 | function removeAccountFromBlocklist (accountBlock: MAccountBlocklist) { |
24 | return sequelizeTypescript.transaction(async t => { | 25 | return sequelizeTypescript.transaction(async t => { |
25 | return accountBlock.destroy({ transaction: t }) | 26 | return accountBlock.destroy({ transaction: t }) |
26 | }) | 27 | }) |
27 | } | 28 | } |
28 | 29 | ||
29 | function removeServerFromBlocklist (serverBlock: ServerBlocklistModel) { | 30 | function removeServerFromBlocklist (serverBlock: MServerBlocklist) { |
30 | return sequelizeTypescript.transaction(async t => { | 31 | return sequelizeTypescript.transaction(async t => { |
31 | return serverBlock.destroy({ transaction: t }) | 32 | return serverBlock.destroy({ transaction: t }) |
32 | }) | 33 | }) |