Formatting.

This commit is contained in:
mike12345567 2021-05-24 14:56:23 +01:00
parent 292d520b30
commit 428a9e5ba3
2 changed files with 14 additions and 6 deletions

View File

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

View File

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