+ [ScopeNames.SUMMARY]: (options: SummaryOptions = {}) => {
+ const serverInclude: IncludeOptions = {
+ attributes: [ 'host' ],
+ model: ServerModel.unscoped(),
+ required: !!options.whereServer,
+ where: options.whereServer
+ }
+
+ const actorInclude: Includeable = {
+ attributes: [ 'id', 'preferredUsername', 'url', 'serverId' ],
+ model: ActorModel.unscoped(),
+ required: options.actorRequired ?? true,
+ where: options.whereActor,
+ include: [ serverInclude ]
+ }
+
+ if (options.forCount !== true) {
+ actorInclude.include.push({
+ model: ActorImageModel,
+ as: 'Avatars',
+ required: false
+ })
+ }
+
+ const queryInclude: Includeable[] = [
+ actorInclude
+ ]
+
+ const query: FindOptions = {
+ attributes: [ 'id', 'name', 'actorId' ]
+ }
+
+ if (options.withAccountBlockerIds) {
+ queryInclude.push({
+ attributes: [ 'id' ],
+ model: AccountBlocklistModel.unscoped(),
+ as: 'BlockedBy',
+ required: false,
+ where: {
+ accountId: {
+ [Op.in]: options.withAccountBlockerIds
+ }
+ }
+ })
+
+ serverInclude.include = [