* wip * Update ReactionService.ts * Update ApiCallService.ts * Update timeline.ts * Update GlobalModule.ts * Update GlobalModule.ts * Update NoteEntityService.ts * wip * wip * wip * Update ApPersonService.ts * wip * Update GlobalModule.ts * Update mock-resolver.ts * Update RoleService.ts * Update activitypub.ts * Update activitypub.ts * Update activitypub.ts * Update activitypub.ts * Update activitypub.ts * clean up * Update utils.ts * Update UtilityService.ts * Revert "Update utils.ts" This reverts commit a27d4be764b78c1b5a9eac685e261fee49331d89. * Revert "Update UtilityService.ts" This reverts commit e5fd9e004c482cf099252201c0c1aa888e001430. * vuwa- * Revert "vuwa-" This reverts commit 0c3bd12472b4b9938cdff2d6f131e6800bc3724c. * Update entry.ts * Update entry.ts * Update entry.ts * Update entry.ts * Update jest.setup.ts
57 lines
1.5 KiB
TypeScript
57 lines
1.5 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import { IsNull } from 'typeorm';
|
|
import { Inject, Injectable } from '@nestjs/common';
|
|
import type { MiMeta, UsersRepository } from '@/models/_.js';
|
|
import * as Acct from '@/misc/acct.js';
|
|
import type { MiUser } from '@/models/User.js';
|
|
import { Endpoint } from '@/server/api/endpoint-base.js';
|
|
import { UserEntityService } from '@/core/entities/UserEntityService.js';
|
|
import { DI } from '@/di-symbols.js';
|
|
|
|
export const meta = {
|
|
tags: ['users'],
|
|
|
|
requireCredential: false,
|
|
|
|
res: {
|
|
type: 'array',
|
|
optional: false, nullable: false,
|
|
items: {
|
|
type: 'object',
|
|
optional: false, nullable: false,
|
|
ref: 'UserDetailed',
|
|
},
|
|
},
|
|
} as const;
|
|
|
|
export const paramDef = {
|
|
type: 'object',
|
|
properties: {},
|
|
required: [],
|
|
} as const;
|
|
|
|
@Injectable()
|
|
export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-disable-line import/no-default-export
|
|
constructor(
|
|
@Inject(DI.meta)
|
|
private serverSettings: MiMeta,
|
|
|
|
@Inject(DI.usersRepository)
|
|
private usersRepository: UsersRepository,
|
|
|
|
private userEntityService: UserEntityService,
|
|
) {
|
|
super(meta, paramDef, async (ps, me) => {
|
|
const users = await Promise.all(this.serverSettings.pinnedUsers.map(acct => Acct.parse(acct)).map(acct => this.usersRepository.findOneBy({
|
|
usernameLower: acct.username.toLowerCase(),
|
|
host: acct.host ?? IsNull(),
|
|
})));
|
|
|
|
return await this.userEntityService.packMany(users.filter(x => x != null), me, { schema: 'UserDetailed' });
|
|
});
|
|
}
|
|
}
|