diff --git a/build.gradle b/build.gradle index 8fdd46b..70b7195 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { - id 'java' - id 'org.springframework.boot' version '3.0.2' - id 'io.spring.dependency-management' version '1.1.0' + id 'java' + id 'org.springframework.boot' version '3.0.2' + id 'io.spring.dependency-management' version '1.1.0' } group = 'ip' @@ -9,26 +9,30 @@ version = '0.0.1-SNAPSHOT' sourceCompatibility = '17' repositories { - mavenCentral() + mavenCentral() } jar { - enabled = false + enabled = false } dependencies { - implementation(project(':front')) - implementation 'org.springframework.boot:spring-boot-starter-web' - implementation 'org.springframework.boot:spring-boot-starter-data-jpa' - implementation 'com.h2database:h2:2.1.210' - implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.6.5' - implementation 'org.hibernate.validator:hibernate-validator' - implementation group: 'org.springframework', name: 'spring-tx' - implementation 'org.springdoc:springdoc-openapi-ui:1.6.5' - testImplementation 'org.springframework.boot:spring-boot-starter-test' - implementation 'org.springframework.boot:spring-boot-starter-validation' + implementation(project(':front')) + annotationProcessor "org.springframework.boot:spring-boot-configuration-processor" + implementation 'org.springframework.boot:spring-boot-starter-web' + implementation 'org.springframework.boot:spring-boot-starter-data-jpa' + implementation 'com.h2database:h2:2.1.210' + implementation group: 'org.springdoc', name: 'springdoc-openapi-ui', version: '1.6.5' + implementation 'org.hibernate.validator:hibernate-validator' + implementation group: 'org.springframework', name: 'spring-tx' + implementation 'org.springdoc:springdoc-openapi-ui:1.6.5' + testImplementation 'org.springframework.boot:spring-boot-starter-test' + implementation 'org.springframework.boot:spring-boot-starter-validation' + + implementation 'org.springframework.boot:spring-boot-starter-security' + implementation 'com.auth0:java-jwt:4.4.0' } tasks.named('test') { - useJUnitPlatform() + useJUnitPlatform() } diff --git a/front/index.html b/front/index.html index 319a625..71f8140 100644 --- a/front/index.html +++ b/front/index.html @@ -1,9 +1,8 @@ - - - - + + + - + + +
+ + diff --git a/front/src/App.jsx b/front/src/App.jsx index 58dfdfd..1a838f8 100644 --- a/front/src/App.jsx +++ b/front/src/App.jsx @@ -1,46 +1,91 @@ -import './App.css'; -import { useRoutes, Outlet, BrowserRouter } from 'react-router-dom'; -import Header from './components/common/Header'; +import "./App.css"; +import { + useRoutes, + Outlet, + BrowserRouter, + Routes, + Route, +} from "react-router-dom"; +import Header from "./components/common/Header"; +import PrivateRoute from "./components/common/PrivateRoute"; import Footer from "./components/common/Footer"; -import CatalogStudents from './components/catalogs/CatalogStudents'; -import Menu from './components/catalogs/Menu'; -import Basket from './components/catalogs/Basket'; -import History from './components/catalogs/History'; -import { useState } from 'react'; +import CatalogStudents from "./components/catalogs/CatalogStudents"; +import Menu from "./components/catalogs/Menu"; +import Basket from "./components/catalogs/Basket"; +import History from "./components/catalogs/History"; +import Registration from "./components/catalogs/Registration"; +import { useState } from "react"; +import Login from "./components/catalogs/Login"; +import Users from "./components/catalogs/Users"; function Router(props) { return useRoutes(props.rootRoute); } export default function App() { - const [product,setProduct] = useState([]); + const [product, setProduct] = useState([]); const routes = [ { index: true, element: }, - { path: "catalogs/menu", element: , label: "Меню" }, - { path: "catalogs/component", element: , label: "Компоненты" }, - { path: "catalogs/basket", element: , label: "Корзина" }, - { path: "catalogs/history", element: , label: "История" } + { + path: "catalogs/menu", + label: "Меню", + }, + { + path: "catalogs/component", + label: "Компоненты", + role: "ADMIN", + }, + { + path: "catalogs/basket", + label: "Корзина", + }, + { path: "catalogs/history", label: "История" }, + { + path: "catalogs/users", + label: "Пользователи", + role: "ADMIN", + }, + { + path: "catalogs/registration", + label: "Регистрация", + }, + { + path: "catalogs/login", + label: "Вход в систему", + }, ]; - const links = routes.filter(route => route.hasOwnProperty('label')); - const rootRoute = [ - { path: '/', element: render(links), children: routes } - ]; - - function render(links) { - return ( - <> -
-
- -
-
- - ); - } + const links = routes.filter((route) => route.hasOwnProperty("label")); return ( - +
+
+ + }> + } + path="/catalogs/menu" + exact + /> + } + path="*" + /> + } + path="/catalogs/basket" + /> + } path="/catalogs/history" /> + + }> + } path="/catalogs/component" /> + } path="/catalogs/users" /> + + } path="/catalogs/login" /> + } path="/catalogs/registration" /> + +
+