1 let XDate = require('xdate')
4 let get_account = await _require('/_lib/get_account.jst')
5 let get_session = await _require('/_lib/get_session.jst')
6 let post_request = await _require('/_lib/post_request.jst')
7 let Problem = await _require('/_lib/Problem.jst')
14 // do not bother trying to coerce and/or validate
15 // too complex and nested (do it when we have an automated routine)
17 let transaction = await env.site.database.Transaction()
19 let account = await get_account(
22 await get_session(env, transaction)
24 if (account === undefined)
25 throw new Problem('Unauthorized', 'Please sign in first.', 401)
27 if (!await account.get_json('administrator'))
28 throw new Problem('Unauthorized', 'Not administrator.', 401)
30 ;(await transaction.get({})).set_json('nodemailer', nodemailer)
31 await transaction.commit()
34 transaction.rollback()