mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
Compare commits
No commits in common. "c13e73208e3f69408a69ff45936e9d3c3ba13958" and "8f6cf8cffa3236522288ce94a82cd11de107221d" have entirely different histories.
c13e73208e
...
8f6cf8cffa
20 changed files with 354 additions and 1025 deletions
63
client/package-lock.json
generated
63
client/package-lock.json
generated
|
|
@ -43,9 +43,9 @@
|
|||
"@babel/preset-typescript": "^7.23.3",
|
||||
"@eslint/js": "^9.21.0",
|
||||
"@testing-library/dom": "^10.4.0",
|
||||
"@testing-library/user-event": "^14.6.1",
|
||||
"@testing-library/jest-dom": "^6.6.3",
|
||||
"@testing-library/react": "^16.2.0",
|
||||
"@testing-library/user-event": "^14.6.1",
|
||||
"@types/jest": "^29.5.13",
|
||||
"@types/node": "^22.13.5",
|
||||
"@types/react": "^18.2.15",
|
||||
|
|
@ -420,24 +420,26 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@babel/helpers": {
|
||||
"version": "7.27.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.27.0.tgz",
|
||||
"integrity": "sha512-U5eyP/CTFPuNE3qk+WZMxFkp/4zUzdceQlfzf7DdGdhp+Fezd7HD+i8Y24ZuTMKX3wQBld449jijbGq6OdGNQg==",
|
||||
"version": "7.26.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.9.tgz",
|
||||
"integrity": "sha512-Mz/4+y8udxBKdmzt/UjPACs4G3j5SshJJEFFKxlCGPydG4JAHXxjWjAwjd09tf6oINvl1VfMJo+nB7H2YKQ0dA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/template": "^7.27.0",
|
||||
"@babel/types": "^7.27.0"
|
||||
"@babel/template": "^7.26.9",
|
||||
"@babel/types": "^7.26.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/parser": {
|
||||
"version": "7.27.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.27.0.tgz",
|
||||
"integrity": "sha512-iaepho73/2Pz7w2eMS0Q5f83+0RKI7i4xmiYeBmDzfRVbQtTOG7Ts0S4HzJVsTMGI9keU8rNfuZr8DKfSt7Yyg==",
|
||||
"version": "7.26.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.9.tgz",
|
||||
"integrity": "sha512-81NWa1njQblgZbQHxWHpxxCzNsa3ZwvFqpUg7P+NNUU6f3UU2jBEg4OlF/J6rl8+PQGh1q6/zWScd001YwcA5A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.27.0"
|
||||
"@babel/types": "^7.26.9"
|
||||
},
|
||||
"bin": {
|
||||
"parser": "bin/babel-parser.js"
|
||||
|
|
@ -1892,9 +1894,10 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@babel/runtime": {
|
||||
"version": "7.27.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.27.0.tgz",
|
||||
"integrity": "sha512-VtPOkrdPHZsKc/clNqyi9WUA8TINkZ4cGk63UUE3u4pmB2k+ZMQRDuIOagv8UVd6j7k0T3+RRIb7beKTebNbcw==",
|
||||
"version": "7.26.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.9.tgz",
|
||||
"integrity": "sha512-aA63XwOkcl4xxQa3HjPMqOP6LiK0ZDv3mUPYEFXkpHbaFjtGggE1A61FjFzJnB+p7/oy2gA8E+rcBNl/zC1tMg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"regenerator-runtime": "^0.14.0"
|
||||
},
|
||||
|
|
@ -1903,13 +1906,14 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@babel/template": {
|
||||
"version": "7.27.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.0.tgz",
|
||||
"integrity": "sha512-2ncevenBqXI6qRMukPlXwHKHchC7RyMuu4xv5JBXRfOGVcTy1mXCD12qrp7Jsoxll1EV3+9sE4GugBVRjT2jFA==",
|
||||
"version": "7.26.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.26.9.tgz",
|
||||
"integrity": "sha512-qyRplbeIpNZhmzOysF/wFMuP9sctmh2cFzRAZOn1YapxBsE1i9bJIY586R/WBLfLcmcBlM8ROBiQURnnNy+zfA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.26.2",
|
||||
"@babel/parser": "^7.27.0",
|
||||
"@babel/types": "^7.27.0"
|
||||
"@babel/parser": "^7.26.9",
|
||||
"@babel/types": "^7.26.9"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
|
|
@ -1943,9 +1947,10 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@babel/types": {
|
||||
"version": "7.27.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.27.0.tgz",
|
||||
"integrity": "sha512-H45s8fVLYjbhFH62dIJ3WtmJ6RSPt/3DRO0ZcT2SUiYiQyz3BLVb9ADEnLl91m74aQPS3AzzeajZHYOalWe3bg==",
|
||||
"version": "7.26.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.9.tgz",
|
||||
"integrity": "sha512-Y3IR1cRnOxOCDvMmNiym7XpXQ93iGDDPHx+Zj+NM+rg0fBaShfQLkg+hKPaZCEvg5N/LeCo4+Rj/i3FuJsIQaw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-string-parser": "^7.25.9",
|
||||
"@babel/helper-validator-identifier": "^7.25.9"
|
||||
|
|
@ -4367,6 +4372,7 @@
|
|||
"resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.6.3.tgz",
|
||||
"integrity": "sha512-IteBhl4XqYNkM54f4ejhLRJiZNqcSCoXUOG2CPK7qbD322KjQozM4kHQOfkG2oln9b9HTYqs+Sae8vBATubxxA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@adobe/css-tools": "^4.4.0",
|
||||
"aria-query": "^5.0.0",
|
||||
|
|
@ -4436,6 +4442,7 @@
|
|||
"resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-14.6.1.tgz",
|
||||
"integrity": "sha512-vq7fv0rnt+QTXgPxr5Hjc210p6YKq2kmdziLgnsZGgLJ9e6VAShx1pACLuRjd/AS/sr7phAR58OIIpf0LlmQNw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12",
|
||||
"npm": ">=6"
|
||||
|
|
@ -5344,9 +5351,10 @@
|
|||
}
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "1.8.4",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.8.4.tgz",
|
||||
"integrity": "sha512-eBSYY4Y68NNlHbHBMdeDmKNtDgXWhQsJcGqzO3iLUM0GraQFSS9cVgPX5I9b3lbdFKyYoAEGAZF1DwhTaljNAw==",
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.8.1.tgz",
|
||||
"integrity": "sha512-NN+fvwH/kV01dYUQ3PTOZns4LWtWhOFCAhQ/pHb88WQ1hNe5V/dvFwc4VJcDL11LT9xSX0QtsR8sWUuyOuOq7g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.6",
|
||||
"form-data": "^4.0.0",
|
||||
|
|
@ -12918,9 +12926,10 @@
|
|||
}
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "6.2.5",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-6.2.5.tgz",
|
||||
"integrity": "sha512-j023J/hCAa4pRIUH6J9HemwYfjB5llR2Ps0CWeikOtdR8+pAURAk0DoJC5/mm9kd+UgdnIy7d6HE4EAvlYhPhA==",
|
||||
"version": "6.2.0",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-6.2.0.tgz",
|
||||
"integrity": "sha512-7dPxoo+WsT/64rDcwoOjk76XHj+TqNTIvHKcuMQ1k4/SeHDaQt5GFAeLYzrimZrMpn/O6DtdI03WUjdxuPM0oQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"esbuild": "^0.25.0",
|
||||
"postcss": "^8.5.3",
|
||||
|
|
|
|||
|
|
@ -47,9 +47,9 @@
|
|||
"@babel/preset-typescript": "^7.23.3",
|
||||
"@eslint/js": "^9.21.0",
|
||||
"@testing-library/dom": "^10.4.0",
|
||||
"@testing-library/user-event": "^14.6.1",
|
||||
"@testing-library/jest-dom": "^6.6.3",
|
||||
"@testing-library/react": "^16.2.0",
|
||||
"@testing-library/user-event": "^14.6.1",
|
||||
"@types/jest": "^29.5.13",
|
||||
"@types/node": "^22.13.5",
|
||||
"@types/react": "^18.2.15",
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ describe("ImageGallery", () => {
|
|||
|
||||
it("should render images correctly", async () => {
|
||||
await act(async () => {
|
||||
await screen.findByText("Galerie");
|
||||
await screen.findByText("Gallery");
|
||||
});
|
||||
|
||||
expect(screen.getByAltText("Image image1.jpg")).toBeInTheDocument();
|
||||
|
|
|
|||
|
|
@ -1,81 +0,0 @@
|
|||
import React from 'react';
|
||||
import { render, screen, fireEvent, act } from '@testing-library/react';
|
||||
import ShareQuizModal from '../../../components/ShareQuizModal/ShareQuizModal.tsx';
|
||||
import { QuizType } from '../../../Types/QuizType';
|
||||
import '@testing-library/jest-dom';
|
||||
|
||||
describe('ShareQuizModal', () => {
|
||||
const mockQuiz: QuizType = {
|
||||
_id: '123',
|
||||
folderId: 'folder-123',
|
||||
folderName: 'Test Folder',
|
||||
userId: 'user-123',
|
||||
title: 'Test Quiz',
|
||||
content: ['Question 1', 'Question 2'],
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
};
|
||||
|
||||
beforeAll(() => {
|
||||
// Properly mock the clipboard API
|
||||
Object.defineProperty(navigator, 'clipboard', {
|
||||
value: {
|
||||
writeText: jest.fn().mockImplementation(() => Promise.resolve()),
|
||||
},
|
||||
writable: true,
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
it('renders the share button', () => {
|
||||
render(<ShareQuizModal quiz={mockQuiz} />);
|
||||
expect(screen.getByLabelText('partager quiz')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('ShareIcon')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('copies the quiz URL to clipboard when share button is clicked', async () => {
|
||||
render(<ShareQuizModal quiz={mockQuiz} />);
|
||||
const shareButton = screen.getByLabelText('partager quiz');
|
||||
|
||||
await act(async () => {
|
||||
fireEvent.click(shareButton);
|
||||
});
|
||||
|
||||
expect(navigator.clipboard.writeText).toHaveBeenCalledWith(
|
||||
`${window.location.origin}/teacher/share/${mockQuiz._id}`
|
||||
);
|
||||
|
||||
// Check for feedback dialog content
|
||||
expect(screen.getByText(/L'URL de partage pour le quiz/i)).toBeInTheDocument();
|
||||
expect(screen.getByText(mockQuiz.title)).toBeInTheDocument();
|
||||
expect(screen.getByText(/a été copiée\./i)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows error message when clipboard write fails', async () => {
|
||||
// Override the mock to reject
|
||||
(navigator.clipboard.writeText as jest.Mock).mockRejectedValueOnce(new Error('Clipboard write failed'));
|
||||
|
||||
render(<ShareQuizModal quiz={mockQuiz} />);
|
||||
const shareButton = screen.getByLabelText('partager quiz');
|
||||
|
||||
await act(async () => {
|
||||
fireEvent.click(shareButton);
|
||||
});
|
||||
|
||||
expect(screen.getByText(/Une erreur est survenue lors de la copie de l'URL\./i)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('displays the quiz title in the success message', async () => {
|
||||
render(<ShareQuizModal quiz={mockQuiz} />);
|
||||
const shareButton = screen.getByLabelText('partager quiz');
|
||||
|
||||
await act(async () => {
|
||||
fireEvent.click(shareButton);
|
||||
});
|
||||
|
||||
expect(screen.getByText(mockQuiz.title)).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
|
@ -294,36 +294,5 @@ describe('ManageRoom', () => {
|
|||
expect(screen.queryByText('Student 1')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
test('terminates the quiz and navigates to teacher dashboard when the "Terminer le quiz" button is clicked', async () => {
|
||||
await act(async () => {
|
||||
render(
|
||||
<MemoryRouter>
|
||||
<ManageRoom />
|
||||
</MemoryRouter>
|
||||
);
|
||||
});
|
||||
|
||||
await act(async () => {
|
||||
const createSuccessCallback = (mockSocket.on as jest.Mock).mock.calls.find(call => call[0] === 'create-success')[1];
|
||||
createSuccessCallback('Test Room');
|
||||
});
|
||||
|
||||
fireEvent.click(screen.getByText('Lancer'));
|
||||
fireEvent.click(screen.getByText('Rythme du professeur'));
|
||||
fireEvent.click(screen.getAllByText('Lancer')[1]);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Test Quiz')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
const finishQuizButton = screen.getByText('Terminer le quiz');
|
||||
fireEvent.click(finishQuizButton);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(navigate).toHaveBeenCalledWith('/teacher/dashboard');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,95 +0,0 @@
|
|||
import React from 'react';
|
||||
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
|
||||
import { MemoryRouter, Route, Routes, useParams } from 'react-router-dom';
|
||||
import Share from '../../../../pages/Teacher/Share/Share.tsx';
|
||||
import ApiService from '../../../../services/ApiService';
|
||||
import '@testing-library/jest-dom';
|
||||
|
||||
// Mock the ApiService and react-router-dom
|
||||
jest.mock('../../../../services/ApiService');
|
||||
jest.mock('react-router-dom', () => ({
|
||||
...jest.requireActual('react-router-dom'),
|
||||
useParams: jest.fn(),
|
||||
useNavigate: jest.fn(),
|
||||
}));
|
||||
|
||||
describe('Share Component', () => {
|
||||
const mockNavigate = jest.fn();
|
||||
const mockUseParams = useParams as jest.Mock;
|
||||
const mockApiService = ApiService as jest.Mocked<typeof ApiService>;
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
mockUseParams.mockReturnValue({ id: 'quiz123' });
|
||||
require('react-router-dom').useNavigate.mockReturnValue(mockNavigate);
|
||||
});
|
||||
|
||||
const renderComponent = (initialEntries = ['/share/quiz123']) => {
|
||||
return render(
|
||||
<MemoryRouter initialEntries={initialEntries}>
|
||||
<Routes>
|
||||
<Route path="/share/:id" element={<Share />} />
|
||||
<Route path="/teacher/dashboard" element={<div>Dashboard</div>} />
|
||||
<Route path="/login" element={<div>Login</div>} />
|
||||
</Routes>
|
||||
</MemoryRouter>
|
||||
);
|
||||
};
|
||||
|
||||
it('should show loading state initially', () => {
|
||||
mockApiService.getAllQuizIds.mockResolvedValue([]);
|
||||
mockApiService.getUserFolders.mockResolvedValue([]);
|
||||
mockApiService.getSharedQuiz.mockResolvedValue('Test Quiz');
|
||||
|
||||
renderComponent();
|
||||
expect(screen.getByText('Chargement...')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should redirect to login if not authenticated', async () => {
|
||||
mockApiService.isLoggedIn.mockReturnValue(false);
|
||||
|
||||
renderComponent();
|
||||
|
||||
await waitFor(() => {
|
||||
expect(mockNavigate).toHaveBeenCalledWith('/login');
|
||||
});
|
||||
});
|
||||
|
||||
it('should show "quiz already exists" message when quiz exists', async () => {
|
||||
mockApiService.isLoggedIn.mockReturnValue(true);
|
||||
mockApiService.getAllQuizIds.mockResolvedValue(['quiz123']);
|
||||
|
||||
renderComponent();
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Quiz déjà existant')).toBeInTheDocument();
|
||||
expect(screen.getByText(/Le quiz que vous essayez d'importer existe déjà sur votre compte/i)).toBeInTheDocument();
|
||||
expect(screen.getByText('Retour au tableau de bord')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
it('should navigate to dashboard when clicking return button in "quiz exists" view', async () => {
|
||||
mockApiService.isLoggedIn.mockReturnValue(true);
|
||||
mockApiService.getAllQuizIds.mockResolvedValue(['quiz123']);
|
||||
|
||||
renderComponent();
|
||||
|
||||
await waitFor(() => {
|
||||
fireEvent.click(screen.getByText('Retour au tableau de bord'));
|
||||
expect(mockNavigate).toHaveBeenCalledWith('/teacher/dashboard');
|
||||
});
|
||||
});
|
||||
|
||||
it('should show error when no folders exist', async () => {
|
||||
mockApiService.isLoggedIn.mockReturnValue(true);
|
||||
mockApiService.getAllQuizIds.mockResolvedValue([]);
|
||||
mockApiService.getUserFolders.mockResolvedValue([]);
|
||||
|
||||
renderComponent();
|
||||
|
||||
await waitFor(() => {
|
||||
expect(mockNavigate).toHaveBeenCalledWith('/teacher/dashboard');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
import axios from 'axios';
|
||||
import ApiService from '../../services/ApiService';
|
||||
import { ENV_VARIABLES } from '../../constants';
|
||||
|
||||
jest.mock('axios');
|
||||
const mockedAxios = axios as jest.Mocked<typeof axios>;
|
||||
|
||||
describe('getSharedQuiz', () => {
|
||||
it('should call the API to get a shared quiz and return the quiz data on success', async () => {
|
||||
const quizId = '123';
|
||||
const quizData = 'Quiz data';
|
||||
const response = { status: 200, data: { data: quizData } };
|
||||
mockedAxios.get.mockResolvedValue(response);
|
||||
|
||||
const result = await ApiService.getSharedQuiz(quizId);
|
||||
|
||||
expect(mockedAxios.get).toHaveBeenCalledWith(
|
||||
`${ENV_VARIABLES.VITE_BACKEND_URL}/api/quiz/getShare/${quizId}`,
|
||||
{ headers: expect.any(Object) }
|
||||
);
|
||||
expect(result).toBe(quizData);
|
||||
});
|
||||
|
||||
it('should return an error message if the API call fails', async () => {
|
||||
const quizId = '123';
|
||||
const errorMessage = 'An unexpected error occurred.';
|
||||
mockedAxios.get.mockRejectedValue({ response: { data: { error: errorMessage } } });
|
||||
|
||||
const result = await ApiService.getSharedQuiz(quizId);
|
||||
|
||||
expect(result).toBe(errorMessage);
|
||||
});
|
||||
|
||||
it('should return a generic error message if an unexpected error occurs', async () => {
|
||||
const quizId = '123';
|
||||
mockedAxios.get.mockRejectedValue(new Error('Unexpected error'));
|
||||
|
||||
const result = await ApiService.getSharedQuiz(quizId);
|
||||
|
||||
expect(result).toBe('An unexpected error occurred.');
|
||||
});
|
||||
});
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
import axios from 'axios';
|
||||
import ApiService from '../../services/ApiService';
|
||||
import { FolderType } from '../../Types/FolderType';
|
||||
import { QuizType } from '../../Types/QuizType';
|
||||
|
||||
jest.mock('axios');
|
||||
const mockedAxios = axios as jest.Mocked<typeof axios>;
|
||||
|
||||
describe('ApiService', () => {
|
||||
describe('getAllQuizIds', () => {
|
||||
it('should return all quiz IDs from all folders', async () => {
|
||||
const folders: FolderType[] = [
|
||||
{ _id: 'folder1', title: 'Folder 1', userId: 'user1', created_at: new Date().toISOString() },
|
||||
{ _id: 'folder2', title: 'Folder 2', userId: 'user2', created_at: new Date().toISOString() }
|
||||
];
|
||||
const quizzesFolder1: QuizType[] = [
|
||||
{ _id: 'quiz1', title: 'Quiz 1', content: [], folderId: 'folder1', folderName: 'Folder 1', userId: 'user1', created_at: new Date(), updated_at: new Date() },
|
||||
{ _id: 'quiz2', title: 'Quiz 2', content: [], folderId: 'folder1', folderName: 'Folder 1', userId: 'user1', created_at: new Date(), updated_at: new Date() }
|
||||
];
|
||||
const quizzesFolder2: QuizType[] = [
|
||||
{ _id: 'quiz3', title: 'Quiz 3', content: [], folderId: 'folder2', folderName: 'Folder 2', userId: 'user2', created_at: new Date(), updated_at: new Date() }
|
||||
];
|
||||
|
||||
mockedAxios.get
|
||||
.mockResolvedValueOnce({ status: 200, data: { data: folders } })
|
||||
.mockResolvedValueOnce({ status: 200, data: { data: quizzesFolder1 } })
|
||||
.mockResolvedValueOnce({ status: 200, data: { data: quizzesFolder2 } });
|
||||
|
||||
const result = await ApiService.getAllQuizIds();
|
||||
|
||||
expect(result).toEqual(['quiz1', 'quiz2', 'quiz3']);
|
||||
});
|
||||
|
||||
it('should return an empty array if no folders are found', async () => {
|
||||
mockedAxios.get.mockResolvedValueOnce({ status: 200, data: { data: [] } });
|
||||
|
||||
const result = await ApiService.getAllQuizIds();
|
||||
|
||||
expect(result).toEqual([]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -147,7 +147,7 @@ const ImageGallery: React.FC<ImagesProps> = ({ handleCopy, handleDelete }) => {
|
|||
return (
|
||||
<Box p={3}>
|
||||
<Tabs value={tabValue} onChange={(_, newValue) => setTabValue(newValue)}>
|
||||
<Tab label="Galerie" />
|
||||
<Tab label="Gallery" />
|
||||
<Tab label="Import" />
|
||||
</Tabs>
|
||||
{tabValue === 0 && (
|
||||
|
|
|
|||
|
|
@ -1,94 +0,0 @@
|
|||
import React, { useState } from 'react';
|
||||
import { Dialog, DialogTitle, DialogActions, Button, Tooltip, IconButton, Typography, Box } from '@mui/material';
|
||||
import { Share } from '@mui/icons-material';
|
||||
import { QuizType } from '../../Types/QuizType';
|
||||
|
||||
interface ShareQuizModalProps {
|
||||
quiz: QuizType;
|
||||
}
|
||||
|
||||
const ShareQuizModal: React.FC<ShareQuizModalProps> = ({ quiz }) => {
|
||||
const [_open, setOpen] = useState(false);
|
||||
const [feedback, setFeedback] = useState({
|
||||
open: false,
|
||||
title: '',
|
||||
isError: false
|
||||
});
|
||||
|
||||
const handleCloseModal = () => setOpen(false);
|
||||
|
||||
const handleShareByUrl = () => {
|
||||
const quizUrl = `${window.location.origin}/teacher/share/${quiz._id}`;
|
||||
navigator.clipboard.writeText(quizUrl)
|
||||
.then(() => {
|
||||
setFeedback({
|
||||
open: true,
|
||||
title: 'L\'URL de partage pour le quiz',
|
||||
isError: false
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
setFeedback({
|
||||
open: true,
|
||||
title: 'Une erreur est survenue lors de la copie de l\'URL.',
|
||||
isError: true
|
||||
});
|
||||
});
|
||||
|
||||
handleCloseModal();
|
||||
};
|
||||
|
||||
const closeFeedback = () => {
|
||||
setFeedback(prev => ({ ...prev, open: false }));
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Tooltip title="Partager" placement="top">
|
||||
<IconButton color="primary" onClick={handleShareByUrl} aria-label="partager quiz">
|
||||
<Share />
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
|
||||
{/* Feedback Dialog */}
|
||||
<Dialog
|
||||
open={feedback.open}
|
||||
onClose={closeFeedback}
|
||||
fullWidth
|
||||
maxWidth="xs"
|
||||
>
|
||||
<DialogTitle sx={{ textAlign: "center" }}>
|
||||
<Box>
|
||||
{feedback.isError ? (
|
||||
<Typography color="error.main">
|
||||
{feedback.title}
|
||||
</Typography>
|
||||
) : (
|
||||
<>
|
||||
<Typography component="span">
|
||||
L'URL de partage pour le quiz{' '}
|
||||
</Typography>
|
||||
<Typography component="span" fontWeight="bold">
|
||||
{quiz.title}
|
||||
</Typography>
|
||||
<Typography component="span">
|
||||
{' '}a été copiée.
|
||||
</Typography>
|
||||
</>
|
||||
)}
|
||||
</Box>
|
||||
</DialogTitle>
|
||||
<DialogActions sx={{ display: "flex", justifyContent: "center" }}>
|
||||
<Button
|
||||
onClick={closeFeedback}
|
||||
variant="contained"
|
||||
>
|
||||
OK
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default ShareQuizModal;
|
||||
|
|
@ -39,8 +39,9 @@ import {
|
|||
FolderCopy,
|
||||
ContentCopy,
|
||||
Edit,
|
||||
Share
|
||||
// DriveFileMove
|
||||
} from '@mui/icons-material';
|
||||
import ShareQuizModal from 'src/components/ShareQuizModal/ShareQuizModal';
|
||||
|
||||
// Create a custom-styled Card component
|
||||
const CustomCard = styled(Card)({
|
||||
|
|
@ -400,6 +401,28 @@ const Dashboard: React.FC = () => {
|
|||
}
|
||||
};
|
||||
|
||||
const handleShareQuiz = async (quiz: QuizType) => {
|
||||
try {
|
||||
const email = prompt(
|
||||
`Veuillez saisir l'email de la personne avec qui vous souhaitez partager ce quiz`,
|
||||
''
|
||||
);
|
||||
|
||||
if (email) {
|
||||
const result = await ApiService.ShareQuiz(quiz._id, email);
|
||||
|
||||
if (!result) {
|
||||
window.alert(`Une erreur est survenue.\n Veuillez réessayer plus tard`);
|
||||
return;
|
||||
}
|
||||
|
||||
window.alert(`Quiz partagé avec succès!`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Erreur lors du partage du quiz:', error);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="dashboard">
|
||||
<div className="title">Tableau de bord</div>
|
||||
|
|
@ -564,7 +587,7 @@ const Dashboard: React.FC = () => {
|
|||
{quizzesByFolder[folderName].map((quiz: QuizType) => (
|
||||
<div className="quiz" key={quiz._id}>
|
||||
<div className="title">
|
||||
<Tooltip title="Démarrer" placement="top">
|
||||
<Tooltip title="Lancer quiz" placement="top">
|
||||
<div>
|
||||
<Button
|
||||
variant="outlined"
|
||||
|
|
@ -580,7 +603,7 @@ const Dashboard: React.FC = () => {
|
|||
</div>
|
||||
|
||||
<div className="actions">
|
||||
<Tooltip title="Télécharger" placement="top">
|
||||
<Tooltip title="Télécharger quiz" placement="top">
|
||||
<IconButton
|
||||
color="primary"
|
||||
onClick={() => downloadTxtFile(quiz)}
|
||||
|
|
@ -590,7 +613,7 @@ const Dashboard: React.FC = () => {
|
|||
</IconButton>
|
||||
</Tooltip>
|
||||
|
||||
<Tooltip title="Modifier" placement="top">
|
||||
<Tooltip title="Modifier quiz" placement="top">
|
||||
<IconButton
|
||||
color="primary"
|
||||
onClick={() => handleEditQuiz(quiz)}
|
||||
|
|
@ -600,7 +623,7 @@ const Dashboard: React.FC = () => {
|
|||
</IconButton>
|
||||
</Tooltip>
|
||||
|
||||
<Tooltip title="Dupliquer" placement="top">
|
||||
<Tooltip title="Dupliquer quiz" placement="top">
|
||||
<IconButton
|
||||
color="primary"
|
||||
onClick={() => handleDuplicateQuiz(quiz)}
|
||||
|
|
@ -610,7 +633,7 @@ const Dashboard: React.FC = () => {
|
|||
</IconButton>
|
||||
</Tooltip>
|
||||
|
||||
<Tooltip title="Supprimer" placement="top">
|
||||
<Tooltip title="Supprimer quiz" placement="top">
|
||||
<IconButton
|
||||
aria-label="delete"
|
||||
color="primary"
|
||||
|
|
@ -621,9 +644,15 @@ const Dashboard: React.FC = () => {
|
|||
</IconButton>
|
||||
</Tooltip>
|
||||
|
||||
<div className="quiz-share">
|
||||
<ShareQuizModal quiz={quiz} />
|
||||
</div>
|
||||
<Tooltip title="Partager quiz" placement="top">
|
||||
<IconButton
|
||||
color="primary"
|
||||
onClick={() => handleShareQuiz(quiz)}
|
||||
>
|
||||
{' '}
|
||||
<Share />{' '}
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
|
|
|
|||
|
|
@ -25,29 +25,29 @@ const ManageRoom: React.FC = () => {
|
|||
const navigate = useNavigate();
|
||||
const [socket, setSocket] = useState<Socket | null>(null);
|
||||
const [students, setStudents] = useState<StudentType[]>([]);
|
||||
const { quizId = '', roomName = '' } = useParams<{ quizId: string; roomName: string }>();
|
||||
const { quizId = '', roomName = '' } = useParams<{ quizId: string, roomName: string }>();
|
||||
const [quizQuestions, setQuizQuestions] = useState<QuestionType[] | undefined>();
|
||||
const [quiz, setQuiz] = useState<QuizType | null>(null);
|
||||
const [quizMode, setQuizMode] = useState<'teacher' | 'student'>('teacher');
|
||||
const [connectingError, setConnectingError] = useState<string>('');
|
||||
const [currentQuestion, setCurrentQuestion] = useState<QuestionType | undefined>(undefined);
|
||||
const [quizStarted, setQuizStarted] = useState<boolean>(false);
|
||||
const [formattedRoomName, setFormattedRoomName] = useState('');
|
||||
const [formattedRoomName, setFormattedRoomName] = useState("");
|
||||
const [newlyConnectedUser, setNewlyConnectedUser] = useState<StudentType | null>(null);
|
||||
|
||||
// Handle the newly connected user in useEffect, because it needs state info
|
||||
// Handle the newly connected user in useEffect, because it needs state info
|
||||
// not available in the socket.on() callback
|
||||
useEffect(() => {
|
||||
if (newlyConnectedUser) {
|
||||
console.log(`Handling newly connected user: ${newlyConnectedUser.name}`);
|
||||
setStudents((prevStudents) => [...prevStudents, newlyConnectedUser]);
|
||||
|
||||
|
||||
// only send nextQuestion if the quiz has started
|
||||
if (!quizStarted) {
|
||||
console.log(`!quizStarted: returning.... `);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (quizMode === 'teacher') {
|
||||
webSocketService.nextQuestion({
|
||||
roomName: formattedRoomName,
|
||||
|
|
@ -60,7 +60,7 @@ const ManageRoom: React.FC = () => {
|
|||
} else {
|
||||
console.error('Invalid quiz mode:', quizMode);
|
||||
}
|
||||
|
||||
|
||||
// Reset the newly connected user state
|
||||
setNewlyConnectedUser(null);
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ const ManageRoom: React.FC = () => {
|
|||
return () => {
|
||||
disconnectWebSocket();
|
||||
};
|
||||
}, [roomName, navigate]);
|
||||
}, [roomName, navigate]);
|
||||
|
||||
useEffect(() => {
|
||||
if (quizId) {
|
||||
|
|
@ -138,8 +138,8 @@ const ManageRoom: React.FC = () => {
|
|||
setFormattedRoomName(roomNameUpper);
|
||||
console.log(`Creating WebSocket room named ${roomNameUpper}`);
|
||||
|
||||
/**
|
||||
* ATTENTION: Lire les variables d'état dans
|
||||
/**
|
||||
* ATTENTION: Lire les variables d'état dans
|
||||
* les .on() n'est pas une bonne pratique.
|
||||
* Les valeurs sont celles au moment de la création
|
||||
* de la fonction et non au moment de l'exécution.
|
||||
|
|
@ -179,6 +179,7 @@ const ManageRoom: React.FC = () => {
|
|||
};
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
if (socket) {
|
||||
console.log(`Listening for submit-answer-room in room ${formattedRoomName}`);
|
||||
socket.on('submit-answer-room', (answerData: AnswerReceptionFromBackendType) => {
|
||||
|
|
@ -252,12 +253,10 @@ const ManageRoom: React.FC = () => {
|
|||
if (nextQuestionIndex === undefined || nextQuestionIndex > quizQuestions.length - 1) return;
|
||||
|
||||
setCurrentQuestion(quizQuestions[nextQuestionIndex]);
|
||||
webSocketService.nextQuestion({
|
||||
roomName: formattedRoomName,
|
||||
questions: quizQuestions,
|
||||
questionIndex: nextQuestionIndex,
|
||||
isLaunch: false
|
||||
});
|
||||
webSocketService.nextQuestion({roomName: formattedRoomName,
|
||||
questions: quizQuestions,
|
||||
questionIndex: nextQuestionIndex,
|
||||
isLaunch: false});
|
||||
};
|
||||
|
||||
const previousQuestion = () => {
|
||||
|
|
@ -267,12 +266,7 @@ const ManageRoom: React.FC = () => {
|
|||
|
||||
if (prevQuestionIndex === undefined || prevQuestionIndex < 0) return;
|
||||
setCurrentQuestion(quizQuestions[prevQuestionIndex]);
|
||||
webSocketService.nextQuestion({
|
||||
roomName: formattedRoomName,
|
||||
questions: quizQuestions,
|
||||
questionIndex: prevQuestionIndex,
|
||||
isLaunch: false
|
||||
});
|
||||
webSocketService.nextQuestion({roomName: formattedRoomName, questions: quizQuestions, questionIndex: prevQuestionIndex, isLaunch: false});
|
||||
};
|
||||
|
||||
const initializeQuizQuestion = () => {
|
||||
|
|
@ -300,12 +294,7 @@ const ManageRoom: React.FC = () => {
|
|||
}
|
||||
|
||||
setCurrentQuestion(quizQuestions[0]);
|
||||
webSocketService.nextQuestion({
|
||||
roomName: formattedRoomName,
|
||||
questions: quizQuestions,
|
||||
questionIndex: 0,
|
||||
isLaunch: true
|
||||
});
|
||||
webSocketService.nextQuestion({roomName: formattedRoomName, questions: quizQuestions, questionIndex: 0, isLaunch: true});
|
||||
};
|
||||
|
||||
const launchStudentMode = () => {
|
||||
|
|
@ -342,21 +331,11 @@ const ManageRoom: React.FC = () => {
|
|||
if (quiz?.content && quizQuestions) {
|
||||
setCurrentQuestion(quizQuestions[questionIndex]);
|
||||
if (quizMode === 'teacher') {
|
||||
webSocketService.nextQuestion({
|
||||
roomName: formattedRoomName,
|
||||
questions: quizQuestions,
|
||||
questionIndex,
|
||||
isLaunch: false
|
||||
});
|
||||
webSocketService.nextQuestion({roomName: formattedRoomName, questions: quizQuestions, questionIndex, isLaunch: false});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const finishQuiz = () => {
|
||||
disconnectWebSocket();
|
||||
navigate('/teacher/dashboard');
|
||||
};
|
||||
|
||||
const handleReturn = () => {
|
||||
disconnectWebSocket();
|
||||
navigate('/teacher/dashboard');
|
||||
|
|
@ -403,15 +382,15 @@ const ManageRoom: React.FC = () => {
|
|||
width: '100%'
|
||||
}}
|
||||
>
|
||||
{
|
||||
{(
|
||||
<div
|
||||
className="userCount subtitle smallText"
|
||||
style={{ display: 'flex', justifyContent: 'flex-end' }}
|
||||
style={{ display: "flex", justifyContent: "flex-end" }}
|
||||
>
|
||||
<GroupIcon style={{ marginRight: '5px' }} />
|
||||
{students.length}/60
|
||||
</div>
|
||||
}
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="dumb"></div>
|
||||
|
|
@ -446,6 +425,7 @@ const ManageRoom: React.FC = () => {
|
|||
<QuestionDisplay
|
||||
showAnswer={false}
|
||||
question={currentQuestion?.question as Question}
|
||||
|
||||
/>
|
||||
)}
|
||||
|
||||
|
|
@ -487,11 +467,6 @@ const ManageRoom: React.FC = () => {
|
|||
</div>
|
||||
</div>
|
||||
)}
|
||||
<div className="finishQuizButton">
|
||||
<Button onClick={finishQuiz} variant="contained">
|
||||
Terminer le quiz
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<StudentWaitPage
|
||||
|
|
|
|||
|
|
@ -37,12 +37,8 @@
|
|||
/* align-items: center; */
|
||||
}
|
||||
|
||||
.room .finishQuizButton {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
margin-left: auto;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,71 +1,66 @@
|
|||
// EditorQuiz.tsx
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { useParams, useNavigate } from 'react-router-dom';
|
||||
|
||||
import { FolderType } from '../../../Types/FolderType';
|
||||
|
||||
|
||||
import './share.css';
|
||||
import { Button, NativeSelect, Typography, Box } from '@mui/material';
|
||||
import { Button, NativeSelect } from '@mui/material';
|
||||
import ReturnButton from 'src/components/ReturnButton/ReturnButton';
|
||||
|
||||
import ApiService from '../../../services/ApiService';
|
||||
|
||||
const Share: React.FC = () => {
|
||||
console.log('Component rendered');
|
||||
const navigate = useNavigate();
|
||||
const { id } = useParams<string>();
|
||||
|
||||
const [quizTitle, setQuizTitle] = useState('');
|
||||
const [selectedFolder, setSelectedFolder] = useState<string>('');
|
||||
|
||||
const [folders, setFolders] = useState<FolderType[]>([]);
|
||||
const [quizExists, setQuizExists] = useState(false);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchData = async () => {
|
||||
try {
|
||||
if (!id) {
|
||||
console.error('Quiz not found for id:', id);
|
||||
navigate('/teacher/dashboard');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ApiService.isLoggedIn()) {
|
||||
navigate("/login");
|
||||
return;
|
||||
}
|
||||
|
||||
const quizIds = await ApiService.getAllQuizIds();
|
||||
|
||||
if (quizIds.includes(id)) {
|
||||
setQuizExists(true);
|
||||
setLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const userFolders = await ApiService.getUserFolders();
|
||||
|
||||
if (userFolders.length == 0) {
|
||||
navigate('/teacher/dashboard');
|
||||
return;
|
||||
}
|
||||
|
||||
setFolders(userFolders as FolderType[]);
|
||||
|
||||
const title = await ApiService.getSharedQuiz(id);
|
||||
|
||||
if (!title) {
|
||||
console.error('Quiz not found for id:', id);
|
||||
navigate('/teacher/dashboard');
|
||||
return;
|
||||
}
|
||||
|
||||
setQuizTitle(title);
|
||||
setLoading(false);
|
||||
} catch (error) {
|
||||
console.error('Error fetching data:', error);
|
||||
setLoading(false);
|
||||
console.log("QUIZID : " + id)
|
||||
if (!id) {
|
||||
window.alert(`Une erreur est survenue.\n Le quiz n'a pas été trouvé\nVeuillez réessayer plus tard`)
|
||||
console.error('Quiz not found for id:', id);
|
||||
navigate('/teacher/dashboard');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ApiService.isLoggedIn()) {
|
||||
window.alert(`Vous n'êtes pas connecté.\nVeuillez vous connecter et revenir à ce lien`);
|
||||
navigate("/login");
|
||||
return;
|
||||
}
|
||||
|
||||
const userFolders = await ApiService.getUserFolders();
|
||||
|
||||
if (userFolders.length == 0) {
|
||||
window.alert(`Vous n'avez aucun dossier.\nVeuillez en créer un et revenir à ce lien`)
|
||||
navigate('/teacher/dashboard');
|
||||
return;
|
||||
}
|
||||
|
||||
setFolders(userFolders as FolderType[]);
|
||||
|
||||
const title = await ApiService.getSharedQuiz(id);
|
||||
|
||||
if (!title) {
|
||||
window.alert(`Une erreur est survenue.\n Veuillez réessayer plus tard`)
|
||||
console.error('Quiz not found for id:', id);
|
||||
navigate('/teacher/dashboard');
|
||||
return;
|
||||
}
|
||||
|
||||
setQuizTitle(title);
|
||||
};
|
||||
|
||||
fetchData();
|
||||
}, [id, navigate]);
|
||||
}, []);
|
||||
|
||||
const handleSelectFolder = (event: React.ChangeEvent<HTMLSelectElement>) => {
|
||||
setSelectedFolder(event.target.value);
|
||||
|
|
@ -73,12 +68,14 @@ const Share: React.FC = () => {
|
|||
|
||||
const handleQuizSave = async () => {
|
||||
try {
|
||||
|
||||
if (selectedFolder == '') {
|
||||
alert("Veuillez choisir un dossier");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!id) {
|
||||
window.alert(`Une erreur est survenue.\n Le quiz n'a pas été trouvé\nVeuillez réessayer plus tard`)
|
||||
console.error('Quiz not found for id:', id);
|
||||
navigate('/teacher/dashboard');
|
||||
return;
|
||||
|
|
@ -88,91 +85,49 @@ const Share: React.FC = () => {
|
|||
navigate('/teacher/dashboard');
|
||||
|
||||
} catch (error) {
|
||||
window.alert(`Une erreur est survenue.\n Veuillez réessayer plus tard`)
|
||||
console.log(error)
|
||||
}
|
||||
};
|
||||
|
||||
if (loading) {
|
||||
return <div className='quizImport'>Chargement...</div>;
|
||||
}
|
||||
|
||||
if (quizExists) {
|
||||
return (
|
||||
<div className='quizImport'>
|
||||
<div className='importHeader'>
|
||||
<ReturnButton />
|
||||
<div className='titleContainer'>
|
||||
<div className='mainTitle'>Quiz déjà existant</div>
|
||||
</div>
|
||||
<div className='dumb'></div>
|
||||
</div>
|
||||
|
||||
<div className='editSection'>
|
||||
<Box sx={{
|
||||
textAlign: 'center',
|
||||
padding: 3,
|
||||
maxWidth: 600,
|
||||
margin: '0 auto'
|
||||
}}>
|
||||
<Typography variant="h6" gutterBottom>
|
||||
Le quiz que vous essayez d'importer existe déjà sur votre compte.
|
||||
</Typography>
|
||||
|
||||
<Button
|
||||
variant="contained"
|
||||
onClick={() => navigate('/teacher/dashboard')}
|
||||
sx={{ mt: 3, mb: 1 }}
|
||||
fullWidth
|
||||
>
|
||||
Retour au tableau de bord
|
||||
</Button>
|
||||
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
Si vous souhaitiez créer une copie de ce quiz,
|
||||
vous pouvez utiliser la fonction "Dupliquer" disponible
|
||||
dans votre tableau de bord.
|
||||
</Typography>
|
||||
</Box>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='quizImport'>
|
||||
|
||||
<div className='importHeader'>
|
||||
<ReturnButton />
|
||||
<div className='titleContainer'>
|
||||
<div className='mainTitle'>Importation du Quiz: {quizTitle}</div>
|
||||
<div className='subTitle'>
|
||||
Vous êtes sur le point d'importer le quiz <strong>{quizTitle}</strong>, choisissez un dossier dans lequel enregistrer ce nouveau quiz.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='title'>Importer quiz: {quizTitle}</div>
|
||||
|
||||
<div className='dumb'></div>
|
||||
</div>
|
||||
|
||||
<div className='editSection'>
|
||||
<div className='formContainer'>
|
||||
|
||||
<div>
|
||||
|
||||
<NativeSelect
|
||||
id="select-folder"
|
||||
color="primary"
|
||||
value={selectedFolder}
|
||||
onChange={handleSelectFolder}
|
||||
className="folderSelect"
|
||||
>
|
||||
<option disabled value=""> Choisir un dossier... </option>
|
||||
|
||||
{folders.map((folder: FolderType) => (
|
||||
<option value={folder._id} key={folder._id}> {folder.title} </option>
|
||||
))}
|
||||
</NativeSelect>
|
||||
|
||||
<Button variant="contained" onClick={handleQuizSave} className="saveButton">
|
||||
<Button variant="contained" onClick={handleQuizSave}>
|
||||
Enregistrer
|
||||
</Button>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default Share;
|
||||
export default Share;
|
||||
|
|
|
|||
|
|
@ -3,58 +3,19 @@
|
|||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
align-content: stretch;
|
||||
align-content: stretch
|
||||
}
|
||||
|
||||
.quizImport .importHeader .returnButton {
|
||||
flex-basis: 10%;
|
||||
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.quizImport .importHeader .titleContainer {
|
||||
.quizImport .importHeader .title {
|
||||
flex-basis: auto;
|
||||
text-align: center; /* Center the title and subtitle */
|
||||
}
|
||||
|
||||
.quizImport .importHeader .mainTitle {
|
||||
font-size: 44px; /* Larger font size for the main title */
|
||||
font-weight: bold; /* Remove bold */
|
||||
color: #333; /* Slightly paler color */
|
||||
}
|
||||
|
||||
.quizImport .importHeader .subTitle {
|
||||
font-size: 14px; /* Smaller font size for the subtitle */
|
||||
color: #666; /* Pale gray color */
|
||||
margin-top: 8px; /* Add some space between the title and subtitle */
|
||||
}
|
||||
|
||||
.quizImport .importHeader .dumb {
|
||||
flex-basis: 10%;
|
||||
}
|
||||
|
||||
.quizImport .editSection {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.quizImport .editSection .formContainer {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 20px; /* Adds space between the select and button */
|
||||
width: 100%;
|
||||
max-width: 400px; /* Limits the width of the form container */
|
||||
}
|
||||
|
||||
.quizImport .editSection .folderSelect {
|
||||
width: 100%; /* Ensures the select element takes the full width of its container */
|
||||
}
|
||||
|
||||
.quizImport .editSection .saveButton {
|
||||
width: 100%; /* Makes the button take the full width of its container */
|
||||
padding: 10px 20px; /* Increases the button's padding for a larger appearance */
|
||||
font-size: 16px; /* Increases the font size for better visibility */
|
||||
}
|
||||
|
|
@ -75,6 +75,8 @@ class ApiService {
|
|||
return false;
|
||||
}
|
||||
|
||||
console.log("ApiService: isLoggedIn: Token:", token);
|
||||
|
||||
// Update token expiry
|
||||
this.saveToken(token);
|
||||
|
||||
|
|
@ -90,6 +92,7 @@ class ApiService {
|
|||
}
|
||||
|
||||
try {
|
||||
console.log("ApiService: isLoggedInTeacher: Token:", token);
|
||||
const decodedToken = jwtDecode(token) as { roles: string[] };
|
||||
|
||||
/////// REMOVE BELOW
|
||||
|
|
@ -101,6 +104,7 @@ class ApiService {
|
|||
const userRoles = decodedToken.roles;
|
||||
const requiredRole = 'teacher';
|
||||
|
||||
console.log("ApiService: isLoggedInTeacher: UserRoles:", userRoles);
|
||||
if (!userRoles || !userRoles.includes(requiredRole)) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -191,6 +195,7 @@ class ApiService {
|
|||
|
||||
const result: AxiosResponse = await axios.post(url, body, { headers: headers });
|
||||
|
||||
console.log(result);
|
||||
if (result.status == 200) {
|
||||
//window.location.href = result.request.responseURL;
|
||||
window.location.href = '/login';
|
||||
|
|
@ -202,6 +207,7 @@ class ApiService {
|
|||
return true;
|
||||
|
||||
} catch (error) {
|
||||
console.log("Error details: ", error);
|
||||
|
||||
if (axios.isAxiosError(error)) {
|
||||
const err = error as AxiosError;
|
||||
|
|
@ -564,6 +570,7 @@ public async login(email: string, password: string): Promise<any> {
|
|||
const headers = this.constructRequestHeaders();
|
||||
const body = { folderId };
|
||||
|
||||
console.log(headers);
|
||||
const result: AxiosResponse = await axios.post(url, body, { headers: headers });
|
||||
|
||||
if (result.status !== 200) {
|
||||
|
|
@ -853,6 +860,36 @@ public async login(email: string, password: string): Promise<any> {
|
|||
}
|
||||
}
|
||||
|
||||
async ShareQuiz(quizId: string, email: string): Promise<ApiResponse> {
|
||||
try {
|
||||
if (!quizId || !email) {
|
||||
throw new Error(`quizId and email are required.`);
|
||||
}
|
||||
|
||||
const url: string = this.constructRequestUrl(`/quiz/Share`);
|
||||
const headers = this.constructRequestHeaders();
|
||||
const body = { quizId, email };
|
||||
|
||||
const result: AxiosResponse = await axios.put(url, body, { headers: headers });
|
||||
|
||||
if (result.status !== 200) {
|
||||
throw new Error(`Update and share quiz failed. Status: ${result.status}`);
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
console.log("Error details: ", error);
|
||||
|
||||
if (axios.isAxiosError(error)) {
|
||||
const err = error as AxiosError;
|
||||
const data = err.response?.data as { error: string } | undefined;
|
||||
return data?.error || 'Unknown server error during request.';
|
||||
}
|
||||
|
||||
return `An unexpected error occurred.`;
|
||||
}
|
||||
}
|
||||
|
||||
async getSharedQuiz(quizId: string): Promise<string> {
|
||||
try {
|
||||
if (!quizId) {
|
||||
|
|
@ -1241,33 +1278,6 @@ public async login(email: string, password: string): Promise<any> {
|
|||
}
|
||||
}
|
||||
|
||||
public async getAllQuizIds(): Promise<string[]> {
|
||||
try {
|
||||
const folders = await this.getUserFolders();
|
||||
|
||||
const allQuizIds: string[] = [];
|
||||
|
||||
if (Array.isArray(folders)) {
|
||||
for (const folder of folders) {
|
||||
const folderQuizzes = await this.getFolderContent(folder._id);
|
||||
|
||||
if (Array.isArray(folderQuizzes)) {
|
||||
allQuizIds.push(...folderQuizzes.map(quiz => quiz._id));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.error('Failed to get user folders:', folders);
|
||||
}
|
||||
|
||||
return allQuizIds;
|
||||
} catch (error) {
|
||||
console.error('Failed to get all quiz ids:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
const apiService = new ApiService();
|
||||
|
|
|
|||
329
package-lock.json
generated
329
package-lock.json
generated
|
|
@ -1,329 +0,0 @@
|
|||
{
|
||||
"name": "EvalueTonSavoir",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"dependencies": {
|
||||
"axios-mock-adapter": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/asynckit": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
|
||||
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/axios": {
|
||||
"version": "1.8.2",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.8.2.tgz",
|
||||
"integrity": "sha512-ls4GYBm5aig9vWx8AWDSGLpnpDQRtWAfrjU+EuytuODrFBkqesN2RkOQCBzrA1RQNHw1SmRMSDDDSwzNAYQ6Rg==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"follow-redirects": "^1.15.6",
|
||||
"form-data": "^4.0.0",
|
||||
"proxy-from-env": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/axios-mock-adapter": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/axios-mock-adapter/-/axios-mock-adapter-2.1.0.tgz",
|
||||
"integrity": "sha512-AZUe4OjECGCNNssH8SOdtneiQELsqTsat3SQQCWLPjN436/H+L9AjWfV7bF+Zg/YL9cgbhrz5671hoh+Tbn98w==",
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"is-buffer": "^2.0.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"axios": ">= 0.17.0"
|
||||
}
|
||||
},
|
||||
"node_modules/call-bind-apply-helpers": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
|
||||
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/combined-stream": {
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
|
||||
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"delayed-stream": "~1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/delayed-stream": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/dunder-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"gopd": "^1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-define-property": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
|
||||
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-errors": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
||||
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-object-atoms": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
|
||||
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/es-set-tostringtag": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
|
||||
"integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.6",
|
||||
"has-tostringtag": "^1.0.2",
|
||||
"hasown": "^2.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
|
||||
},
|
||||
"node_modules/follow-redirects": {
|
||||
"version": "1.15.9",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz",
|
||||
"integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://github.com/sponsors/RubenVerborgh"
|
||||
}
|
||||
],
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"debug": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/form-data": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.2.tgz",
|
||||
"integrity": "sha512-hGfm/slu0ZabnNt4oaRZ6uREyfCj6P4fT/n6A1rGV+Z0VdGXjfOhVUpkn6qVQONHGIFwmveGXyDs75+nr6FM8w==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"es-set-tostringtag": "^2.1.0",
|
||||
"mime-types": "^2.1.12"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
||||
"peer": true,
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-intrinsic": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
||||
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
"es-define-property": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"es-object-atoms": "^1.1.1",
|
||||
"function-bind": "^1.1.2",
|
||||
"get-proto": "^1.0.1",
|
||||
"gopd": "^1.2.0",
|
||||
"has-symbols": "^1.1.0",
|
||||
"hasown": "^2.0.2",
|
||||
"math-intrinsics": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"dunder-proto": "^1.0.1",
|
||||
"es-object-atoms": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/gopd": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
|
||||
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/has-symbols": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
|
||||
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/has-tostringtag": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
|
||||
"integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"has-symbols": "^1.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/hasown": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
|
||||
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/is-buffer": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz",
|
||||
"integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/math-intrinsics": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
||||
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-db": {
|
||||
"version": "1.52.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/mime-types": {
|
||||
"version": "2.1.35",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"mime-db": "1.52.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/proxy-from-env": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
||||
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
|
||||
"peer": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"axios-mock-adapter": "^2.1.0"
|
||||
}
|
||||
}
|
||||
199
server/package-lock.json
generated
199
server/package-lock.json
generated
|
|
@ -38,7 +38,7 @@
|
|||
"supertest": "^6.3.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": "22.x"
|
||||
"node": "20.x"
|
||||
}
|
||||
},
|
||||
"node_modules/@ampproject/remapping": {
|
||||
|
|
@ -55,20 +55,68 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@babel/code-frame": {
|
||||
"version": "7.26.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz",
|
||||
"integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==",
|
||||
"version": "7.22.13",
|
||||
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz",
|
||||
"integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-validator-identifier": "^7.25.9",
|
||||
"js-tokens": "^4.0.0",
|
||||
"picocolors": "^1.0.0"
|
||||
"@babel/highlight": "^7.22.13",
|
||||
"chalk": "^2.4.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/code-frame/node_modules/ansi-styles": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"color-convert": "^1.9.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/code-frame/node_modules/chalk": {
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
||||
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ansi-styles": "^3.2.1",
|
||||
"escape-string-regexp": "^1.0.5",
|
||||
"supports-color": "^5.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/code-frame/node_modules/color-convert": {
|
||||
"version": "1.9.3",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"color-name": "1.1.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/code-frame/node_modules/color-name": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@babel/code-frame/node_modules/escape-string-regexp": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
||||
"integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/compat-data": {
|
||||
"version": "7.23.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.3.tgz",
|
||||
|
|
@ -294,21 +342,19 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@babel/helper-string-parser": {
|
||||
"version": "7.25.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz",
|
||||
"integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==",
|
||||
"version": "7.22.5",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz",
|
||||
"integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/helper-validator-identifier": {
|
||||
"version": "7.25.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz",
|
||||
"integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==",
|
||||
"version": "7.22.20",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz",
|
||||
"integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
|
|
@ -323,28 +369,88 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@babel/helpers": {
|
||||
"version": "7.26.10",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.10.tgz",
|
||||
"integrity": "sha512-UPYc3SauzZ3JGgj87GgZ89JVdC5dj0AoetR5Bw6wj4niittNyFh6+eOGonYvJ1ao6B8lEa3Q3klS7ADZ53bc5g==",
|
||||
"version": "7.23.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.2.tgz",
|
||||
"integrity": "sha512-lzchcp8SjTSVe/fPmLwtWVBFC7+Tbn8LGHDVfDp9JGxpAY5opSaEFgt8UQvrnECWOTdji2mOWMz1rOhkHscmGQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/template": "^7.26.9",
|
||||
"@babel/types": "^7.26.10"
|
||||
"@babel/template": "^7.22.15",
|
||||
"@babel/traverse": "^7.23.2",
|
||||
"@babel/types": "^7.23.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/parser": {
|
||||
"version": "7.26.10",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.10.tgz",
|
||||
"integrity": "sha512-6aQR2zGE/QFi8JpDLjUZEPYOs7+mhKXm86VaKFiLP35JQwQb6bwUE+XbvkH0EptsYhbNBSUGaUBLKqxH1xSgsA==",
|
||||
"node_modules/@babel/highlight": {
|
||||
"version": "7.22.20",
|
||||
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz",
|
||||
"integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.26.10"
|
||||
"@babel/helper-validator-identifier": "^7.22.20",
|
||||
"chalk": "^2.4.2",
|
||||
"js-tokens": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/highlight/node_modules/ansi-styles": {
|
||||
"version": "3.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"color-convert": "^1.9.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/highlight/node_modules/chalk": {
|
||||
"version": "2.4.2",
|
||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
||||
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ansi-styles": "^3.2.1",
|
||||
"escape-string-regexp": "^1.0.5",
|
||||
"supports-color": "^5.3.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/highlight/node_modules/color-convert": {
|
||||
"version": "1.9.3",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"color-name": "1.1.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/highlight/node_modules/color-name": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||
"integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@babel/highlight/node_modules/escape-string-regexp": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
||||
"integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/parser": {
|
||||
"version": "7.23.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.3.tgz",
|
||||
"integrity": "sha512-uVsWNvlVsIninV2prNz/3lHCb+5CJ+e+IUBfbjToAHODtfGYLfCFuY4AU7TskI+dAKk+njsPiBjq1gKTvZOBaw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"parser": "bin/babel-parser.js"
|
||||
},
|
||||
|
|
@ -530,15 +636,14 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@babel/template": {
|
||||
"version": "7.26.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.26.9.tgz",
|
||||
"integrity": "sha512-qyRplbeIpNZhmzOysF/wFMuP9sctmh2cFzRAZOn1YapxBsE1i9bJIY586R/WBLfLcmcBlM8ROBiQURnnNy+zfA==",
|
||||
"version": "7.22.15",
|
||||
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz",
|
||||
"integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.26.2",
|
||||
"@babel/parser": "^7.26.9",
|
||||
"@babel/types": "^7.26.9"
|
||||
"@babel/code-frame": "^7.22.13",
|
||||
"@babel/parser": "^7.22.15",
|
||||
"@babel/types": "^7.22.15"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
|
|
@ -599,14 +704,14 @@
|
|||
"dev": true
|
||||
},
|
||||
"node_modules/@babel/types": {
|
||||
"version": "7.26.10",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.10.tgz",
|
||||
"integrity": "sha512-emqcG3vHrpxUKTrxcblR36dcrcoRDvKmnL/dCL6ZsHaShW80qxCAcNhzQZrpeM765VzEos+xOi4s+r4IXzTwdQ==",
|
||||
"version": "7.23.3",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.3.tgz",
|
||||
"integrity": "sha512-OZnvoH2l8PK5eUvEcUyCt/sXgr/h+UWpVuBbOljwcrAgUl6lpchoQ++PHGyQy1AtYnVA6CEq3y5xeEI10brpXw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-string-parser": "^7.25.9",
|
||||
"@babel/helper-validator-identifier": "^7.25.9"
|
||||
"@babel/helper-string-parser": "^7.22.5",
|
||||
"@babel/helper-validator-identifier": "^7.22.20",
|
||||
"to-fast-properties": "^2.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
|
|
@ -4667,8 +4772,7 @@
|
|||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||
"integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/js-yaml": {
|
||||
"version": "3.14.1",
|
||||
|
|
@ -6579,6 +6683,15 @@
|
|||
"integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/to-fast-properties": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz",
|
||||
"integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/to-regex-range": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
"supertest": "^6.3.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": "22.x"
|
||||
"node": "20.x"
|
||||
},
|
||||
"jest": {
|
||||
"testEnvironment": "node",
|
||||
|
|
|
|||
Loading…
Reference in a new issue