X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Faccount%2Faccount-blocklist.ts;h=b2375b00648ac8a79d2aa0e05750a64744c7321d;hb=8ee37c5f38b0f9b7e97239197d5590109c163250;hp=2c6b756d20d3c613a1707ec7e529a06ff1861f1a;hpb=5fb2e2888ce032c638e4b75d07458642f0833e52;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/account/account-blocklist.ts b/server/models/account/account-blocklist.ts index 2c6b756d2..b2375b006 100644 --- a/server/models/account/account-blocklist.ts +++ b/server/models/account/account-blocklist.ts @@ -1,12 +1,12 @@ -import { BelongsTo, Column, CreatedAt, ForeignKey, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript' -import { AccountModel } from './account' -import { getSort, searchAttribute } from '../utils' -import { AccountBlock } from '../../../shared/models/blocklist' import { Op } from 'sequelize' -import * as Bluebird from 'bluebird' -import { MAccountBlocklist, MAccountBlocklistAccounts, MAccountBlocklistFormattable } from '@server/typings/models' -import { ActorModel } from '../activitypub/actor' +import { BelongsTo, Column, CreatedAt, ForeignKey, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript' +import { MAccountBlocklist, MAccountBlocklistAccounts, MAccountBlocklistFormattable } from '@server/types/models' +import { AttributesOnly } from '@shared/core-utils' +import { AccountBlock } from '../../../shared/models' +import { ActorModel } from '../actor/actor' import { ServerModel } from '../server/server' +import { getSort, searchAttribute } from '../utils' +import { AccountModel } from './account' enum ScopeNames { WITH_ACCOUNTS = 'WITH_ACCOUNTS' @@ -41,7 +41,7 @@ enum ScopeNames { } ] }) -export class AccountBlocklistModel extends Model { +export class AccountBlocklistModel extends Model>> { @CreatedAt createdAt: Date @@ -102,7 +102,7 @@ export class AccountBlocklistModel extends Model { }) } - static loadByAccountAndTarget (accountId: number, targetAccountId: number): Bluebird { + static loadByAccountAndTarget (accountId: number, targetAccountId: number): Promise { const query = { where: { accountId, @@ -151,9 +151,9 @@ export class AccountBlocklistModel extends Model { }) } - static listHandlesBlockedBy (accountIds: number[]): Bluebird { + static listHandlesBlockedBy (accountIds: number[]): Promise { const query = { - attributes: [], + attributes: [ 'id' ], where: { accountId: { [Op.in]: accountIds