diff --git a/.git-hooks/commit-msg b/.git-hooks/commit-msg new file mode 100644 index 000000000..4153db065 --- /dev/null +++ b/.git-hooks/commit-msg @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +npm run commitlint --edit ${1} diff --git a/.git-hooks/pre-commit b/.git-hooks/pre-commit new file mode 100644 index 000000000..4cd742445 --- /dev/null +++ b/.git-hooks/pre-commit @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +npm run lint-staged diff --git a/.gitignore b/.gitignore index e640f71e5..40e57bb99 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ env/ /src/front/public/Tiles/ /src/front/node_modules/ .vscode/ -node_modules +/docs/.vitepress/cache +/node_modules/ \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 13566b81b..000000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml -# Editor-based HTTP Client requests -/httpRequests/ -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/.idea/PORTAL_COD2.iml b/.idea/PORTAL_COD2.iml deleted file mode 100644 index d0cfc6662..000000000 --- a/.idea/PORTAL_COD2.iml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 105ce2da2..000000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 299d3e63c..000000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 3c9d72df7..000000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 35eb1ddfb..000000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 000000000..599632e71 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,7 @@ +{ + "singleQuote": true, + "semi": true, + "printWidth": 100, + "trailingComma": "all", + "endOfLine": "auto" + } \ No newline at end of file diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 000000000..3a728de39 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1,36 @@ +export default { + rules: { + 'header-max-length': [2, 'always', 72], // Максимальная длина заголовка + + 'jira-issue': [2, 'always'], // Правило для проверки номера задачи + }, + plugins: [ + { + rules: { + 'jira-issue': ({ header }) => { + const jiraIssuePattern = + /^(feat|fix|docs|style|refactor|perf|test|chore)\s+\[([A-Z]+-\d+)\]:\s+(.+)/; + const match = header.match(jiraIssuePattern); + + if (!match) { + return [ + false, + `Заголовок должен содержать тип, номер задачи и название коммита. Формат: <тип> [<номер задачи>]: <название> + 'feat' - Новый функционал + 'fix' - Исправление ошибки + 'docs' - Изменения в документации + 'style' - Изменения, не влияющие на функциональность + 'refactor' - Изменения кода, не исправляющие ошибки и не добавляющие функционал + 'perf' - Изменения, улучшающие производительность + 'test' - Добавление тестов + 'chore' - Изменения в процессе сборки или вспомогательных инструментах. + + Например: feat [X-01]: я тут накоммитил`, + ]; + } + return [true]; + }, + }, + }, + ], +}; diff --git a/docs/.vitepress/config.mjs b/docs/.vitepress/config.mjs new file mode 100644 index 000000000..1ae0961fd --- /dev/null +++ b/docs/.vitepress/config.mjs @@ -0,0 +1,686 @@ +import { withMermaid } from 'vitepress-plugin-mermaid'; + +export default withMermaid({ + themeConfig: { + search: { + provider: 'local' + }, + sidebar: [ + { + text: 'Структура', + collapsed: false, + items: [ + { + "text": "App", + "link": "/src/App" + }, + { + "text": "components", + "collapsed": true, + "items": [ + { + "text": "about_inspection", + "collapsed": true, + "items": [ + { + "text": "contacts", + "collapsed": true, + "items": [ + { + "text": "ContactInfo", + "link": "/src/components\\about_inspection\\contacts\\ContactInfo" + } + ] + }, + { + "text": "general_information", + "collapsed": true, + "items": [ + { + "text": "GeneralInformation", + "link": "/src/components\\about_inspection\\general_information\\GeneralInformation" + }, + { + "text": "GeneralInformationSize", + "link": "/src/components\\about_inspection\\general_information\\GeneralInformationSize" + } + ] + }, + { + "text": "open_vacancies", + "collapsed": true, + "items": [ + { + "text": "OpenVacancies", + "link": "/src/components\\about_inspection\\open_vacancies\\OpenVacancies" + }, + { + "text": "ResponseVacancies", + "link": "/src/components\\about_inspection\\open_vacancies\\ResponseVacancies" + } + ] + }, + { + "text": "structure", + "collapsed": true, + "items": [ + { + "text": "StructureInspection", + "link": "/src/components\\about_inspection\\structure\\StructureInspection" + }, + { + "text": "StructureInspectionRow", + "link": "/src/components\\about_inspection\\structure\\StructureInspectionRow" + } + ] + } + ] + }, + { + "text": "calendar_of_events", + "collapsed": true, + "items": [ + { + "text": "BigCalendar", + "link": "/src/components\\calendar_of_events\\BigCalendar" + }, + { + "text": "calendar-create-select", + "link": "/src/components\\calendar_of_events\\calendar-create-select" + }, + { + "text": "calendar-create", + "link": "/src/components\\calendar_of_events\\calendar-create" + }, + { + "text": "calendar-my", + "link": "/src/components\\calendar_of_events\\calendar-my" + }, + { + "text": "event-calendar", + "link": "/src/components\\calendar_of_events\\event-calendar" + }, + { + "text": "event-create", + "link": "/src/components\\calendar_of_events\\event-create" + }, + { + "text": "event-dialog-edit-participant", + "link": "/src/components\\calendar_of_events\\event-dialog-edit-participant" + }, + { + "text": "event-dialog-edit", + "link": "/src/components\\calendar_of_events\\event-dialog-edit" + }, + { + "text": "event-dialog-info", + "link": "/src/components\\calendar_of_events\\event-dialog-info" + }, + { + "text": "event-dialog", + "link": "/src/components\\calendar_of_events\\event-dialog" + }, + { + "text": "load-ical", + "link": "/src/components\\calendar_of_events\\load-ical" + }, + { + "text": "load-ical1", + "link": "/src/components\\calendar_of_events\\load-ical1" + }, + { + "text": "UI_calendar", + "collapsed": true, + "items": [ + { + "text": "calendarFull", + "link": "/src/components\\calendar_of_events\\UI_calendar\\calendarFull" + }, + { + "text": "dialogCreate", + "link": "/src/components\\calendar_of_events\\UI_calendar\\dialogCreate" + }, + { + "text": "periodEvents", + "link": "/src/components\\calendar_of_events\\UI_calendar\\periodEvents" + }, + { + "text": "reminderEvent", + "link": "/src/components\\calendar_of_events\\UI_calendar\\reminderEvent" + }, + { + "text": "timeSelect", + "link": "/src/components\\calendar_of_events\\UI_calendar\\timeSelect" + } + ] + } + ] + }, + { + "text": "cardLike", + "link": "/src/components\\cardLike" + }, + { + "text": "carousel-list", + "link": "/src/components\\carousel-list" + }, + { + "text": "carousel-numbers", + "link": "/src/components\\carousel-numbers" + }, + { + "text": "CountDown", + "link": "/src/components\\CountDown" + }, + { + "text": "dialog-search", + "link": "/src/components\\dialog-search" + }, + { + "text": "digital-letna", + "link": "/src/components\\digital-letna" + }, + { + "text": "graph", + "collapsed": true, + "items": [ + { + "text": "line-graph", + "link": "/src/components\\graph\\line-graph" + } + ] + }, + { + "text": "load-round", + "link": "/src/components\\load-round" + }, + { + "text": "news-crossroad", + "link": "/src/components\\news-crossroad" + }, + { + "text": "news-full", + "link": "/src/components\\news-full" + }, + { + "text": "news-home", + "link": "/src/components\\news-home" + }, + { + "text": "secret", + "collapsed": true, + "items": [ + { + "text": "SmallTimer", + "link": "/src/components\\secret\\SmallTimer" + } + ] + }, + { + "text": "testing", + "collapsed": true, + "items": [ + { + "text": "CatalogTest", + "link": "/src/components\\testing\\CatalogTest" + }, + { + "text": "DetailCardTest", + "link": "/src/components\\testing\\DetailCardTest" + }, + { + "text": "HeaderDetailTesting", + "link": "/src/components\\testing\\HeaderDetailTesting" + } + ] + }, + { + "text": "tests", + "collapsed": true, + "items": [ + { + "text": "TestCard", + "link": "/src/components\\tests\\TestCard" + } + ] + }, + { + "text": "UI", + "collapsed": true, + "items": [ + { + "text": "aboutportal", + "collapsed": true, + "items": [ + { + "text": "card-feedback", + "link": "/src/components\\UI\\aboutportal\\card-feedback" + }, + { + "text": "card-top-comment", + "link": "/src/components\\UI\\aboutportal\\card-top-comment" + }, + { + "text": "card-total", + "link": "/src/components\\UI\\aboutportal\\card-total" + }, + { + "text": "card_top_comment", + "collapsed": true, + "items": [ + { + "text": "card-comment", + "link": "/src/components\\UI\\aboutportal\\card_top_comment\\card-comment" + } + ] + }, + { + "text": "feedmodul", + "link": "/src/components\\UI\\aboutportal\\feedmodul" + }, + { + "text": "line-chart", + "link": "/src/components\\UI\\aboutportal\\line-chart" + }, + { + "text": "pattern-card-feed", + "link": "/src/components\\UI\\aboutportal\\pattern-card-feed" + }, + { + "text": "pattern-card", + "link": "/src/components\\UI\\aboutportal\\pattern-card" + }, + { + "text": "portal-traffic", + "link": "/src/components\\UI\\aboutportal\\portal-traffic" + }, + { + "text": "rating-page", + "link": "/src/components\\UI\\aboutportal\\rating-page" + }, + { + "text": "toolbar-filter", + "link": "/src/components\\UI\\aboutportal\\toolbar-filter" + }, + { + "text": "tooltip-ico", + "link": "/src/components\\UI\\aboutportal\\tooltip-ico" + }, + { + "text": "tooltip-user", + "link": "/src/components\\UI\\aboutportal\\tooltip-user" + }, + { + "text": "top-user", + "link": "/src/components\\UI\\aboutportal\\top-user" + } + ] + }, + { + "text": "Auth-form", + "link": "/src/components\\UI\\Auth-form" + }, + { + "text": "date-select", + "link": "/src/components\\UI\\date-select" + }, + { + "text": "defaultportal", + "collapsed": true, + "items": [ + { + "text": "page-counter", + "link": "/src/components\\UI\\defaultportal\\page-counter" + }, + { + "text": "uploading-file", + "link": "/src/components\\UI\\defaultportal\\uploading-file" + } + ] + }, + { + "text": "feedback", + "collapsed": true, + "items": [ + { + "text": "feedstar-like", + "link": "/src/components\\UI\\feedback\\feedstar-like" + }, + { + "text": "statistik-like", + "link": "/src/components\\UI\\feedback\\statistik-like" + } + ] + }, + { + "text": "fiousercard", + "collapsed": true, + "items": [ + { + "text": "icoUser", + "link": "/src/components\\UI\\fiousercard\\icoUser" + }, + { + "text": "infoUserCard", + "link": "/src/components\\UI\\fiousercard\\infoUserCard" + }, + { + "text": "listUser", + "link": "/src/components\\UI\\fiousercard\\listUser" + }, + { + "text": "onlineUsers", + "link": "/src/components\\UI\\fiousercard\\onlineUsers" + }, + { + "text": "vcardUser", + "link": "/src/components\\UI\\fiousercard\\vcardUser" + } + ] + }, + { + "text": "index", + "link": "/src/components\\UI\\index" + }, + { + "text": "my-helper", + "link": "/src/components\\UI\\my-helper" + }, + { + "text": "NewsCard", + "link": "/src/components\\UI\\NewsCard" + }, + { + "text": "PatternTabs", + "link": "/src/components\\UI\\PatternTabs" + }, + { + "text": "Timer", + "link": "/src/components\\UI\\Timer" + }, + { + "text": "tooltip-number", + "link": "/src/components\\UI\\tooltip-number" + }, + { + "text": "tooltip-text", + "link": "/src/components\\UI\\tooltip-text" + } + ] + }, + { + "text": "vote", + "collapsed": true, + "items": [ + { + "text": "CurrentVote", + "link": "/src/components\\vote\\CurrentVote" + }, + { + "text": "NoneVote", + "link": "/src/components\\vote\\NoneVote" + }, + { + "text": "NonVoteHappy", + "link": "/src/components\\vote\\NonVoteHappy" + }, + { + "text": "NonVoteSad", + "link": "/src/components\\vote\\NonVoteSad" + }, + { + "text": "VoteAdmin", + "link": "/src/components\\vote\\VoteAdmin" + }, + { + "text": "VoteAnimation", + "link": "/src/components\\vote\\VoteAnimation" + }, + { + "text": "VoteCard", + "link": "/src/components\\vote\\VoteCard" + }, + { + "text": "VoteConstructor", + "link": "/src/components\\vote\\VoteConstructor" + }, + { + "text": "VoteForm", + "link": "/src/components\\vote\\VoteForm" + }, + { + "text": "VoteResult", + "link": "/src/components\\vote\\VoteResult" + } + ] + } + ] + }, + { + "text": "layouts", + "collapsed": true, + "items": [ + { + "text": "default", + "collapsed": true, + "items": [ + { + "text": "AdminMenu", + "link": "/src/layouts\\default\\AdminMenu" + }, + { + "text": "alertDefault", + "link": "/src/layouts\\default\\alertDefault" + }, + { + "text": "DefaultPortal", + "link": "/src/layouts\\default\\DefaultPortal" + } + ] + } + ] + }, + { + "text": "main", + "link": "/src/main" + }, + { + "text": "plugins", + "collapsed": true, + "items": [ + { + "text": "index", + "link": "/src/plugins\\index" + }, + { + "text": "vuetify", + "link": "/src/plugins\\vuetify" + }, + { + "text": "webfontloader", + "link": "/src/plugins\\webfontloader" + } + ] + }, + { + "text": "router", + "collapsed": true, + "items": [ + { + "text": "index", + "link": "/src/router\\index" + } + ] + }, + { + "text": "store", + "collapsed": true, + "items": [ + { + "text": "AboutPortalFilter", + "link": "/src/store\\AboutPortalFilter" + }, + { + "text": "AccountStore", + "link": "/src/store\\AccountStore" + }, + { + "text": "app", + "link": "/src/store\\app" + }, + { + "text": "index", + "link": "/src/store\\index" + }, + { + "text": "MainmenuStore", + "link": "/src/store\\MainmenuStore" + }, + { + "text": "UseAlertStore", + "link": "/src/store\\UseAlertStore" + }, + { + "text": "WeekendsStore", + "link": "/src/store\\WeekendsStore" + } + ] + }, + { + "text": "utils", + "collapsed": true, + "items": [ + { + "text": "axios-api", + "link": "/src/utils\\axios-api" + }, + { + "text": "universal_functions", + "link": "/src/utils\\universal_functions" + } + ] + }, + { + "text": "views", + "collapsed": true, + "items": [ + { + "text": "AboutInspectionPage", + "link": "/src/views\\AboutInspectionPage" + }, + { + "text": "AboutPortalPage", + "link": "/src/views\\AboutPortalPage" + }, + { + "text": "FAQPage", + "link": "/src/views\\FAQPage" + }, + { + "text": "FeedbackPage", + "link": "/src/views\\FeedbackPage" + }, + { + "text": "FnsHol", + "link": "/src/views\\FnsHol" + }, + { + "text": "HomePage", + "link": "/src/views\\HomePage" + }, + { + "text": "LaborProtection", + "link": "/src/views\\LaborProtection" + }, + { + "text": "nested_view", + "collapsed": true, + "items": [ + { + "text": "o_OKiB", + "link": "/src/views\\nested_view\\o_OKiB" + } + ] + }, + { + "text": "NewsPage", + "link": "/src/views\\NewsPage" + }, + { + "text": "ProvidingActivitiesPage", + "link": "/src/views\\ProvidingActivitiesPage" + }, + { + "text": "safety", + "collapsed": true, + "items": [ + { + "text": "ChaptersSafety", + "link": "/src/views\\safety\\ChaptersSafety" + }, + { + "text": "DocumentationSafety", + "link": "/src/views\\safety\\DocumentationSafety" + }, + { + "text": "MainInfoSafety", + "link": "/src/views\\safety\\MainInfoSafety" + }, + { + "text": "TestSafety", + "link": "/src/views\\safety\\TestSafety" + } + ] + }, + { + "text": "secret", + "collapsed": true, + "items": [ + { + "text": "SecretPage", + "link": "/src/views\\secret\\SecretPage" + } + ] + }, + { + "text": "SecurityPage", + "link": "/src/views\\SecurityPage" + }, + { + "text": "StructurePage", + "link": "/src/views\\StructurePage" + }, + { + "text": "TestHomePage", + "link": "/src/views\\TestHomePage" + }, + { + "text": "Vote", + "link": "/src/views\\Vote" + }, + { + "text": "VoteHomePage", + "link": "/src/views\\VoteHomePage" + } + ] + } +] + }, + { + text: 'Гайды', + collapsed: true, + items: [ + { text: 'Как установить', link: '/guides/install' }, + { text: 'Как использовать', link: '/guides/usage' }, + { text: 'Правила комитов', link: '/guides/commits' } + ] + } + ] + }, +mermaid: { + // refer https://mermaid.js.org/config/setup/modules/mermaidAPI.html#mermaidapi-configuration-defaults for options + }, + // optionally set additional config for plugin itself with MermaidPluginConfig + mermaidPlugin: { + class: 'mermaid my-class', // set additional css classes for parent container + },}); diff --git a/docs/.vitepress/theme/components/TestRunner.vue b/docs/.vitepress/theme/components/TestRunner.vue new file mode 100644 index 000000000..da702d4ec --- /dev/null +++ b/docs/.vitepress/theme/components/TestRunner.vue @@ -0,0 +1,181 @@ + + + + + diff --git a/docs/.vitepress/theme/index.js b/docs/.vitepress/theme/index.js new file mode 100644 index 000000000..66163ce60 --- /dev/null +++ b/docs/.vitepress/theme/index.js @@ -0,0 +1,19 @@ +import DefaultTheme from 'vitepress/theme'; +import { withMermaid } from 'vitepress-plugin-mermaid'; +import TestRunner from './components/TestRunner.vue'; + +export default withMermaid({ + ...DefaultTheme, + themeConfig: { + search: { + provider: 'local', + }, + }, + mermaid: {}, + mermaidPlugin: { + class: 'mermaid my-class', + }, + enhanceApp({ app }) { + app.component('TestRunner', TestRunner); + }, +}); diff --git a/docs/README.md b/docs/README.md index e69de29bb..1b416ef02 100644 --- a/docs/README.md +++ b/docs/README.md @@ -0,0 +1,114 @@ +# IS#26 Портал ЦОД-2 + +[Общие работы по проекту](/COD2/PORTAL_COD2/projects/22) + + +Prod Portal9966/ (10.252.44.28) +Test Potal-t/ (10.252.44.60) + +## Стэк ## +1. Python 3.10 +2. Vuetify3 +3. MySQL +4. Redis + +## Особенности веток ## +У разработчиков у каждого своя ветка. + +npm version patch производится на ветке razrab + +окончательная сборка - на main +## Схема ## + + + +```mermaid +flowchart TD +A[Клиент] <-->|Запрос к серверу PORTAL9966/ или PORTAL-t/| B{Nginx:80} + B <-->|Фронт /| C[Vuetify 3
/var/www/PORTAL_COD2/src/front/dist] + B <-->|бэк
/api
/admin
/ws| D{Daphne :9966} + D<--> |/ws| E[Django channels] + E<-->F[Redis :6379] + D<-->|Admin|G{Django} + G<-->|10.252.44.13:8005|H[Авторизация FAST API сервер] + H<-->J[Active Directory] + G<-->|10.252.44.33:3306|I[MySQL
БД Справочник] + B<-->|/static
/media|K[Файлы
/var/www/PORTAL_COD2/src/media
/var/www/PORTAL_COD2/src/static/ ] +``` + +## Установка и настройка ## + +### Первоначальная установка после клонирования в папку. В случае неисправностей, идти примерно по этому же пути ### + +Инициализация проекта: + +- Инициализировать git +- Выполнить git clone + +1. В каталоге проекта Создаем окружение + +``` python3.10 -m venv env ``` + +2. Активируем окружение + +``` source env/bin/activate``` + +3. устанавливаем необходимые пакеты + +``` cd sys ``` +```pip install -r r.txt --proxy= http://...``` + +Если нет proxy: + +На машине разработки выполнить команду ```pip download -r ../r.txt``` + +Команда для установки python +```pip install --no-index --find-links /Путь_К_Папке_С_Пакетами/ -r r.txt``` + +Запушить изменения в ветку + +Синхронизировать ветку на сервере + +``` git pull ``` + +Если произошла ошибка: ``` git reset --hard ``` + +4. переходим в каталог src + +``` cd ../src/``` + +5. В каталог src разархивируем portal.zip из sys + Прописываем подключения в settings.py + + +6. Для проверки запускаем сервер разработки + +```python manage.py runserver``` + +Если в консоли не появляются ошибки и сервер стартует, переходим далее. В противном случае - доустанавливаем необходимые пакеты. + + 7. останавливаем сервер разработки (CTRL+C) + +На этом работы непосредственно с бэкэндом завершены +### Порты ### + Daphne: 9966 + +### Настройка NGINX, GUNICORN, Vuetify, Daphne ### + В каталоге sys расположены примерные файлы конфигов для тестового и боевого серверов + + Тестовый сервер: /sys/test_server + +При копировании убедиться, что пути соответствуют системе + #### NGINX Vuetify #### + Стандартный путь для файлов .conf + /etc/nginx/sites-enabled + + +#### Daphne #### +Файлы .service кладем в каталог /etc/systemd/system + +Проверяем путь виртуального окружения и порт в файле на соответствие с конфигурацией Nginx + +#### Запуск сервера #### +Запускаем Daphne ``` Start portaldaphne ``` +Перезагружаем Nginx ``` Restart nginx ``` \ No newline at end of file diff --git a/docs/api-examples.md b/docs/api-examples.md new file mode 100644 index 000000000..6bd8bb5c1 --- /dev/null +++ b/docs/api-examples.md @@ -0,0 +1,49 @@ +--- +outline: deep +--- + +# Runtime API Examples + +This page demonstrates usage of some of the runtime APIs provided by VitePress. + +The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files: + +```md + + +## Results + +### Theme Data +
{{ theme }}
+ +### Page Data +
{{ page }}
+ +### Page Frontmatter +
{{ frontmatter }}
+``` + + + +## Results + +### Theme Data +
{{ theme }}
+ +### Page Data +
{{ page }}
+ +### Page Frontmatter +
{{ frontmatter }}
+ +## More + +Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata). diff --git a/docs/guides/commits.md b/docs/guides/commits.md new file mode 100644 index 000000000..68716ce05 --- /dev/null +++ b/docs/guides/commits.md @@ -0,0 +1,21 @@ + + ## Заголовок должен содержать тип, номер задачи и название коммита. + Формат: <тип> [<номер задачи>]: <название> + + | Название | Описание | + |----------|----------| + | `feat` | Новый функционал | + | `fix` | Исправление ошибки | + | `docs` | Изменения в документации | + | `style` | Изменения, не влияющие на функциональность | + | `refactor` | Изменения кода, не исправляющие ошибки и не добавляющие функционал | + | `perf` | Изменения, улучшающие производительность | + | `test` | Добавление тестов | + | `chore` | Изменения в процессе сборки или вспомогательных инструментах. | + + Пример: + +```bash +feat [X-01]: я тут накоммитил +``` + \ No newline at end of file diff --git a/docs/guides/install.md b/docs/guides/install.md new file mode 100644 index 000000000..8cbc6a73a --- /dev/null +++ b/docs/guides/install.md @@ -0,0 +1,64 @@ + + # Установка документации + +## Установка VitePress + +Для начала необходимо установить VitePress: + +```bash +npm add -D vitepress +``` + +## Инициализируем проект: + +```bash +npx vitepress init +``` + +#### Во время инициализации вам будет предложено выбрать конфигурацию: + +```txt +┌ Welcome to VitePress! +│ +◇ Where should VitePress initialize the config? +│ ./docs +│ +◇ Site title: +│ Наименование проекта +│ +◇ Site description: +│ Описание проекта +│ +◆ Theme: +│ ● Default Theme (Out of the box, good-looking docs) +│ ○ Default Theme + Customization +│ ○ Custom Theme +└ +``` + +## Установка vue-md-parser + +#### Далее необходимо установить vue-md-parser: + +```bash +npm install -g vue-md-parser +``` + +## Настройка скриптов + +#### Откройте package.json и измените скрипт для разработки документации: + +```json +"scripts": { +"docs:dev": "vue-md-parser && vitepress dev docs" +} +``` + +## Запуск сервера + +```bash +npm run docs:dev +``` + +## Сервер будет доступен на http://localhost:5173/ + \ No newline at end of file diff --git a/docs/guides/usage.md b/docs/guides/usage.md new file mode 100644 index 000000000..686dd677a --- /dev/null +++ b/docs/guides/usage.md @@ -0,0 +1,236 @@ + +# Использование документации + +## Добавление комментариев для генерации документации + +### Описание компонента + +Описание компонента должно быть указано первым комментарием в теге ` \ No newline at end of file diff --git a/src/front/src/components/testing/HeaderDetailTesting.vue b/src/front/src/components/testing/HeaderDetailTesting.vue new file mode 100644 index 000000000..b580f6ea4 --- /dev/null +++ b/src/front/src/components/testing/HeaderDetailTesting.vue @@ -0,0 +1,43 @@ + + + \ No newline at end of file diff --git a/src/front/src/components/vote/VoteConstructor.vue b/src/front/src/components/vote/VoteConstructor.vue index 78caae4de..1971abdbd 100644 --- a/src/front/src/components/vote/VoteConstructor.vue +++ b/src/front/src/components/vote/VoteConstructor.vue @@ -43,6 +43,14 @@
+
Публикация новости: +
Дата и время:
@@ -360,6 +368,7 @@ export default { startDate: new Date(), endDate: new Date(new Date().setDate(new Date().getDate() + 14)), questions: [], + createnews:false }); const rules = { diff --git a/src/front/src/router/index.js b/src/front/src/router/index.js index 41ff8d488..ddf603cc8 100644 --- a/src/front/src/router/index.js +++ b/src/front/src/router/index.js @@ -177,6 +177,12 @@ const routes = [ ico: "mdi-account", }, }, + { + path: "/test/testdetail/:id", + name: "TestDetail", + component: () => + import("@/components/testing/DetailCardTest.vue") + }, { path: '/secret', name: 'Secret Page', diff --git a/src/front/src/utils/axios-api.js b/src/front/src/utils/axios-api.js index 15cc0729a..fee398ae8 100644 --- a/src/front/src/utils/axios-api.js +++ b/src/front/src/utils/axios-api.js @@ -1,32 +1,39 @@ -import {useAccountStore} from '@/store/AccountStore' -import axios from "axios"; +import { useAccountStore } from '@/store/AccountStore'; +import axios from 'axios'; -const spravURL = 'http://10.252.44.33/accounting6/images/photo/' -const spravURLBase = 'http://10.252.44.33/accounting6/' -const baseURL = process.env.NODE_ENV === 'development' ? 'http://127.0.0.1:8000/' : `http://${window.location.host}/`; -const baseWS = process.env.NODE_ENV === 'development' ? 'ws://127.0.0.1:8000/' : `ws://${window.location.host}/`; +const spravURL = 'http://10.252.44.33/accounting6/images/photo/'; +const spravURLBase = 'http://10.252.44.33/accounting6/'; +const baseURL = + process.env.NODE_ENV === 'development' + ? 'http://127.0.0.1:8000/' + : `http://${window.location.host}/`; +const baseWS = + process.env.NODE_ENV === 'development' ? 'ws://127.0.0.1:8000/' : `ws://${window.location.host}/`; // const baseURL = process.env.NODE_ENV == 'development'? 'http://127.0.0.1:8000/': `http://10.252.44.60:9965/`; // const baseWS = process.env.NODE_ENV == 'development'? 'ws://127.0.0.1:8000/': `ws://10.252.44.60:9966/`; // для релизного меняем 'http://ukd/' // const baseURL = 'http://127.0.0.1:8000/'; async function refreshToken() { - const refresh = localStorage.getItem('refresh'); try { - const result = await axios.post('/api/accounts/token/refresh/', {refresh}, { - baseURL - }) + const result = await axios.post( + '/api/accounts/token/refresh/', + { refresh }, + { + baseURL, + }, + ); if (result.config.data) localStorage.setItem('refresh', JSON.parse(result.config.data).refresh); - localStorage.setItem('access', result.data.access) + localStorage.setItem('access', result.data.access); return result.data.access; } catch (e) { - const accountStore = useAccountStore() - accountStore.logout() - accountStore.cod2user.value = false + const accountStore = useAccountStore(); + accountStore.logout(); + accountStore.cod2user.value = false; return Promise.reject(e); } @@ -40,32 +47,36 @@ const clearAxios = axios.create({ baseURL, }); -axiosApiInstance.defaults.headers.common['Authorization'] = `Bearer ${localStorage.getItem('access')}` +axiosApiInstance.defaults.headers.common['Authorization'] = + `Bearer ${localStorage.getItem('access')}`; -axiosApiInstance.interceptors.request.use(config => { - const access = localStorage.getItem('access'); - if (access) { - config.headers = { - 'Authorization': `Bearer ${access}`, +axiosApiInstance.interceptors.request.use( + (config) => { + const access = localStorage.getItem('access'); + if (access) { + config.headers = { + Authorization: `Bearer ${access}`, + }; } - } - return config; -}, error => { - return Promise.reject(error); -}) + return config; + }, + (error) => { + return Promise.reject(error); + }, +); axiosApiInstance.interceptors.response.use( - response => { + (response) => { return response; }, - async error => { - + async (error) => { const originalRequest = error.config; - if ((error.response.status === 401 || error.response.status === 403) && !originalRequest._retry) { - + if ( + (error.response.status === 401 || error.response.status === 403) && + !originalRequest._retry + ) { originalRequest._retry = true; try { - const token = await refreshToken(); axiosApiInstance.defaults.headers.common['Authorization'] = `Bearer ${token}`; @@ -75,64 +86,54 @@ axiosApiInstance.interceptors.response.use( } return axiosApiInstance(originalRequest); - } catch (e) { - return Promise.reject(error); + return Promise.reject(error) ?? e; } } return Promise.reject(error); - }) + }, +); async function getVotes(status) { try { const response = await axiosApiInstance.get(`/api/vote/getvotes?status=${status}`); return response.data; } catch (error) { - console.error('Ошибка запроса голосования:', error); - throw error; + throw new Error('Ошибка запроса голосования:', error); } } async function createVote(voteData) { - try { - const formData = new FormData(); - voteData.questions.forEach(question => { - formData.append('questionsfiles', question.image) - if(!!question.image){ - const {name,size,lastModified}=question.image - question.image={name,size,lastModified} + voteData.questions.forEach((question) => { + formData.append('questionsfiles', question.image); + if (question.image) { + const { name, size, lastModified } = question.image; + question.image = { name, size, lastModified }; + } + + question.answers.forEach((answer) => { + formData.append('answersfiles', answer.image); + if (answer.image) { + const { name, size, lastModified } = answer.image; + answer.image = { name, size, lastModified }; } - - question.answers.forEach(answer=>{ - - formData.append('answersfiles', answer.image) - if(!!answer.image){ - const {name,size,lastModified}=answer.image - answer.image={name,size,lastModified} - } - - }) + }); }); - - + formData.append('news', voteData.createnews); formData.append('title', voteData.title); formData.append('description', voteData.description); formData.append('startDate', new Date(voteData.startDate).toISOString()); formData.append('endDate', new Date(voteData.endDate).toISOString()); formData.append('questions', JSON.stringify(voteData.questions)); - - const response = await axiosApiInstance.post('/api/vote/votecreate/', formData, { - headers: {'Content-Type': 'multipart/form-data'}, + await axiosApiInstance.post('/api/vote/votecreate/', formData, { + headers: { 'Content-Type': 'multipart/form-data' }, }); - - // return response.data; } catch (error) { - console.error('Ошибка создания голосования:', error); - throw error; + throw new Error(error); } } @@ -141,8 +142,7 @@ async function getVoteDetail(id) { const response = await axiosApiInstance.get(`/api/vote/votedetail/${id}/`); return response.data; } catch (error) { - console.error("Ошибка получения деталей голосования:", error); - throw error; + throw new Error(error); } } @@ -169,10 +169,8 @@ async function getVoteDetail(id) { async function deleteVote(id) { try { await axiosApiInstance.delete(`/api/vote/votedetail/${id}/`); - console.log("Голосование успешно удалено"); } catch (error) { - console.error("Ошибка удаления голосования:", error); - throw error; + throw new Error(error); } } @@ -181,8 +179,7 @@ async function getEmployees() { const response = await axiosApiInstance.get(`api/vote/getdictemployee/`); return response.data; } catch (error) { - console.error("Ошибка получения всех сотрудников:", error); - throw error; + throw new Error(error); } } @@ -191,12 +188,10 @@ async function getVoteResult(id) { const response = await axiosApiInstance.get(`/api/vote/getresults/?id=${id}`); return response.data; } catch (error) { - console.error("Ошибка получения результата голосования:", error); - throw error; + throw new Error(error); } } - export { axiosApiInstance, clearAxios, @@ -212,4 +207,4 @@ export { deleteVote, getEmployees, getVoteResult, -} +}; diff --git a/src/front/src/views/FAQPage.vue b/src/front/src/views/FAQPage.vue index 5de55d97c..fa2bd8ecc 100644 --- a/src/front/src/views/FAQPage.vue +++ b/src/front/src/views/FAQPage.vue @@ -1,26 +1,21 @@ - \ No newline at end of file + diff --git a/src/front/src/views/FnsHol.vue b/src/front/src/views/FnsHol.vue index 76cab92da..7dae82c79 100644 --- a/src/front/src/views/FnsHol.vue +++ b/src/front/src/views/FnsHol.vue @@ -1,160 +1,98 @@ - - - +import { ref, computed } from 'vue'; - /> - - - +import { baseURL } from '@/utils/axios-api'; +import { axiosApiInstance } from '@/utils/axios-api'; - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + const carushi = computed(() => { + return window.innerHeight - 50; + }); + + return { burl, carous, carushi }; + }, +}; + + + diff --git a/src/front/src/views/TestHomePage.vue b/src/front/src/views/TestHomePage.vue index 235971cb2..230bdc4df 100644 --- a/src/front/src/views/TestHomePage.vue +++ b/src/front/src/views/TestHomePage.vue @@ -1,223 +1,100 @@ - - diff --git a/src/front/src/views/Vote.vue b/src/front/src/views/Vote.vue index e7add4183..28cf2c4ab 100644 --- a/src/front/src/views/Vote.vue +++ b/src/front/src/views/Vote.vue @@ -19,6 +19,8 @@
+ +

ВЫ УЖЕ ПРОГОЛОСОВАЛИ.

СПАСИБО!

diff --git a/src/front/src/views/secret/SecretPage.vue b/src/front/src/views/secret/SecretPage.vue index 88347628f..c305349eb 100644 --- a/src/front/src/views/secret/SecretPage.vue +++ b/src/front/src/views/secret/SecretPage.vue @@ -20,11 +20,12 @@ + diff --git a/sys/hooks/commit-msg b/sys/hooks/commit-msg new file mode 100644 index 000000000..4153db065 --- /dev/null +++ b/sys/hooks/commit-msg @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +npm run commitlint --edit ${1} diff --git a/sys/hooks/pre-commit b/sys/hooks/pre-commit new file mode 100644 index 000000000..4cd742445 --- /dev/null +++ b/sys/hooks/pre-commit @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +npm run lint-staged