paricafe/src/server/api/endpoints/admin/invite.ts

30 lines
518 B
TypeScript
Raw Normal View History

2018-08-17 05:17:23 -05:00
import rndstr from 'rndstr';
import RegistrationTicket from '../../../../models/registration-tickets';
2018-11-01 23:47:44 -05:00
import define from '../../define';
2018-08-17 05:17:23 -05:00
export const meta = {
desc: {
2018-08-28 16:59:43 -05:00
'ja-JP': '招待コードを発行します。'
2018-08-17 05:17:23 -05:00
},
tags: ['admin'],
2018-08-17 05:17:23 -05:00
requireCredential: true,
2018-11-14 13:15:42 -06:00
requireModerator: true,
2018-08-17 05:17:23 -05:00
params: {}
};
export default define(meta, async (ps) => {
2018-08-17 05:17:23 -05:00
const code = rndstr({ length: 5, chars: '0-9' });
await RegistrationTicket.insert({
createdAt: new Date(),
code: code
});
return {
2018-08-17 05:17:23 -05:00
code: code
};
});