X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Faccount%2Faccount-blocklist.ts;h=b2375b00648ac8a79d2aa0e05750a64744c7321d;hb=cf21b2cbef61929177b9c09b5e017c3b7eb8535d;hp=cf8872fd5f9153976fb7beca3fd79557d26ce121;hpb=26d6bf6533023326fa017812cf31bbe20c752d36;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/account/account-blocklist.ts b/server/models/account/account-blocklist.ts index cf8872fd5..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 { BelongsTo, Column, CreatedAt, ForeignKey, Model, Scopes, Table, UpdatedAt } from 'sequelize-typescript' import { MAccountBlocklist, MAccountBlocklistAccounts, MAccountBlocklistFormattable } from '@server/types/models' -import { ActorModel } from '../activitypub/actor' +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