parent
5130e0a248
commit
750e36e363
@ -4,6 +4,7 @@ import JwtService from "@services/jwt.service";
|
||||
import {Logger} from "tslog";
|
||||
import type {Request, Response} from "express";
|
||||
import UserService from "@services/user.service";
|
||||
import {IReqEditUserData} from "@interfaces/IReqEditUserData";
|
||||
|
||||
|
||||
const logger = new Logger({ name: "AuthController" });
|
||||
@ -233,7 +234,7 @@ async function getUser(req: Request, res: Response) {
|
||||
|
||||
//TODO - Implement re-auth by current password in case of password change
|
||||
async function editUser(req: Request, res: Response) {
|
||||
const body = req.body;
|
||||
const body: IReqEditUserData | null = req.body;
|
||||
if (!body) {
|
||||
return res
|
||||
.type('application/json')
|
||||
@ -278,12 +279,16 @@ async function editUser(req: Request, res: Response) {
|
||||
}
|
||||
|
||||
//TODO Interface
|
||||
const modifiedData= {}
|
||||
const modifiedData = {
|
||||
}
|
||||
//@ts-ignore
|
||||
if (body.firstName) modifiedData.firstName = `${body.firstName}`;
|
||||
//@ts-ignore
|
||||
if (body.lastName) modifiedData.lastName = `${body.lastName}`;
|
||||
//@ts-ignore
|
||||
if (body.displayName) modifiedData.displayName = `${body.displayName}`;
|
||||
// Case handled with hashing by the service.
|
||||
if (body.password) modifiedData.password = `${body.password}`;
|
||||
//TODO Case handled with hashing by the service.
|
||||
//if (body.password) modifiedData.password = `${body.password}`;
|
||||
|
||||
//Call service
|
||||
const EditUserServiceResult = await UserService.edit(`${targetUserId}`, modifiedData);
|
||||
|
Loading…
x
Reference in New Issue
Block a user