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