Запил документации: API и настройка БД
This commit is contained in:
parent
d30c4f011d
commit
acede7d03b
5
TODO.md
5
TODO.md
@ -2,8 +2,10 @@
|
|||||||
|
|
||||||
- Фронт
|
- Фронт
|
||||||
- Админ-панель
|
- Админ-панель
|
||||||
|
- Детальная стата по инстансу
|
||||||
- Демонстрация наполнения и управление БД
|
- Демонстрация наполнения и управление БД
|
||||||
- Статистика по инстансу
|
- "Большая Красная Кнопка"
|
||||||
|
- Общая статистика по инстансу
|
||||||
- Главная страница
|
- Главная страница
|
||||||
- Страница регистрации
|
- Страница регистрации
|
||||||
- Страница с отображением поста-картинки
|
- Страница с отображением поста-картинки
|
||||||
@ -16,6 +18,7 @@
|
|||||||
- Мыло
|
- Мыло
|
||||||
- Пароль
|
- Пароль
|
||||||
- Айди приглашения
|
- Айди приглашения
|
||||||
|
- Роли (админ, модер, участник) и права доступа
|
||||||
- Аватарки
|
- Аватарки
|
||||||
- Бан
|
- Бан
|
||||||
- Полное удаление
|
- Полное удаление
|
||||||
|
3
api/_db.php
Normal file
3
api/_db.php
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
?>
|
@ -13,6 +13,8 @@ Files starting from "_" ("_example.php") are intended for internal use only.
|
|||||||
|
|
||||||
## Version 1
|
## Version 1
|
||||||
|
|
||||||
|
- _db.php: connection to database and all related
|
||||||
|
- _auth.php: things related to authentification
|
||||||
- stats.php (GET/POST): all general statistics about this instance
|
- stats.php (GET/POST): all general statistics about this instance
|
||||||
|
|
||||||
- admin/ (POST): private statistics about this instance
|
- admin/ (POST): private statistics about this instance
|
||||||
@ -30,8 +32,9 @@ Files starting from "_" ("_example.php") are intended for internal use only.
|
|||||||
- post/create.php (POST): create new post with image
|
- post/create.php (POST): create new post with image
|
||||||
- post/edit.php (POST): edit tags of post
|
- post/edit.php (POST): edit tags of post
|
||||||
- post/delete.php (POST): delete post
|
- post/delete.php (POST): delete post
|
||||||
|
- post/vote.php (POST): rate the existing post
|
||||||
|
|
||||||
- post/comments/ (GET/POST): show all comments from post by id
|
- comments/ (GET/POST): show all comments from section by id
|
||||||
- post/comments/create.php (POST): create new comment
|
- comments/create.php (POST): create new comment at selected section
|
||||||
- post/comments/edit.php (POST): edit existing comment
|
- comments/edit.php (POST): edit existing comment
|
||||||
- post/comments/delete.php (POST): remove existing comment
|
- comments/delete.php (POST): remove existing comment
|
38
docs/DB.md
Normal file
38
docs/DB.md
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# Databases
|
||||||
|
|
||||||
|
## How to setup DB
|
||||||
|
|
||||||
|
We are using MariaDB, but any MySQL-compatible database should be enough. There are instructions how to setup it for using with E949.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mysql -u root -p
|
||||||
|
```
|
||||||
|
|
||||||
|
```mysql
|
||||||
|
CREATE USER e949@localhost IDENTIFIED BY 'password';
|
||||||
|
CREATE DATABASE e949 CHARACTER SET = 'utf8';
|
||||||
|
GRANT ALL PRIVILEGES ON e949.* TO e949@localhost;
|
||||||
|
FLUSH PRIVILEGES;
|
||||||
|
EXIT
|
||||||
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mysql -u e949 -p
|
||||||
|
```
|
||||||
|
|
||||||
|
```mysql
|
||||||
|
USE e949;
|
||||||
|
CREATE TABLE posts (
|
||||||
|
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT 'Unique identifier of post',
|
||||||
|
author_id BIGINT UNSIGNED NOT NULL COMMENT 'Identifier of post author',
|
||||||
|
comment_section_id BIGINT UNSIGNED NULL COMMENT 'Identifier of post comment section',
|
||||||
|
posted_at TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT 'When post was published',
|
||||||
|
tags VARCHAR(2048) NOT NULL COMMENT 'Comma-delimited list of post tags',
|
||||||
|
title VARCHAR(8192) NULL COMMENT 'Caption for the post',
|
||||||
|
votes_up INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Amount of positive reactions',
|
||||||
|
votes_down INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Amount of negative reactions',
|
||||||
|
views BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Amount of post views',
|
||||||
|
pic_path VARCHAR(256) NOT NULL COMMENT 'Path or URL of picture',
|
||||||
|
preview_path VARCHAR(256) NULL COMMENT 'Path or URL of preview version of picture'
|
||||||
|
);
|
||||||
|
```
|
@ -1,4 +1,6 @@
|
|||||||
# Repo Directory Structure
|
# Repo Directory Structure
|
||||||
|
|
||||||
|
**api**: E949 PHP API
|
||||||
**docs**: all documentation here
|
**docs**: all documentation here
|
||||||
**html_drafts**: peaces of html markup
|
<!--**html_drafts**: peaces of html markup-->
|
||||||
|
**front**: things for frontend, like CSS
|
Loading…
x
Reference in New Issue
Block a user