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

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>

5150
front/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

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

View File

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