Skip to content

Commit 215a97c

Browse files
Organized folders
1 parent b6dcbd6 commit 215a97c

29 files changed

+19
-19
lines changed

.pre-commit-config.docker.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ repos:
3131
hooks:
3232
- id: generate-openapi-schema
3333
name: generate OpenAPI schema
34-
entry: sh -c 'docker compose run --rm --no-deps -T backend poetry run python -m commands.generate_openapi_schema'
34+
entry: sh -c 'docker compose run --rm --no-deps -T backend poetry run python -m app.commands.generate_openapi_schema'
3535
language: system
3636
pass_filenames: false
3737
- id: generate-frontend-client

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ repos:
3131
hooks:
3232
- id: generate-openapi-schema
3333
name: generate OpenAPI schema
34-
entry: sh -c 'cd fastapi_backend && poetry run python -m commands.generate_openapi_schema'
34+
entry: sh -c 'cd fastapi_backend && poetry run python -m app.commands.generate_openapi_schema'
3535
language: system
3636
pass_filenames: false
3737
- id: generate-frontend-client
File renamed without changes.
File renamed without changes.
File renamed without changes.

fastapi_backend/alembic/env.py renamed to fastapi_backend/app/alembic/env.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from sqlalchemy.ext.asyncio import async_engine_from_config
77

88
from alembic import context
9-
from src.models import Base
9+
from app.src.models import Base
1010

1111
# this is the Alembic Config object, which provides
1212
# access to the values within the .ini file in use.

fastapi_backend/commands/generate_openapi_schema.py renamed to fastapi_backend/app/commands/generate_openapi_schema.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import json
22
from pathlib import Path
3-
from src.main import app
3+
from app.src.main import app
44
import os
55

66
from dotenv import load_dotenv
@@ -14,13 +14,13 @@ def generate_openapi_schema(output_file):
1414
schema = app.openapi()
1515
output_path = Path(output_file)
1616

17-
updated_schema = _remove_operation_id_tag(schema)
17+
updated_schema = remove_operation_id_tag(schema)
1818

1919
output_path.write_text(json.dumps(updated_schema, indent=2))
2020
print(f"OpenAPI schema saved to {output_file}")
2121

2222

23-
def _remove_operation_id_tag(schema):
23+
def remove_operation_id_tag(schema):
2424
"""
2525
Removes the tag prefix from the operation IDs in the OpenAPI schema.
2626
File renamed without changes.

fastapi_backend/src/config.py renamed to fastapi_backend/app/src/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Settings(BaseSettings):
1111
EXPIRE_ON_COMMIT: bool = False
1212

1313
model_config = SettingsConfigDict(
14-
env_file=".env", env_file_encoding="utf-8", extra="ignore"
14+
env_file="app/.env", env_file_encoding="utf-8", extra="ignore"
1515
)
1616

1717

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

fastapi_backend/tests/commands/test_generate_openapi_schema.py renamed to fastapi_backend/app/tests/commands/test_generate_openapi_schema.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import pytest
44
from pathlib import Path
55

6-
from commands.generate_openapi_schema import (
7-
_remove_operation_id_tag,
6+
from app.commands.generate_openapi_schema import (
87
generate_openapi_schema,
8+
remove_operation_id_tag,
99
)
1010

1111

@@ -27,13 +27,13 @@ def expected_output_schema():
2727

2828

2929
def test_remove_operation_id_tag(sample_openapi_schema, expected_output_schema):
30-
cleaned_schema = _remove_operation_id_tag(sample_openapi_schema)
30+
cleaned_schema = remove_operation_id_tag(sample_openapi_schema)
3131
assert cleaned_schema == expected_output_schema
3232

3333

3434
@pytest.fixture
3535
def mock_app(mocker):
36-
app = mocker.patch("commands.generate_openapi_schema.app")
36+
app = mocker.patch("app.commands.generate_openapi_schema.app")
3737
app.openapi.return_value = {
3838
"openapi": "3.1.0",
3939
"info": {"title": "FastAPI", "version": "0.1.0"},
@@ -44,7 +44,7 @@ def mock_app(mocker):
4444

4545
def test_generate_openapi_schema(mocker, mock_app):
4646
mock_remove_operation_id_tag = mocker.patch(
47-
"commands.generate_openapi_schema._remove_operation_id_tag"
47+
"app.commands.generate_openapi_schema.remove_operation_id_tag"
4848
)
4949
mock_remove_operation_id_tag.return_value = {"mocked_schema": True}
5050

fastapi_backend/tests/main/test_main.py renamed to fastapi_backend/app/tests/main/test_main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from fastapi import status
33
from fastapi.testclient import TestClient
44
from fastapi_users.router import ErrorCode
5-
from src.main import app
5+
from app.src.main import app
66

77

88
class TestPasswordValidation:

fastapi_backend/tests/utils/test_utils.py renamed to fastapi_backend/app/tests/utils/test_utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from fastapi.routing import APIRoute
2-
from src.utils import simple_generate_unique_route_id
2+
from app.src.utils import simple_generate_unique_route_id
33

44

55
def test_simple_generate_unique_route_id(mocker):

fastapi_backend/watcher.py renamed to fastapi_backend/app/watcher.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from threading import Timer
88

99
WATCHER_REGEX_PATTERN = re.compile(r"(main|schemas)\.py$")
10-
APP_PATH = "src"
10+
APP_PATH = "app/src"
1111

1212

1313
class MyHandler(FileSystemEventHandler):

fastapi_backend/start.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
if [ -f /.dockerenv ]; then
44
echo "Running in Docker"
5-
fastapi dev src/main.py --host 0.0.0.0 --port 8000 --reload &
6-
python watcher.py
5+
fastapi dev app/src/main.py --host 0.0.0.0 --port 8000 --reload &
6+
python app/watcher.py
77
else
88
echo "Running locally with Poetry"
9-
poetry run fastapi dev src/main.py --host 0.0.0.0 --port 8000 --reload &
10-
poetry run python watcher.py
9+
poetry run fastapi dev app/src/main.py --host 0.0.0.0 --port 8000 --reload &
10+
poetry run python app/watcher.py
1111
fi
1212

1313
wait

0 commit comments

Comments
 (0)