mizzkey/src/server/api/endpoints/users/lists/show.ts
Acid Chicken (硫酸鶏) bcc549fd8e
Fix style
2019-02-05 11:48:08 +09:00

37 lines
742 B
TypeScript

import $ from 'cafy';
import ID, { transform } from '../../../../../misc/cafy-id';
import UserList, { pack } from '../../../../../models/user-list';
import define from '../../../define';
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 define(meta, (ps, me) => new Promise(async (res, rej) => {
// 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));
}));