backend/app/controllers/api/v1/Misc.controller.js

26 lines
655 B
JavaScript
Raw Normal View History

2020-02-08 08:39:33 +00:00
const Controller = require('libflitter/controller/Controller')
2020-02-08 11:06:18 +00:00
const { ObjectId } = require("mongodb");
const Page = require("../../../models/api/Page.model")
2020-02-08 08:39:33 +00:00
/*
* Misc Controller
* -------------------------------------------------------------
* Put some description here!
*/
class Misc extends Controller {
2020-03-01 21:37:52 +00:00
#default_token_grants = ['database']
2020-02-08 08:39:33 +00:00
2020-03-01 21:37:52 +00:00
static get services() {
return [...super.services, 'models']
2020-02-08 08:39:33 +00:00
}
2020-03-01 21:37:52 +00:00
async get_token(req, res, next) {
const Token = this.models.get('api:Token')
const token = await Token.for_user(req.user)
return res.api(token.token)
}
2020-02-08 08:39:33 +00:00
}
module.exports = exports = Misc