-})
-@Scopes({
- [ScopeNames.AVAILABLE_FOR_LIST]: (options: AvailableForListOptions) => {
- const actorIdNumber = parseInt(options.actorId + '', 10)
+}))
+@Scopes(() => ({
+ [ScopeNames.SUMMARY]: (options: SummaryOptions = {}) => {
+ const base: FindOptions = {
+ attributes: [ 'name', 'description', 'id', 'actorId' ],
+ include: [
+ {
+ attributes: [ 'preferredUsername', 'url', 'serverId', 'avatarId' ],
+ model: ActorModel.unscoped(),
+ required: true,
+ include: [
+ {
+ attributes: [ 'host' ],
+ model: ServerModel.unscoped(),
+ required: false
+ },
+ {
+ model: AvatarModel.unscoped(),
+ required: false
+ }
+ ]
+ }
+ ]
+ }
+
+ if (options.withAccount === true) {
+ base.include.push({
+ model: AccountModel.scope({
+ method: [ AccountModelScopeNames.SUMMARY, { withAccountBlockerIds: options.withAccountBlockerIds } as AccountSummaryOptions ]
+ }),
+ required: true
+ })
+ }