misskey/src/server/api/endpoints/admin/invite.ts
syuilo 2756f553c6
Improve error handling of API (#4345)
* wip

* wip

* wip

* Update attached_notes.ts

* wip

* Refactor

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Update call.ts

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* ✌️

* Fix
2019-02-22 11:46:58 +09:00

28 lines
499 B
TypeScript

import rndstr from 'rndstr';
import RegistrationTicket from '../../../../models/registration-tickets';
import define from '../../define';
export const meta = {
desc: {
'ja-JP': '招待コードを発行します。'
},
requireCredential: true,
requireModerator: true,
params: {}
};
export default define(meta, async (ps) => {
const code = rndstr({ length: 5, chars: '0-9' });
await RegistrationTicket.insert({
createdAt: new Date(),
code: code
});
return {
code: code
};
});