Sharkey/src/server/api/endpoints/users/lists/list.ts

22 lines
523 B
TypeScript
Raw Normal View History

2018-04-25 06:34:50 +09:00
import UserList, { pack } from '../../../../../models/user-list';
2018-06-18 09:54:53 +09:00
import { ILocalUser } from '../../../../../models/user';
2018-04-25 06:34:50 +09:00
2018-07-17 04:36:44 +09:00
export const meta = {
desc: {
2018-08-29 06:59:43 +09:00
'ja-JP': '自分の作成したユーザーリスト一覧を取得します。'
2018-07-17 04:36:44 +09:00
},
requireCredential: true,
kind: 'account-read'
};
2018-07-06 02:58:29 +09:00
export default async (params: any, me: ILocalUser) => new Promise(async (res, rej) => {
2018-04-25 06:34:50 +09:00
// Fetch lists
const userLists = await UserList.find({
userId: me._id,
});
res(await Promise.all(userLists.map(x => pack(x))));
});