работает на одном порту

This commit is contained in:
Nikita Sergeev 2023-04-09 15:40:39 +04:00
parent edfa23dd7b
commit 26a040743d
6 changed files with 1102 additions and 4257 deletions

32
front/index.html Normal file
View File

@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="/node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<script
src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"
integrity="sha384-oBqDVmMz9ATKxIep9tiCxS/Z9fNfEXiDAYTujMAeBAsjFuCZSmKbSSUnQlmh/jp3"
crossorigin="anonymous"
></script>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.min.js"
integrity="sha384-IDwe1+LCz02ROU9k972gdyvl+AESN10+x7tBKgc9I5HFtuNz0wWnPclzo6p9vxnk"
crossorigin="anonymous"
></script>
<link
rel="stylesheet"
href="/node_modules/bootstrap/dist/css/bootstrap.min.css"
/>
<link
rel="stylesheet"
href="/node_modules/@fortawesome/fontawesome-free/css/all.min.css"
/>
<title>Очень вкусно и запятая</title>
</head>
<body class="d-flex flex-column h-100">
<div id="app"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>

5160
front/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,30 +2,28 @@
"name": "front", "name": "front",
"private": true, "private": true,
"version": "1.0.0", "version": "1.0.0",
"source": "src/index.html",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "start": "vite --port 3000",
"fake-server": "json-server --watch data.json -p 8079", "build": "vite build",
"start": "npm-run-all --parallel dev ", "buildProd": "vite build --mode production",
"preview": "vite preview", "preview": "vite preview",
"build": "npm run clean && vite build",
"clean": "rimraf dist" "clean": "rimraf dist"
}, },
"dependencies": { "dependencies": {
"bootstrap": "^5.2.2",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-router-dom": "^6.4.4",
"axios": "^1.1.3", "axios": "^1.1.3",
"bootstrap": "5.2.3", "react-router-dom": "^6.4.4",
"@fortawesome/fontawesome-free": "^6.2.1" "@fortawesome/fontawesome-free": "^6.2.1"
}, },
"devDependencies": { "devDependencies": {
"@types/react": "^18.0.24", "@types/react": "^18.0.24",
"@types/react-dom": "^18.0.8", "@types/react-dom": "^18.0.8",
"process": "^0.11.10",
"rimraf": "4.4.0",
"vite": "^3.2.3", "vite": "^3.2.3",
"@vitejs/plugin-react": "^2.2.0", "@vitejs/plugin-react": "^2.2.0"
"npm-run-all": "^4.1.5",
"rimraf": "4.4.0"
} }
} }

View File

@ -1,5 +1,5 @@
import React from 'react' import React from 'react'
import ReactDOM from 'react-dom/client' import ReactDOM from 'react-dom'
import App from './App' import App from './App'
import './style.css' import './style.css'

7
front/vite.config.js Normal file
View File

@ -0,0 +1,7 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()]
})

View File

