mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-11 16:23:08 +02:00
27 lines
520 B
TypeScript
27 lines
520 B
TypeScript
import rndstr from 'rndstr';
|
|
import RegistrationTicket from '../../../../models/registration-tickets';
|
|
import define from '../../define';
|
|
|
|
export const meta = {
|
|
desc: {
|
|
'ja-JP': '招待コードを発行します。'
|
|
},
|
|
|
|
requireCredential: true,
|
|
requireAdmin: true,
|
|
|
|
params: {}
|
|
};
|
|
|
|
export default define(meta, (ps) => new Promise(async (res, rej) => {
|
|
const code = rndstr({ length: 5, chars: '0-9' });
|
|
|
|
await RegistrationTicket.insert({
|
|
createdAt: new Date(),
|
|
code: code
|
|
});
|
|
|
|
res({
|
|
code: code
|
|
});
|
|
}));
|