Skip to content

Commit e0454cc

Browse files
committed
а-ля-я тесты и аля рефакторинг
1 parent 4b6cccd commit e0454cc

36 files changed

+317
-361
lines changed

.env.dist

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ APP_TITLE="FastAPI Template"
33
APP_VERSION="1.0.0"
44
APP_SECRET_KEY="123abc"
55

6-
POSTGRES_DB="postgres"
7-
POSTGRES_HOST="postgres"
8-
POSTGRES_PORT=5432
9-
POSTGRES_USER="postgres"
10-
POSTGRES_PASSWORD="postgres"
6+
DB="postgres"
7+
DB_HOST="postgres"
8+
DB_PORT=5432
9+
DB_USER="postgres"
10+
DB_PASSWORD="postgres"
11+
DB_DRIVERNAME="postgresql+asyncpg"

.github/workflows/generate-swagger-and-commit-to-docs.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/get-tree-and-commit-to-readme.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/workflows/reformat-code-and-commit.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

README.md

Lines changed: 18 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,20 @@
1-
# FastAPI
2-
3-
## File Structure
4-
```
5-
.
6-
├── __init__.py
7-
├── api
8-
│   ├── __init__.py
9-
│   ├── deps.py
10-
│   └── v1
11-
│   ├── __init__.py
12-
│   ├── auth
13-
│   │   ├── __init__.py
14-
│   │   └── token.py
15-
│   └── users
16-
│   ├── __init__.py
17-
│   ├── create.py
18-
│   └── retrieve.py
19-
├── core
20-
│   ├── __init__.py
21-
│   ├── db.py
22-
│   ├── exps.py
23-
│   └── settings.py
24-
├── logic
25-
│   ├── __init__.py
26-
│   ├── auth
27-
│   │   ├── __init__.py
28-
│   │   └── auth.py
29-
│   ├── logic.py
30-
│   ├── security
31-
│   │   ├── __init__.py
32-
│   │   ├── jwt.py
33-
│   │   ├── pwd.py
34-
│   │   └── security.py
35-
│   └── users
36-
│   ├── __init__.py
37-
│   └── users.py
38-
├── models
39-
│   ├── __init__.py
40-
│   ├── auth
41-
│   │   ├── __init__.py
42-
│   │   └── token.py
43-
│   ├── base.py
44-
│   ├── types
45-
│   │   ├── __init__.py
46-
│   │   └── unix.py
47-
│   └── users
48-
│   ├── __init__.py
49-
│   └── user.py
50-
└── repositories
51-
├── __init__.py
52-
├── base.py
53-
└── user.py
1+
# FastAPI
542

55-
14 directories, 34 files
56-
```
3+
## Create a `.env` file based on `.env.dist` and make all the necessary customizations
574

58-
## Create a `.env` file based on `.env.dist` and make all the necessary customizations
59-
60-
### To run the application in a docker container, run the command
61-
62-
`docker-compose up -d`
63-
64-
### To run the application without a docker container, complete follow these steps
65-
66-
1. Install dependencies.
67-
68-
`poetry install` or `pip install -r requirements.txt`
69-
2. Run application.
70-
71-
`poetry run fastapi dev app` or `make dev`
72-
73-
### Make documentation
74-
75-
`make help`
5+
### To run the application in a docker container, run the command
6+
7+
`docker-compose up -d`
8+
9+
### To run the application without a docker container, complete follow these steps
10+
11+
1. Install dependencies.
12+
13+
`poetry install` or `pip install -r requirements.txt`
14+
2. Run application.
15+
16+
`poetry run fastapi dev app` or `make dev`
17+
18+
### Make documentation
19+
20+
`make help`

app/api/deps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from fastapi.security import APIKeyHeader
99

1010
from app.logic import Logic as _Logic
11-
from app.models.users.user import User as _User
11+
from app.models.users import User as _User
1212

1313

1414
async def get_logic() -> AsyncGenerator[_Logic, None]:

app/api/v1/auth/token.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from app.api import deps
44
from app.models.auth import AccessToken
5-
from app.models.users.user import UserCreate
5+
from app.models.users import UserCreate
66

77
router = APIRouter(prefix='/token')
88

app/api/v1/users/create.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from fastapi import APIRouter
22

33
from app.api import deps
4-
from app.models.users.user import UserCreate, UserRead
4+
from app.models.users import UserCreate, UserRead
55

66
router = APIRouter(prefix='/create')
77

app/api/v1/users/retrieve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from fastapi import APIRouter
66

77
from app.api import deps
8-
from app.models.users.user import UserRead
8+
from app.models.users import UserRead
99

1010
router = APIRouter()
1111

app/core/db.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def __init__(
2424
async def __set_async_engine(self) -> None:
2525
if self.__engine is None:
2626
self.__engine = create_async_engine(
27-
settings.pg_dsn.unicode_string(), echo=False, future=True
27+
settings.db_dsn, echo=False, future=True
2828
)
2929

3030
async def __set_async_session(self) -> None:

0 commit comments

Comments
 (0)