} from 'sequelize-typescript'
import { Account } from '../../../shared/models/actors'
import { isAccountDescriptionValid } from '../../helpers/custom-validators/accounts'
-import { logger } from '../../helpers/logger'
import { sendDeleteActor } from '../../lib/activitypub/send'
import { ActorModel } from '../activitypub/actor'
import { ApplicationModel } from '../application/application'
]
})
@Table({
- tableName: 'account'
+ tableName: 'account',
+ indexes: [
+ {
+ fields: [ 'actorId' ],
+ unique: true
+ },
+ {
+ fields: [ 'applicationId' ]
+ },
+ {
+ fields: [ 'userId' ]
+ }
+ ]
})
export class AccountModel extends Model<AccountModel> {
}
if (instance.isOwned()) {
- logger.debug('Sending delete of actor of account %s.', instance.Actor.url)
return sendDeleteActor(instance.Actor, options.transaction)
}
const actor = this.Actor.toFormattedJSON()
const account = {
id: this.id,
- displayName: this.name,
+ displayName: this.getDisplayName(),
description: this.description,
createdAt: this.createdAt,
updatedAt: this.updatedAt
isOwned () {
return this.Actor.isOwned()
}
+
+ getDisplayName () {
+ return this.name
+ }
}