fix validaiton for editing user
This commit is contained in:
1 parent
1fa2dbcf85
commit
e76b44fcba
2 files changed
+15
-2
No files matched your search
@@ -1,6 +1,7 @@
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import swaggerUi from "swagger-ui-express";
|
import swaggerUi from "swagger-ui-express";
|
||||||
|
import jwt from "jsonwebtoken";
|
||||||
|
|
||||||
import express from "express";
|
import express from "express";
|
||||||
import helmet from "helmet";
|
import helmet from "helmet";
|
||||||
@@ -56,6 +57,8 @@ import PulseQueueHelper from "./service/PulseQueue/PulseQueueHelper.js";
|
|||||||
import SuperSimpleQueue from "./service/SuperSimpleQueue/SuperSimpleQueue.js";
|
import SuperSimpleQueue from "./service/SuperSimpleQueue/SuperSimpleQueue.js";
|
||||||
import SuperSimpleQueueHelper from "./service/SuperSimpleQueue/SuperSimpleQueueHelper.js";
|
import SuperSimpleQueueHelper from "./service/SuperSimpleQueue/SuperSimpleQueueHelper.js";
|
||||||
|
|
||||||
|
import UserService from "./service/userService.js";
|
||||||
|
|
||||||
//Network service and dependencies
|
//Network service and dependencies
|
||||||
import NetworkService from "./service/networkService.js";
|
import NetworkService from "./service/networkService.js";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
@@ -176,6 +179,14 @@ const startApp = async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const redisService = new RedisService({ Redis: IORedis, logger });
|
const redisService = new RedisService({ Redis: IORedis, logger });
|
||||||
|
const userService = new UserService({
|
||||||
|
db,
|
||||||
|
emailService,
|
||||||
|
settingsService,
|
||||||
|
logger,
|
||||||
|
stringService,
|
||||||
|
jwt,
|
||||||
|
});
|
||||||
|
|
||||||
// const jobQueueHelper = new JobQueueHelper({
|
// const jobQueueHelper = new JobQueueHelper({
|
||||||
// redisService,
|
// redisService,
|
||||||
@@ -235,6 +246,7 @@ const startApp = async () => {
|
|||||||
ServiceRegistry.register(NotificationService.SERVICE_NAME, notificationService);
|
ServiceRegistry.register(NotificationService.SERVICE_NAME, notificationService);
|
||||||
ServiceRegistry.register(TranslationService.SERVICE_NAME, translationService);
|
ServiceRegistry.register(TranslationService.SERVICE_NAME, translationService);
|
||||||
ServiceRegistry.register(RedisService.SERVICE_NAME, redisService);
|
ServiceRegistry.register(RedisService.SERVICE_NAME, redisService);
|
||||||
|
ServiceRegistry.register(UserService.SERVICE_NAME, userService);
|
||||||
|
|
||||||
await translationService.initialize();
|
await translationService.initialize();
|
||||||
|
|
||||||
@@ -255,6 +267,7 @@ const startApp = async () => {
|
|||||||
jobQueue: ServiceRegistry.get(JobQueue.SERVICE_NAME),
|
jobQueue: ServiceRegistry.get(JobQueue.SERVICE_NAME),
|
||||||
stringService: ServiceRegistry.get(StringService.SERVICE_NAME),
|
stringService: ServiceRegistry.get(StringService.SERVICE_NAME),
|
||||||
logger: logger,
|
logger: logger,
|
||||||
|
userService: ServiceRegistry.get(UserService.SERVICE_NAME),
|
||||||
});
|
});
|
||||||
|
|
||||||
const monitorController = new MonitorController(
|
const monitorController = new MonitorController(
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ const registrationBodyValidation = joi.object({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const editUserBodyValidation = joi.object({
|
const editUserBodyValidation = joi.object({
|
||||||
firstName: nameValidation.required(),
|
firstName: nameValidation.optional(),
|
||||||
lastName: nameValidation.required(),
|
lastName: nameValidation.optional(),
|
||||||
profileImage: joi.any(),
|
profileImage: joi.any(),
|
||||||
newPassword: joi.string().min(8).pattern(passwordPattern),
|
newPassword: joi.string().min(8).pattern(passwordPattern),
|
||||||
password: joi.string().min(8).pattern(passwordPattern),
|
password: joi.string().min(8).pattern(passwordPattern),
|
||||||
|
|||||||
Reference in new issue
Block a user