yumechi-no-kuni/src/server/api/endpoints/users/lists/list.ts

30 lines
548 B
TypeScript
Raw Normal View History

2018-04-24 16:34:50 -05:00
import UserList, { pack } from '../../../../../models/user-list';
2018-11-01 23:47:44 -05:00
import define from '../../../define';
2018-04-24 16:34:50 -05:00
2018-07-16 14:36:44 -05:00
export const meta = {
desc: {
2018-08-28 16:59:43 -05:00
'ja-JP': '自分の作成したユーザーリスト一覧を取得します。'
2018-07-16 14:36:44 -05:00
},
tags: ['lists', 'account'],
2018-07-16 14:36:44 -05:00
requireCredential: true,
2019-02-24 12:35:45 -06:00
kind: 'account-read',
res: {
type: 'array',
items: {
type: 'UserList',
},
},
2018-07-16 14:36:44 -05:00
};
export default define(meta, async (ps, me) => {
2018-04-24 16:34:50 -05:00
const userLists = await UserList.find({
userId: me._id,
});
return await Promise.all(userLists.map(x => pack(x)));
});