From 950b892bece8e9fc7898a7f4da0a75816b6d6e34 Mon Sep 17 00:00:00 2001 From: romantarkin Date: Wed, 30 Jul 2025 10:36:41 +0500 Subject: [PATCH] register user one start --- auth-service/src/controllers/roleController.js | 15 +++++++++++++-- frontend/src/components/SideMenu.js | 1 + frontend/src/pages/Dashboard.js | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/auth-service/src/controllers/roleController.js b/auth-service/src/controllers/roleController.js index 394b745..452280b 100644 --- a/auth-service/src/controllers/roleController.js +++ b/auth-service/src/controllers/roleController.js @@ -11,8 +11,19 @@ export default { }, async getAll(req, res) { try { - const roles = await Role.findAll({ include: Permission }); - res.json(roles); + const { limit, offset } = req.query; + const options = { include: Permission }; + + if (limit && offset) { + options.limit = parseInt(limit); + options.offset = parseInt(offset); + } + + const roles = await Role.findAndCountAll(options); + res.json({ + rows: roles.rows, + count: roles.count + }); } catch (err) { res.status(500).json({ error: err.message }); } diff --git a/frontend/src/components/SideMenu.js b/frontend/src/components/SideMenu.js index 74f10ed..95fb4be 100644 --- a/frontend/src/components/SideMenu.js +++ b/frontend/src/components/SideMenu.js @@ -18,6 +18,7 @@ const SideMenu = ({ active, onSelect }) => {
Администрирование
diff --git a/frontend/src/pages/Dashboard.js b/frontend/src/pages/Dashboard.js index 5009d90..7473564 100644 --- a/frontend/src/pages/Dashboard.js +++ b/frontend/src/pages/Dashboard.js @@ -3,6 +3,7 @@ import SideMenu from '../components/SideMenu'; import Header from '../components/Header'; import { useUser } from '../context/UserContext'; import UsersPage from './UsersPage'; +import RolesPage from './RolesPage'; import SmtpServersPage from './SmtpServersPage'; import EmailTemplatesPage from './EmailTemplatesPage'; import UnsubscribedPage from './UnsubscribedPage'; @@ -22,6 +23,7 @@ const Dashboard = () => { function renderPage() { switch (active) { case 'users': return ; + case 'roles': return ; case 'smtp': return ; case 'template': return ; case 'unsubscribed': return ;