import $ from 'cafy'; import ID, { transform } from '../../../../../misc/cafy-id'; import UserList, { pack } from '../../../../../models/user-list'; import { ILocalUser } from '../../../../../models/user'; import getParams from '../../../get-params'; export const meta = { desc: { 'ja-JP': '指定したユーザーリストの情報を取得します。', 'en-US': 'Show a user list.' }, requireCredential: true, kind: 'account-read', params: { listId: { validator: $.type(ID), transform: transform, }, } }; export default async (params: any, me: ILocalUser) => new Promise(async (res, rej) => { const [ps, psErr] = getParams(meta, params); if (psErr) return rej(psErr); // Fetch the list const userList = await UserList.findOne({ _id: ps.listId, userId: me._id, }); if (userList == null) { return rej('list not found'); } res(await pack(userList)); });