egirlskey/src/server/api/endpoints/users/lists/create.ts
syuilo 52774bbe64
Introduce OpenAPI specs (#4351)
* wip

* wip

* wip

* Update index.ts

* Update gen-openapi-spec.ts

* Update api.ja-JP.md

* Fix

* Improve doc

* Update gen-openapi-spec.ts

* Update redoc.html

* Improve doc

* Update gen-openapi-spec.ts

* Improve doc

* Update CHANGELOG.md
2019-02-23 11:20:58 +09:00

33 lines
600 B
TypeScript

import $ from 'cafy';
import UserList, { pack } from '../../../../../models/user-list';
import define from '../../../define';
export const meta = {
desc: {
'ja-JP': 'ユーザーリストを作成します。',
'en-US': 'Create a user list'
},
tags: ['lists'],
requireCredential: true,
kind: 'account-write',
params: {
title: {
validator: $.str.range(1, 100)
}
}
};
export default define(meta, async (ps, user) => {
const userList = await UserList.insert({
createdAt: new Date(),
userId: user._id,
title: ps.title,
userIds: []
});
return await pack(userList);
});