The server part of the service and API. It works in multithreaded mode. The application registers and authorizes users. The application turns to the MySQL server and provides information about organizations and projects. It encodes the information and outputs it as a QR code.
The directory source/
must be created in the root directory.
It should contain a file sql_settings.txt
.
Each line of the file contains one element for connecting to the MySQL server.
File structure:
- ip DB
- username
- password
- port DB
Fix the file ServerSettings.h
to change names of endpoints and the number of threads used.
By default, 4 threads are used.
Fix the file or use std::thread::hardware_concurrency()
.
MySQL server uses two databases. The first one is for storing user data. And the second for storing organizations' data. See the addendum.
Project DataQR-API is distributed under the MIT license.
Серверная часть сервиса и API, работает в многопоточном режиме. Сервер отвечает за регистрацию и авторизацию пользователей. Через обращение к MySQL серверу выдаёт необходимую информацию по организациям и проектам. Производит кодирование информации и выдачу её в виде QR-кода.
В корневой директории необходимо создать каталог source/
.
Он должен содержать файл sql_settings.txt
, где на каждой строке будет указано по одному элементу для подключения к MySQL серверу.
Структура файла:
- ip адрес БД
- имя пользователя
- пароль
- порт БД
Названия эндпоинтов и количество используемых потоков можно изменить в файле ServerSettings.h
.
По умолчанию используется 4 потока, исправьте, или используйте метод std::thread::hardware_concurrency()
.
MySQL сервер использует две БД: одну для хранения данных пользователей, а вторую для хранения данных организаций. См. дополнение.
Проект DataQR-API распространяется под лицензией MIT.
Таблица с данными пользователей / The table with user data:
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
id | int(11) | NO | PRI | NULL | auto_increment |
varchar(30) | NO | UNI | NULL | ||
password | varchar(32) | NO | NULL | ||
name | varchar(30) | NO | NULL | ||
access | int(11) | NO | 3 | ||
reg_date | datetime | YES | CURRENT_TIMESTAMP |
Таблица Refresh-токенов / Refresh-tokens table:
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
auth_id | int(11) | NO | PRI | NULL | auto_increment |
varchar(30) | YES | UNI | NULL | ||
refresh | varchar(69) | YES | NULL | ||
auth_reg_date | datetime | YES | CURRENT_TIMESTAMP |
Таблица со списком организаций / The table with a list of organizations:
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
org_id | int(11) | NO | PRI | NULL | auto_increment |
org_name | varchar(30) | YES | UNI | NULL |