Skip to content

Commit

Permalink
Merge branch 'develop' into feature/docker-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Voyager1744 authored Aug 12, 2023
2 parents 714dab7 + 6dd596d commit 25c3f98
Show file tree
Hide file tree
Showing 6 changed files with 306 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,6 @@ cython_debug/
.idea/
media/
.DS_Store

# Vscode project settings
.vscode
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ npx --package=@softwaretechnik/dbml-renderer -- dbml-renderer -i docs/db.dbml -o
[СХЕМА БД](https://dbdiagram.io/d/64bb081202bd1c4a5e7f8c0b)



## Документация API
В проекте реализована автоматическая генерация документации. Документация доступна по адресам:
1) Swagger: `/api/v1/schema/swagger-ui/`
2) Redoc: `/api/v1/schema/redoc/`



## Запуск в режиме разработки

1. Убедитесь, что у вас установлены Docker и Docker Compose.
Expand Down Expand Up @@ -58,3 +66,11 @@ npx --package=@softwaretechnik/dbml-renderer -- dbml-renderer -i docs/db.dbml -o
```bash
docker-compose -f infra/docker-compose.dev.yml down
```
=======
# backend

## Схема базы данных
Обновление картинки после изменения dbml с помощью команды:
```
npx --package=@softwaretechnik/dbml-renderer -- dbml-renderer -i docs/db.dbml -o docs/db.svg
```
18 changes: 18 additions & 0 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
]

THIRD_PARTY_APPS = [
"debug_toolbar",
"drf_spectacular",
"rest_framework",
]

Expand All @@ -49,6 +51,7 @@
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"debug_toolbar.middleware.DebugToolbarMiddleware",
]

ROOT_URLCONF = "config.urls"
Expand Down Expand Up @@ -126,3 +129,18 @@
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

if DEBUG:
INTERNAL_IPS = ["127.0.0.1"]

REST_FRAMEWORK = {
"DEFAULT_SCHEMA_CLASS": "drf_spectacular.openapi.AutoSchema",
}

SPECTACULAR_SETTINGS = {
"TITLE": "b2b-marketplace",
"DESCRIPTION": (
"API веб-сервиса для взаимодействия между продавцами и покупателями оптовых товаров"
),
"VERSION": "0.0.1",
}
33 changes: 32 additions & 1 deletion config/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,37 @@
from django.contrib import admin
from django.urls import path
from django.urls import include, path
from drf_spectacular.views import (
SpectacularAPIView,
SpectacularRedocView,
SpectacularSwaggerView,
)

from config.settings import DEBUG

api_schema_url_patterns = [
path(
route="",
view=SpectacularAPIView.as_view(),
name="schema",
),
path(
route="redoc/",
view=SpectacularRedocView.as_view(url_name="schema"),
name="redoc",
),
path(
route="swagger-ui/",
view=SpectacularSwaggerView.as_view(url_name="schema"),
name="swagger-ui",
),
]

urlpatterns = [
path(route="api/v1/schema/", view=include(api_schema_url_patterns)),
path("admin/", admin.site.urls),
]

if DEBUG:
import debug_toolbar

urlpatterns += [path("__debug__/", include(debug_toolbar.urls))]
Loading

0 comments on commit 25c3f98

Please sign in to comment.