2020-03-17 22:16:34 +00:00
|
|
|
'use strict'
|
|
|
|
const User = use('App/Models/User');
|
2020-04-12 14:25:42 +00:00
|
|
|
const Child = use('App/Models/Child');
|
|
|
|
const Link = use('App/Models/Link');
|
|
|
|
const IceServer = use('App/Models/IceServer');
|
2020-05-13 01:30:11 +00:00
|
|
|
|
|
|
|
const EmailUtils = use('App/Utils/EmailUtils');
|
2020-03-17 22:16:34 +00:00
|
|
|
class AdminApiController {
|
|
|
|
async getUsers({response}) {
|
|
|
|
const users = await User.all();
|
|
|
|
// console.log(typeof users);
|
|
|
|
// return users.rows.map(u => {
|
|
|
|
// return u.publicJSON();
|
|
|
|
// });
|
|
|
|
return users;
|
|
|
|
}
|
2020-04-12 14:25:42 +00:00
|
|
|
async addStunServer({request, response}) {}
|
|
|
|
async addTurnServer({request, response}) {}
|
2020-05-13 01:30:11 +00:00
|
|
|
|
|
|
|
async testEmailSettings({auth, response}) {
|
|
|
|
try {
|
|
|
|
if (EmailUtils.sendTestEmail(auth.user)) {
|
|
|
|
return {
|
|
|
|
code: 0, data: {}
|
|
|
|
}
|
|
|
|
}
|
2020-05-14 01:59:40 +00:00
|
|
|
return {
|
|
|
|
code: 500, message: 'Something went wrong'
|
|
|
|
}
|
2020-05-13 01:30:11 +00:00
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
response.code(500);
|
|
|
|
return {
|
|
|
|
code: 500, message: e.message
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-03-17 22:16:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = AdminApiController
|