From 74845d7dc38ba081a54422ccad1b53557bc019cc Mon Sep 17 00:00:00 2001 From: ALBERTO PEDALINO s247382 Date: Wed, 16 Oct 2024 20:26:10 +0200 Subject: [PATCH 1/5] now all counters can handle all services --- server/src/controllers/lineController.ts | 8 +- server/src/dao/lineDao.ts | 33 ++-- .../test_integration/lineIntegration.test.ts | 101 +----------- server/test_unit/lineController.test.ts | 148 ------------------ server/test_unit/lineDao.test.ts | 140 ----------------- 5 files changed, 16 insertions(+), 414 deletions(-) delete mode 100644 server/test_unit/lineController.test.ts delete mode 100644 server/test_unit/lineDao.test.ts diff --git a/server/src/controllers/lineController.ts b/server/src/controllers/lineController.ts index 232b9d8..c3dfd1b 100644 --- a/server/src/controllers/lineController.ts +++ b/server/src/controllers/lineController.ts @@ -9,15 +9,9 @@ class LineController { } async getNextCustomer(req: Request, res: Response): Promise { - const serviceIds: number[] = req.body.service_ids; - if (!serviceIds || !Array.isArray(serviceIds) || serviceIds.length === 0 || !serviceIds.every(id => typeof id === 'number' && id > 0 && Number.isInteger(id))) { - res.status(400).send({ error: 'Invalid service_ids' }); - return; - } - try { - const nextCustomerId = await this.lineDAO.getNextCustomer(serviceIds); + const nextCustomerId = await this.lineDAO.getNextCustomer(); res.status(200).send({ nextCustomerId }); } catch (error) { const status = (error as any).status || 500; diff --git a/server/src/dao/lineDao.ts b/server/src/dao/lineDao.ts index d895d66..fcd084f 100644 --- a/server/src/dao/lineDao.ts +++ b/server/src/dao/lineDao.ts @@ -2,37 +2,24 @@ import db from '../db/db'; class LineDAO { - async validateServiceIds(serviceIds: number[]): Promise { - const serviceExistsQuery = 'SELECT id FROM services'; - const rows = await db.all(serviceExistsQuery); - - const existingServiceIds = rows.map(row => row.id); - const invalidServiceIds = serviceIds.filter(id => !existingServiceIds.includes(id)); - - if (invalidServiceIds.length > 0) { - const error = new Error(`Invalid service IDs: ${invalidServiceIds.join(', ')}`); - (error as any).status = 404; - throw error; - } - } + - async getNextCustomer(service_ids: number[]): Promise<{ serviceType: number, ticketNumber: number }> { + async getNextCustomer(): Promise<{ serviceType: number, ticketNumber: number }> { - const placeholders = service_ids.map(() => '?').join(','); + - const selectQuery = `SELECT id, current_number,queue_length FROM services WHERE id IN (${placeholders}) ORDER BY (queue_length - current_number) DESC, service_time ASC LIMIT 1`; + const selectQuery = `SELECT id, current_number,queue_length FROM services ORDER BY (queue_length - current_number) DESC, service_time ASC LIMIT 1`; const updateQuery = 'UPDATE services SET current_number = current_number + 1 WHERE id = ?'; - // Verifica che gli ID di servizio siano validi - await this.validateServiceIds(service_ids); + - // Esegui la query per ottenere il servizio con il prossimo cliente - const row = await db.get(selectQuery, [...service_ids]); + + const row = await db.get(selectQuery,[]); - // Controlla che sia stato trovato un servizio + if (!row) { throw new Error('No service found for the provided service IDs'); } @@ -45,10 +32,10 @@ class LineDAO { }; } - // Aggiorna il numero corrente del servizio selezionato + await db.run(updateQuery, [row.id]); - // Restituisci il nuovo valore di current_number + 1 + let nextCustomer = row.current_number + 1; return { serviceType: row.id, diff --git a/server/test_integration/lineIntegration.test.ts b/server/test_integration/lineIntegration.test.ts index 86ee596..969e92d 100644 --- a/server/test_integration/lineIntegration.test.ts +++ b/server/test_integration/lineIntegration.test.ts @@ -29,86 +29,13 @@ describe('Line API Integration Tests', () => { const response = await request(server) .post('/api/line/next-customer') - .send({ service_ids: [1,2,3] }); - - expect(response.status).toBe(200); - expect(response.body.nextCustomerId).toStrictEqual({"serviceType": 3, "ticketNumber": 16}); // Based on test data - },10000); - - it('Test 2: should return 400 if service_ids is not provided', async () => { - const response = await request(server) - .post('/api/line/next-customer') - .send({}); - - expect(response.status).toBe(400); - expect(response.body.error).toBe('Invalid service_ids'); - }); - - it('Test 3: should return 400 if service_ids is not an array', async () => { - const response = await request(server) - .post('/api/line/next-customer') - .send({ service_ids: 'not-an-array' }); - - expect(response.status).toBe(400); - expect(response.body.error).toBe('Invalid service_ids'); - }); - - it('Test 4: should return 404 if invalid service IDs are provided', async () => { - const response = await request(server) - .post('/api/line/next-customer') - .send({ service_ids: [5] }); - - expect(response.status).toBe(404); - expect(response.body.message).toBe('Invalid service IDs: 5'); - }); - - - it('Test 6: should handle multiple service IDs correctly', async () => { - - - const response = await request(server) - .post('/api/line/next-customer') - .send({ service_ids: [2, 3, 4] }); + .send(); expect(response.status).toBe(200); expect(response.body.nextCustomerId).toStrictEqual({"serviceType": 4, "ticketNumber": 16}); // Based on test data - }); - - it('Test 7: should return 404 if no row is found for the given service_id', async () => { - const response = await request(server) - .post('/api/line/next-customer') - .send({ service_ids: [5] }); - - expect(response.status).toBe(404); - expect(response.body.message).toBe('Invalid service IDs: 5'); - }); - - it('Test 8: should handle empty service_ids array', async () => { - const response = await request(server) - .post('/api/line/next-customer') - .send({ service_ids: [] }); - - expect(response.status).toBe(400); - expect(response.body.error).toBe('Invalid service_ids'); - }); - - - it('Test 10: should handle invalid JSON in request body', async () => { - const response = await request(server) - .post('/api/line/next-customer') - .set('Content-Type', 'application/json') - .send('invalid-json'); - - expect(response.status).toBe(400); - }); - - it('Test 11: should handle missing Content-Type header', async () => { - const response = await request(server) - .post('/api/line/next-customer') - .send({ service_ids: [1, 2, 3] }); + },10000); - expect(response.status).toBe(200); - }); + it('Test 13: should handle database connection errors', async () => { @@ -117,7 +44,7 @@ describe('Line API Integration Tests', () => { const response = await request(server) .post('/api/line/next-customer') - .send({ service_ids: [1, 2, 3] }); + .send(); expect(response.status).toBe(500); @@ -125,25 +52,7 @@ describe('Line API Integration Tests', () => { await db.open(); }); - it('Test 14: should handle invalid service_ids with special characters', async () => { - const response = await request(server) - .post('/api/line/next-customer') - .send({ service_ids: ['@', '#', '$'] }); - - expect(response.status).toBe(400); - expect(response.body.error).toBe('Invalid service_ids'); - }); - - - it('Test 16: should handle valid service_ids with negative numbers', async () => { - const response = await request(server) - .post('/api/line/next-customer') - .send({ service_ids: [-1, -2, -3] }); - - expect(response.status).toBe(400); - expect(response.body.error).toBe('Invalid service_ids'); - }); - + }); diff --git a/server/test_unit/lineController.test.ts b/server/test_unit/lineController.test.ts deleted file mode 100644 index 61668bb..0000000 --- a/server/test_unit/lineController.test.ts +++ /dev/null @@ -1,148 +0,0 @@ -import { Request, Response } from 'express'; -import LineController from '../src/controllers/lineController'; -import LineDAO from '../src/dao/lineDao'; - -jest.mock('../src/dao/lineDao'); - -describe('LineController', () => { - let lineController: LineController; - let req: Partial; - let res: Partial; - let lineDAOMock: jest.Mocked; - - beforeEach(() => { - lineDAOMock = new LineDAO() as jest.Mocked; - lineController = new LineController(); - req = {}; - res = { - status: jest.fn().mockReturnThis(), - send: jest.fn(), - }; - (LineDAO as jest.Mock).mockImplementation(() => lineDAOMock); - }); - - describe('getNextCustomer', () => { - it('1 - should return 400 for invalid service_ids', async () => { - req.body = { service_ids: 'invalid' }; - - await lineController.getNextCustomer(req as Request, res as Response); - - expect(res.status).toHaveBeenCalledWith(400); - expect(res.send).toHaveBeenCalledWith({ error: 'Invalid service_ids' }); - }); - - it('2 - should return 400 for empty service_ids array', async () => { - req.body = { service_ids: [] }; - - await lineController.getNextCustomer(req as Request, res as Response); - - expect(res.status).toHaveBeenCalledWith(400); - expect(res.send).toHaveBeenCalledWith({ error: 'Invalid service_ids' }); - }); - - it('3 - should return 400 for non-numeric service_ids', async () => { - req.body = { service_ids: [1, 'two', 3] }; - - await lineController.getNextCustomer(req as Request, res as Response); - - expect(res.status).toHaveBeenCalledWith(400); - expect(res.send).toHaveBeenCalledWith({ error: 'Invalid service_ids' }); - }); - - it('4 - should return 200 with next customer ID for valid service_ids', async () => { - req.body = { service_ids: [1, 2] }; - lineDAOMock.getNextCustomer.mockResolvedValue({"serviceType": 1, "ticketNumber": 6}); - - await lineController.getNextCustomer(req as Request, res as Response); - - expect(res.status).toHaveBeenCalledWith(200); - expect(res.send).toHaveBeenCalledWith({ nextCustomerId: {"serviceType": 1, "ticketNumber": 6} }); - }); - - - it('6 - should return specific error message and status from DAO', async () => { - req.body = { service_ids: [1, 2] }; - const error = new Error('Specific error'); - (error as any).status = 404; - lineDAOMock.getNextCustomer.mockRejectedValue(error); - - await lineController.getNextCustomer(req as Request, res as Response); - - expect(res.status).toHaveBeenCalledWith(404); - expect(res.send).toHaveBeenCalledWith({ message: 'Specific error' }); - }); - - - it('8 - should return 400 for service_ids with negative numbers', async () => { - req.body = { service_ids: [1, -2, 3] }; - - await lineController.getNextCustomer(req as Request, res as Response); - - expect(res.status).toHaveBeenCalledWith(400); - expect(res.send).toHaveBeenCalledWith({ error: 'Invalid service_ids' }); - }); - - it('9 - should return 400 for service_ids with zero', async () => { - req.body = { service_ids: [0, 2, 3] }; - - await lineController.getNextCustomer(req as Request, res as Response); - - expect(res.status).toHaveBeenCalledWith(400); - expect(res.send).toHaveBeenCalledWith({ error: 'Invalid service_ids' }); - }); - - it('10 - should return 400 for service_ids with non-integer numbers', async () => { - req.body = { service_ids: [1.5, 2, 3] }; - - await lineController.getNextCustomer(req as Request, res as Response); - - expect(res.status).toHaveBeenCalledWith(400); - expect(res.send).toHaveBeenCalledWith({ error: 'Invalid service_ids' }); - }); - - it('11 - should return 400 for service_ids with non-positive numbers', async () => { - req.body = { service_ids: [1, 2, -3] }; - - await lineController.getNextCustomer(req as Request, res as Response); - - expect(res.status).toHaveBeenCalledWith(400); - expect(res.send).toHaveBeenCalledWith({ error: 'Invalid service_ids' }); - }); - - it('12 - should return 400 for service_ids with non-numeric values', async () => { - req.body = { service_ids: [1, 'two', 3] }; - - await lineController.getNextCustomer(req as Request, res as Response); - - expect(res.status).toHaveBeenCalledWith(400); - expect(res.send).toHaveBeenCalledWith({ error: 'Invalid service_ids' }); - }); - - it('13 - should return 400 for service_ids with null values', async () => { - req.body = { service_ids: [1, null, 3] }; - - await lineController.getNextCustomer(req as Request, res as Response); - - expect(res.status).toHaveBeenCalledWith(400); - expect(res.send).toHaveBeenCalledWith({ error: 'Invalid service_ids' }); - }); - - it('14 - should return 400 for service_ids with undefined values', async () => { - req.body = { service_ids: [1, undefined, 3] }; - - await lineController.getNextCustomer(req as Request, res as Response); - - expect(res.status).toHaveBeenCalledWith(400); - expect(res.send).toHaveBeenCalledWith({ error: 'Invalid service_ids' }); - }); - - it('15 - should return 400 for service_ids with empty strings', async () => { - req.body = { service_ids: [1, '', 3] }; - - await lineController.getNextCustomer(req as Request, res as Response); - - expect(res.status).toHaveBeenCalledWith(400); - expect(res.send).toHaveBeenCalledWith({ error: 'Invalid service_ids' }); - }); - }); -}); \ No newline at end of file diff --git a/server/test_unit/lineDao.test.ts b/server/test_unit/lineDao.test.ts deleted file mode 100644 index 475c20b..0000000 --- a/server/test_unit/lineDao.test.ts +++ /dev/null @@ -1,140 +0,0 @@ -import LineDAO from '../src/dao/lineDao'; -import db from '../src/db/db'; // Adjust the import according to your project structure - -jest.mock('../src/db/db', () => ({ - all: jest.fn(), - get: jest.fn(), - run: jest.fn(), -})); - -describe('LineDAO', () => { - let lineDAO: LineDAO; - - beforeEach(() => { - lineDAO = new LineDAO(); - }); - - describe('validateServiceIds', () => { - it('1 - should not throw an error for valid service IDs', async () => { - (db.all as jest.Mock).mockResolvedValue([{ id: 1 }, { id: 2 }]); - await expect(lineDAO['validateServiceIds']([1, 2])).resolves.not.toThrow(); - }); - - it('2 - should throw an error for invalid service IDs', async () => { - (db.all as jest.Mock).mockResolvedValue([{ id: 1 }]); - await expect(lineDAO['validateServiceIds']([1, 2])).rejects.toThrow('Invalid service IDs: 2'); - }); - - it('6 - should not throw an error for an empty array of service IDs', async () => { - (db.all as jest.Mock).mockResolvedValue([]); - await expect(lineDAO['validateServiceIds']([])).resolves.not.toThrow(); - }); - - it('7 - should throw an error if db.all throws an error', async () => { - (db.all as jest.Mock).mockRejectedValue(new Error('Database error')); - await expect(lineDAO['validateServiceIds']([1, 2])).rejects.toThrow('Database error'); - }); - - it('8 - should handle large arrays of service IDs', async () => { - const serviceIds = Array.from({ length: 1000 }, (_, i) => i + 1); - const dbResponse = serviceIds.map(id => ({ id })); - (db.all as jest.Mock).mockResolvedValue(dbResponse); - await expect(lineDAO['validateServiceIds'](serviceIds)).resolves.not.toThrow(); - }); - }); - - describe('getNextCustomer', () => { - it('3 - should return the next customer for valid service IDs', async () => { - (db.all as jest.Mock).mockResolvedValue([{ id: 1 }, { id: 2 }]); - (db.get as jest.Mock).mockResolvedValue({ id: 1, current_number: 5 }); - (db.run as jest.Mock).mockResolvedValue(undefined); - - const result = await lineDAO.getNextCustomer([1, 2]); - expect(result).toStrictEqual({"serviceType": 1, "ticketNumber": 6}); - }); - - it('4 - should throw an error for invalid service IDs', async () => { - (db.all as jest.Mock).mockResolvedValue([{ id: 1 }]); - await expect(lineDAO.getNextCustomer([1, 2])).rejects.toThrow('Invalid service IDs: 2'); - }); - - it('5 - should throw an error if no service is found', async () => { - (db.all as jest.Mock).mockResolvedValue([{ id: 1 }, { id: 2 }]); - (db.get as jest.Mock).mockResolvedValue(undefined); - - await expect(lineDAO.getNextCustomer([1, 2])).rejects.toThrow('No service found for the provided service IDs'); - }); - - - it('8 - should return the next customer for a single valid service ID', async () => { - (db.all as jest.Mock).mockResolvedValue([{ id: 1 }]); - (db.get as jest.Mock).mockResolvedValue({ id: 1, current_number: 3 }); - (db.run as jest.Mock).mockResolvedValue(undefined); - - const result = await lineDAO.getNextCustomer([1]); - expect(result).toStrictEqual({"serviceType": 1, "ticketNumber": 4}); - }); - - it('9 - should select the correct service based on queue length and service time', async () => { - (db.all as jest.Mock).mockResolvedValue([{ id: 1 }, { id: 2 }]); - (db.get as jest.Mock).mockResolvedValue({ id: 2, current_number: 2 }); - (db.run as jest.Mock).mockResolvedValue(undefined); - - const result = await lineDAO.getNextCustomer([1, 2]); - expect(result).toStrictEqual({"serviceType": 2, "ticketNumber": 3}); - }); - - it('10 - should throw an error if db.get throws an error', async () => { - (db.all as jest.Mock).mockResolvedValue([{ id: 1 }, { id: 2 }]); - (db.get as jest.Mock).mockRejectedValue(new Error('Database error')); - - await expect(lineDAO.getNextCustomer([1, 2])).rejects.toThrow('Database error'); - }); - - it('11 - should throw an error if db.run throws an error', async () => { - (db.all as jest.Mock).mockResolvedValue([{ id: 1 }, { id: 2 }]); - (db.get as jest.Mock).mockResolvedValue({ id: 1, current_number: 5 }); - (db.run as jest.Mock).mockRejectedValue(new Error('Database error')); - - await expect(lineDAO.getNextCustomer([1, 2])).rejects.toThrow('Database error'); - }); - - it('12 - should handle large arrays of service IDs', async () => { - const serviceIds = Array.from({ length: 1000 }, (_, i) => i + 1); - const dbResponse = serviceIds.map(id => ({ id })); - (db.all as jest.Mock).mockResolvedValue(dbResponse); - (db.get as jest.Mock).mockResolvedValue({ id: 1, current_number: 5 }); - (db.run as jest.Mock).mockResolvedValue(undefined); - - const result = await lineDAO.getNextCustomer(serviceIds); - expect(result).toStrictEqual({"serviceType": 1, "ticketNumber": 6}); - }); - - it('13 - should return the next customer for services with the same queue length and service time', async () => { - (db.all as jest.Mock).mockResolvedValue([{ id: 1 }, { id: 2 }]); - (db.get as jest.Mock).mockResolvedValue({ id: 1, current_number: 5 }); - (db.run as jest.Mock).mockResolvedValue(undefined); - - const result = await lineDAO.getNextCustomer([1, 2]); - expect(result).toStrictEqual({"serviceType": 1, "ticketNumber": 6}); - }); - - it('14 - should return the next customer for services with different queue lengths and same service time', async () => { - (db.all as jest.Mock).mockResolvedValue([{ id: 1 }, { id: 2 }]); - (db.get as jest.Mock).mockResolvedValue({ id: 2, current_number: 2 }); - (db.run as jest.Mock).mockResolvedValue(undefined); - - const result = await lineDAO.getNextCustomer([1, 2]); - expect(result).toStrictEqual({"serviceType": 2, "ticketNumber": 3}); - }); - - it('15 - should return the next customer for services with same queue lengths and different service times', async () => { - (db.all as jest.Mock).mockResolvedValue([{ id: 1 }, { id: 2 }]); - (db.get as jest.Mock).mockResolvedValue({ id: 1, current_number: 5 }); - (db.run as jest.Mock).mockResolvedValue(undefined); - - const result = await lineDAO.getNextCustomer([1, 2]); - expect(result).toStrictEqual({"serviceType": 1, "ticketNumber": 6}); - }); - }); -}); \ No newline at end of file From 026d7e2da7763db0c7e7669817505cef9ff94b99 Mon Sep 17 00:00:00 2001 From: Giuseppe Arbore Date: Wed, 16 Oct 2024 21:06:43 +0200 Subject: [PATCH 2/5] fix client part to call the next customer and manage errors --- client/src/API.ts | 4 +- client/src/Components/Counter/OfficeDesk.tsx | 67 ++++++++++++-------- 2 files changed, 43 insertions(+), 28 deletions(-) diff --git a/client/src/API.ts b/client/src/API.ts index 8f5df1f..6da9ba7 100644 --- a/client/src/API.ts +++ b/client/src/API.ts @@ -14,13 +14,13 @@ const getTicket = async (service_id:number) => { return data; } - const getNextCustomer = async (service_ids: number[]) => { + const getNextCustomer = async () => { const response = await fetch(`${SERVER_URL}/api/line/next-customer`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify({ service_ids }) + body: JSON.stringify({ }) }); if (!response.ok) { throw new Error('Network response was not ok'); diff --git a/client/src/Components/Counter/OfficeDesk.tsx b/client/src/Components/Counter/OfficeDesk.tsx index b59ec58..e223d7f 100644 --- a/client/src/Components/Counter/OfficeDesk.tsx +++ b/client/src/Components/Counter/OfficeDesk.tsx @@ -1,15 +1,20 @@ import React, { useEffect, useState, useContext } from 'react'; +import API from '../../api'; // Adjust the import path according to your project structure import { Alert, Button, Container, Row, Spinner } from 'react-bootstrap'; import { useParams } from 'react-router-dom'; function OfficeDesk() { const { number } = useParams<{ number: string }>(); const [ticket_number, setTicketNumber] = useState(undefined); + const [service_type, setServiceType] = useState(undefined); const [showAlert, setShowAlert] = useState(false); const handleShow = () => setShowAlert(true); const handleClose = () => setShowAlert(false); - + useEffect(() => { + // This effect will run every time ticket_number changes + handleShow(); + }, [ticket_number, service_type]); return ( <> @@ -17,36 +22,46 @@ function OfficeDesk() {
{showAlert ? ( - - Next Customer is {ticket_number} -

- When the customer arrives, please click on the button below to proceed. -

+ + {service_type && ticket_number ? ( + <> + Next Customer is {ticket_number} for service S-{service_type} +

+ When the customer arrives, please click on the button below to proceed. +

+ + ) : ( + There is no customer to serve + )}
- ) : ( - <> - {ticket_number &&

Current Customer: {ticket_number}

} -
- -
- - )} - + }}>Next Customer +
+ + )} ); From 098ecd8a16540092c6c37621b6f5b73d726884fc Mon Sep 17 00:00:00 2001 From: Giuseppe Arbore Date: Wed, 16 Oct 2024 21:17:33 +0200 Subject: [PATCH 3/5] fix bug in useEffect, first refresh --- client/src/Components/Counter/OfficeDesk.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/Components/Counter/OfficeDesk.tsx b/client/src/Components/Counter/OfficeDesk.tsx index e223d7f..1d04dd4 100644 --- a/client/src/Components/Counter/OfficeDesk.tsx +++ b/client/src/Components/Counter/OfficeDesk.tsx @@ -12,8 +12,10 @@ function OfficeDesk() { const handleClose = () => setShowAlert(false); useEffect(() => { - // This effect will run every time ticket_number changes + // This effect will run every time ticket_number or service_type changes, but not on the initial render + if (ticket_number !== undefined) { handleShow(); + } }, [ticket_number, service_type]); return ( @@ -22,7 +24,7 @@ function OfficeDesk() {
{showAlert ? ( - + {service_type && ticket_number ? ( <> Next Customer is {ticket_number} for service S-{service_type} From 459c337189015d50d42f931a23d6d2602956d6c6 Mon Sep 17 00:00:00 2001 From: Giuseppe Arbore Date: Wed, 16 Oct 2024 21:25:24 +0200 Subject: [PATCH 4/5] update API import --- client/src/Components/Counter/OfficeDesk.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/src/Components/Counter/OfficeDesk.tsx b/client/src/Components/Counter/OfficeDesk.tsx index 1d04dd4..97e86a2 100644 --- a/client/src/Components/Counter/OfficeDesk.tsx +++ b/client/src/Components/Counter/OfficeDesk.tsx @@ -1,6 +1,6 @@ -import React, { useEffect, useState, useContext } from 'react'; -import API from '../../api'; // Adjust the import path according to your project structure -import { Alert, Button, Container, Row, Spinner } from 'react-bootstrap'; +import React, { useEffect, useState } from 'react'; +import API from '../../API'; // Adjust the import path according to your project structure +import { Alert, Button } from 'react-bootstrap'; import { useParams } from 'react-router-dom'; function OfficeDesk() { From 12598b566cf9d264a5f9574bf08add400a238abd Mon Sep 17 00:00:00 2001 From: Giuseppe Arbore Date: Wed, 16 Oct 2024 21:51:17 +0200 Subject: [PATCH 5/5] format code --- client/src/Components/Counter/OfficeDesk.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/Components/Counter/OfficeDesk.tsx b/client/src/Components/Counter/OfficeDesk.tsx index 97e86a2..c577eb1 100644 --- a/client/src/Components/Counter/OfficeDesk.tsx +++ b/client/src/Components/Counter/OfficeDesk.tsx @@ -48,11 +48,11 @@ function OfficeDesk() { const response = await API.getNextCustomer(); console.log(response); if (response) { - if(response.ticketNumber==0){ + if (response.ticketNumber == 0) { setTicketNumber(undefined); setServiceType(undefined); handleShow(); - }else{ + } else { setTicketNumber(response.ticketNumber); setServiceType(response.serviceType); }