Formatting.

This commit is contained in:
mike12345567 2021-05-24 14:56:23 +01:00
parent 0a4c4f1cc0
commit 4b786f51d2
2 changed files with 14 additions and 6 deletions

View File

@ -21,7 +21,7 @@ function retryConnection() {
*/
function init() {
function errorOccurred(err) {
CONNECTED = false;
CONNECTED = false
console.error("Redis connection failed - " + err)
setTimeout(() => {
init()

View File

@ -7,10 +7,14 @@ const Joi = require("joi")
const router = Router()
function buildAdminInitValidation() {
return joiValidator.body(Joi.object({
email: Joi.string().required(),
password: Joi.string().required(),
}).required().unknown(false))
return joiValidator.body(
Joi.object({
email: Joi.string().required(),
password: Joi.string().required(),
})
.required()
.unknown(false)
)
}
function buildUserSaveValidation(isSelf = false) {
@ -81,7 +85,11 @@ router
buildInviteAcceptValidation(),
controller.inviteAccept
)
.post("/api/admin/users/init", buildAdminInitValidation(), controller.adminUser)
.post(
"/api/admin/users/init",
buildAdminInitValidation(),
controller.adminUser
)
.get("/api/admin/users/self", controller.getSelf)
// admin endpoint but needs to come at end (blocks other endpoints otherwise)
.get("/api/admin/users/:id", adminOnly, controller.find)