jormungandr-bite/src/server/api/endpoints/admin/invite.ts

27 lines
480 B
TypeScript
Raw Normal View History

2018-08-17 04:17:23 -06:00
import rndstr from 'rndstr';
import RegistrationTicket from '../../../../models/registration-tickets';
export const meta = {
desc: {
2018-08-28 15:59:43 -06:00
'ja-JP': '招待コードを発行します。'
2018-08-17 04:17:23 -06:00
},
requireCredential: true,
requireAdmin: true,
params: {}
};
export default (params: any) => new Promise(async (res, rej) => {
const code = rndstr({ length: 5, chars: '0-9' });
await RegistrationTicket.insert({
createdAt: new Date(),
code: code
});
res({
code: code
});
});