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