2020-10-13 18:40:28 +02:00
|
|
|
/**
|
|
|
|
* This controller is not currently fully implemented. Screens are
|
|
|
|
* currently managed as part of the pages API, please look in api/routes/page.js
|
|
|
|
* for routes and controllers.
|
|
|
|
*/
|
2020-11-01 16:32:54 +01:00
|
|
|
const CouchDB = require("../../db")
|
2020-10-13 18:40:28 +02:00
|
|
|
|
|
|
|
exports.fetch = async ctx => {
|
|
|
|
ctx.throw(501)
|
|
|
|
}
|
|
|
|
|
2020-11-01 16:32:54 +01:00
|
|
|
exports.create = async ctx => {
|
|
|
|
const db = new CouchDB(ctx.user.appId)
|
|
|
|
const screen = {
|
|
|
|
// name: ctx.request.body.name,
|
|
|
|
// _rev: ctx.request.body._rev,
|
|
|
|
// permissions: ctx.request.body.permissions || [],
|
|
|
|
// _id: generateAccessLevelID(),
|
|
|
|
// type: "accesslevel",
|
|
|
|
}
|
|
|
|
|
|
|
|
const response = await db.put(screen)
|
|
|
|
ctx.body = {
|
|
|
|
...screen,
|
|
|
|
...response,
|
|
|
|
}
|
|
|
|
ctx.message = `Screen '${screen.name}' created successfully.`
|
|
|
|
}
|
|
|
|
|
2020-10-13 18:40:28 +02:00
|
|
|
exports.save = async ctx => {
|
|
|
|
ctx.throw(501)
|
|
|
|
}
|
|
|
|
|
|
|
|
exports.destroy = async ctx => {
|
|
|
|
ctx.throw(501)
|
|
|
|
}
|