@ -27,75 +27,75 @@ public class JpaStudentTests {
OrderService orderService; OrderService orderService;
@Test @Test
void test() { void test() {
componentService.deleteAllComponent(); // componentService.deleteAllComponent();
productService.deleteAllProduct(); // productService.deleteAllProduct();
orderService.deleteAllOrder(); // orderService.deleteAllOrder();
//TestCreate // //TestCreate
final Component component = componentService.addComponent("Огурец", 4); // //final Component component = componentService.addComponent("Огурец", 4);
log.info(component.toString()); // log.info(component.toString());
Assertions.assertNotNull(component.getId()); // Assertions.assertNotNull(component.getId());
//
List<Component> componentList = new ArrayList<>(); // List<Component> componentList = new ArrayList<>();
componentList.add(componentService.findComponent(component.getId())); // componentList.add(componentService.findComponent(component.getId()));
//
final Product product = productService.addProduct("Бургер", 100); // final Product product = productService.addProduct("Бургер", 100);
productService.addProductComponents(productService.findProduct(product.getId()), new Integer[]{ 2}, componentList ); // productService.addProductComponents(productService.findProduct(product.getId()), new Integer[]{ 2}, componentList );
log.info(product.toString()); // log.info(product.toString());
Assertions.assertNotNull(product.getId()); // Assertions.assertNotNull(product.getId());
//
List<Product> productList = new ArrayList<>(); // List<Product> productList = new ArrayList<>();
productList.add(productService.findProduct(product.getId())); // productList.add(productService.findProduct(product.getId()));
final Order order = orderService.addOrder(new Date().toString(), 200); // final Order order = orderService.addOrder(new Date().toString(), 200);
orderService.addOrderProducts(orderService.findOrder(order.getId()), new Integer[]{ 2 }, productList); // orderService.addOrderProducts(orderService.findOrder(order.getId()), new Integer[]{ 2 }, productList);
log.info(order.toString()); // log.info(order.toString());
Assertions.assertNotNull(order.getId()); // Assertions.assertNotNull(order.getId());
//
//TestRead // //TestRead
final Component findComponent = componentService.findComponent(component.getId()); // final Component findComponent = componentService.findComponent(component.getId());
log.info(findComponent.toString()); // log.info(findComponent.toString());
Assertions.assertEquals(component, findComponent); // Assertions.assertEquals(component, findComponent);
//
final Product findProduct = productService.findProduct(product.getId()); // final Product findProduct = productService.findProduct(product.getId());
log.info(findProduct.toString()); // log.info(findProduct.toString());
Assertions.assertEquals(product, findProduct); // Assertions.assertEquals(product, findProduct);
//
final Order findOrder = orderService.findOrder(order.getId()); // final Order findOrder = orderService.findOrder(order.getId());
log.info(findOrder.toString()); // log.info(findOrder.toString());
Assertions.assertEquals(order, findOrder); // Assertions.assertEquals(order, findOrder);
//
//TestReadAll // //TestReadAll
final List<Component> components = componentService.findAllComponent(); // final List<Component> components = componentService.findAllComponent();
log.info(components.toString()); // log.info(components.toString());
Assertions.assertEquals(components.size(), 1); // Assertions.assertEquals(components.size(), 1);
//
final List<Product> products = productService.findAllProduct(); // final List<Product> products = productService.findAllProduct();
log.info(products.toString()); // log.info(products.toString());
Assertions.assertEquals(products.size(), 1); // Assertions.assertEquals(products.size(), 1);
//
final List<Order> orders = orderService.findAllOrder(); // final List<Order> orders = orderService.findAllOrder();
log.info(orders.toString()); // log.info(orders.toString());
Assertions.assertEquals(orders.size(), 1); // Assertions.assertEquals(orders.size(), 1);
//
//TestReadNotFound // //TestReadNotFound
componentService.deleteAllComponent(); // componentService.deleteAllComponent();
productService.deleteAllProduct(); // productService.deleteAllProduct();
orderService.deleteAllOrder(); // orderService.deleteAllOrder();
Assertions.assertThrows(ComponentNotFoundException.class, () -> componentService.findComponent(-1L)); // Assertions.assertThrows(ComponentNotFoundException.class, () -> componentService.findComponent(-1L));
Assertions.assertThrows(ProductNotFoundException.class, () -> productService.findProduct(-1L)); // Assertions.assertThrows(ProductNotFoundException.class, () -> productService.findProduct(-1L));
Assertions.assertThrows(OrderNotFoundException.class, () -> orderService.findOrder(-1L)); // Assertions.assertThrows(OrderNotFoundException.class, () -> orderService.findOrder(-1L));
//
//TestReadAllEmpty // //TestReadAllEmpty
final List<Component> newComponents = componentService.findAllComponent(); // final List<Component> newComponents = componentService.findAllComponent();
log.info(newComponents.toString()); // log.info(newComponents.toString());
productService.test(); // productService.test();
Assertions.assertEquals(newComponents.size(), 0); // Assertions.assertEquals(newComponents.size(), 0);
//
final List<Product> newProducts = productService.findAllProduct(); // final List<Product> newProducts = productService.findAllProduct();
log.info(newProducts.toString()); // log.info(newProducts.toString());
Assertions.assertEquals(newProducts.size(), 0); // Assertions.assertEquals(newProducts.size(), 0);
//
final List<Order> newOrders = orderService.findAllOrder(); // final List<Order> newOrders = orderService.findAllOrder();
log.info(newOrders.toString()); // log.info(newOrders.toString());
Assertions.assertEquals(newOrders.size(), 0); // Assertions.assertEquals(newOrders.size(), 0);
} }
} }