BeforeDestroy,
BelongsTo,
Column,
- CreatedAt, DataType,
+ CreatedAt,
+ DataType,
Default,
DefaultScope,
ForeignKey,
import { AccountBlocklistModel } from './account-blocklist'
import { ServerBlocklistModel } from '../server/server-blocklist'
import { ActorFollowModel } from '../activitypub/actor-follow'
+import { MAccountActor, MAccountDefault } from '../../typings/models'
+import * as Bluebird from 'bluebird'
export enum ScopeNames {
SUMMARY = 'SUMMARY'
return undefined
}
- static load (id: number, transaction?: Transaction) {
+ static load (id: number, transaction?: Transaction): Bluebird<MAccountDefault> {
return AccountModel.findByPk(id, { transaction })
}
- static loadByNameWithHost (nameWithHost: string) {
+ static loadByNameWithHost (nameWithHost: string): Bluebird<MAccountDefault> {
const [ accountName, host ] = nameWithHost.split('@')
if (!host || host === WEBSERVER.HOST) return AccountModel.loadLocalByName(accountName)
return AccountModel.loadByNameAndHost(accountName, host)
}
- static loadLocalByName (name: string) {
+ static loadLocalByName (name: string): Bluebird<MAccountDefault> {
const query = {
where: {
[ Op.or ]: [
return AccountModel.findOne(query)
}
- static loadByNameAndHost (name: string, host: string) {
+ static loadByNameAndHost (name: string, host: string): Bluebird<MAccountDefault> {
const query = {
include: [
{
return AccountModel.findOne(query)
}
- static loadByUrl (url: string, transaction?: Transaction) {
+ static loadByUrl (url: string, transaction?: Transaction): Bluebird<MAccountDefault> {
const query = {
include: [
{
})
}
- static listLocalsForSitemap (sort: string) {
+ static listLocalsForSitemap (sort: string): Bluebird<MAccountActor[]> {
const query = {
attributes: [ ],
offset: 0,