diff --git a/backend/src/infrastructure/filters/exception.filter.ts b/backend/src/infrastructure/filters/exception.filter.ts index af07a0c3..c953b61a 100644 --- a/backend/src/infrastructure/filters/exception.filter.ts +++ b/backend/src/infrastructure/filters/exception.filter.ts @@ -1,11 +1,11 @@ -import { ArgumentsHost, Catch, ExceptionFilter, HttpException, HttpStatus, Inject } from '@nestjs/common'; +import { ArgumentsHost, Catch, HttpException, HttpStatus, Inject } from '@nestjs/common'; +import { BaseExceptionFilter } from '@nestjs/core'; import { Request } from 'express'; import * as fs from 'fs'; import { TYPES } from '../../application/constants'; import { IContextAwareLogger } from '../logger'; import { APIResponseMessage } from './../../application/constants/constants'; import { IExceptionResponse, IRequestException } from './exception-response.interface'; -import { BaseExceptionFilter } from '@nestjs/core'; @Catch() export class ApplicationExceptionsFilter extends BaseExceptionFilter { diff --git a/backend/src/singleclient/dtos/create-singleclient.dto.ts b/backend/src/singleclient/dtos/create-singleclient.dto.ts index b67b897e..ba824938 100644 --- a/backend/src/singleclient/dtos/create-singleclient.dto.ts +++ b/backend/src/singleclient/dtos/create-singleclient.dto.ts @@ -10,4 +10,9 @@ export class CreateSingleClientDTO { @IsNotEmpty() @MaxLength(256) readonly passwordHash: string; + + @IsString() + @IsNotEmpty() + @MaxLength(128) + readonly role: string; } diff --git a/backend/src/singleclient/singleclient.service.ts b/backend/src/singleclient/singleclient.service.ts index 2d3bccc2..23f109b6 100644 --- a/backend/src/singleclient/singleclient.service.ts +++ b/backend/src/singleclient/singleclient.service.ts @@ -48,7 +48,7 @@ export class SingleClientService extends AuthService implements ISingleClientSer const { email } = props; const existingSingleClient: Result = await this.singleclientRepository.findOne({ email }); if (existingSingleClient.isSuccess && existingSingleClient.getValue().email === email) { - throwApplicationError(HttpStatus.BAD_REQUEST, `User with email ${props.email} already exists`); + throwApplicationError(HttpStatus.BAD_REQUEST, `User already exists, please sign in.`); } const audit: Audit = Audit.createInsertContext(context); diff --git a/frontend/src/components/Utilities/Navbar.tsx b/frontend/src/components/Utilities/Navbar.tsx index eb78b905..467fd13c 100644 --- a/frontend/src/components/Utilities/Navbar.tsx +++ b/frontend/src/components/Utilities/Navbar.tsx @@ -4,7 +4,7 @@ import { useState } from "react"; import { Button, Nav, Stack } from "react-bootstrap"; import Container from "react-bootstrap/Container"; import Navbar from "react-bootstrap/Navbar"; -import { NavLink, Outlet, useNavigate } from "react-router-dom"; +import { NavLink, Outlet, useLocation, useNavigate } from "react-router-dom"; import { CONSTANTS } from "../../constants/constant"; import { useShoppingCart } from "../../hooks/UseShoppingCart"; import { calculateQuantity } from "../../utility/utils"; @@ -16,6 +16,7 @@ export const Navigation = () => { const handleCloseModal = () => setShowModal(false); const handleShowModal = () => setShowModal(true); const navigate = useNavigate(); + const location = useLocation(); const displayModal = () => { handleShowModal(); @@ -26,6 +27,16 @@ export const Navigation = () => { resetMenu(); }; + const handleNavMenu = () => { + return location.pathname === "/" ? ( + history + ) : ( + + Back + + ); + }; + return ( <> @@ -33,9 +44,7 @@ export const Navigation = () => {