Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#24-backend-imp-crud-for-users-model #109

Merged
merged 36 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
45e6848
#24-backend: Put first fast-api crud
radthenone Jan 23, 2024
f405b37
update branch with dev
radthenone Jan 30, 2024
dbddb2f
#24-backend-imp-crud-24-backend-imp-crud-feature-auth-repo-changes: r…
radthenone Jan 30, 2024
b0f949a
Merge branch 'dev' of https://github.com/bh-coders/trip-planer into 2…
radthenone Feb 1, 2024
41dc684
24-backend-imp-crud-for-users-model-feature-new-develop-docker-compos…
radthenone Feb 2, 2024
8fa58e2
24-backend-imp-crud-feature-create-profile: merge with 24-backend-imp…
radthenone Feb 2, 2024
47e2efc
24-backend-imp-crud-feature-create-profile: separate auth and user, c…
radthenone Feb 2, 2024
c1f31b3
24-backend-imp-crud-feature-create-profile: delete auth old files
radthenone Feb 2, 2024
cd97bbe
24-backend-imp-crud-feature-create-profile: change some global except…
radthenone Feb 2, 2024
903ff27
24-backend-imp-crud-feature-create-profile: add dev build extra
radthenone Feb 2, 2024
9780dd0
24-backend-imp-crud-feature-create-profile: rebuild all models
radthenone Feb 8, 2024
2397a47
24-backend-imp-crud-feature-create-profile: merge with dev
radthenone Feb 8, 2024
eb355cd
24-backend-imp-crud-feature-create-profile: merge with 24-backend-imp…
radthenone Feb 8, 2024
a69e289
24-backend-imp-crud-feature-create-profile: push users image to storage
radthenone Feb 8, 2024
29f3454
24-backend-imp-crud-feature-create-profile: technic push to refactor …
radthenone Feb 8, 2024
5cca67a
24-backend-imp-24-backend-imp-crud-for-users-model: add develop docke…
radthenone Feb 11, 2024
66a68e1
24-backend-imp-24-backend-imp-crud-for-users-model: add redis cache p…
radthenone Feb 15, 2024
59dfa81
24-backend-imp-24-backend-imp-crud-for-users-model: create events for…
radthenone Feb 24, 2024
2878edd
24-backend-imp-crud-for-users-model: Recreate system to navigate pub/…
radthenone Feb 29, 2024
9fdc082
24-backend-imp-crud-for-users-model: Correct endpoints in user servic…
radthenone Feb 29, 2024
ad25b0f
24-backend-imp-crud-for-users-model: Merge conflicts resolved
radthenone Feb 29, 2024
83b57f1
24-backend-imp-crud-for-users-model: Correct gh actions docker to dev…
radthenone Feb 29, 2024
bb1d76f
24-backend-imp-crud-for-users-model: first code review corrections
radthenone Mar 6, 2024
3204ec0
24-backend-imp-crud-for-users-model: second code review corrections
radthenone Mar 8, 2024
ab39d13
24-backend-imp-crud-for-users-model: remove image from profile_servic…
radthenone Mar 8, 2024
a5d4c79
224-backend-imp-crud-for-users-model: add schema to names
radthenone Mar 9, 2024
333380d
224-backend-imp-crud-for-users-model: removed all image from users/pr…
radthenone Mar 9, 2024
94226b5
224-backend-imp-crud-for-users-model: update from dev branch
radthenone Mar 9, 2024
783c7f2
224-backend-imp-crud-for-users-model: remove delete profile because u…
radthenone Mar 9, 2024
f00a1bc
224-backend-imp-crud-for-users-model: cleanup
radthenone Mar 9, 2024
a8e27dd
Merge branch 'dev' of https://github.com/bh-coders/trip-planer into 2…
radthenone Mar 11, 2024
3e4f3ec
224-backend-imp-crud-for-users-model: returned read_version docs, rem…
radthenone Mar 18, 2024
3a02dc0
24-backend-imp-crud-for-users-model: returned read_version docs, remo…
radthenone Mar 18, 2024
d5f60a1
Merge remote-tracking branch 'origin/24-backend-imp-crud-for-users-mo…
radthenone Mar 18, 2024
ebd1dfd
#24-backend-imp-crud-for-users-model: returned read_version docs, rem…
radthenone Mar 18, 2024
ff4122b
Merge remote-tracking branch 'origin/24-backend-imp-crud-for-users-mo…
radthenone Mar 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "backend/requirements.txt"
cache-dependency-path: "web/requirements.txt"
- name: Install dev dependencies
run: |
python -m pip install --upgrade pip
Expand Down
46 changes: 46 additions & 0 deletions README.DEV.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Develop app

### enviroments:
backend/.env

````bash
POSTGRES_HOST=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=triplane
POSTGRES_DB=postgres-triplane
POSTGRES_PORT=5432

SECRET_KEY=test
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=300
REFRESH_TOKEN_EXPIRE_DAYS=365

CORS_ORIGINS=http://localhost:8083

MINIO_HOST_URL=minio:9000
MINIO_ACCESS_KEY=superuser
MINIO_SECRET_KEY=superuser
MINIO_SECURE=False

FASTAPI_HOST=localhost
FASTAPI_PORT=8000
DEBUG=0

CACHE_STORAGE_HOST=redis
CACHE_STORAGE_PORT=6379
CACHE_STORAGE_PASSWORD=redis
CACHE_STORAGE_DB=1
CACHE_STORAGE_EXP=86400
````

### start app
````bash
docker-compose -f docker-compose.dev.yml up --build -d
````

### debug
you can use:
````bash
python ./web/src/run_app.py
````

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Mobile, Web and Rest API
In our project, we use a configuration file that loads environment variables. This allows us to interact with them. The configuration file is located at:

```bash
src/backend/core/configs.py
src/web/core/configs.py
```

### Initializing Environment Variables
Expand Down
2 changes: 1 addition & 1 deletion backend/README.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
```bash
cd backend
cd web
```

```bash
Expand Down
11 changes: 11 additions & 0 deletions backend/docker/redis/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM redis:7.2

WORKDIR /redis

COPY init.sh ./

RUN chmod +x ./init.sh

EXPOSE 6379

CMD ["./init.sh"]
22 changes: 22 additions & 0 deletions backend/docker/redis/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
# if any of the commands in your code fails for any reason, the entire script fails
set -o errexit
# fail exit if one of your pipe command fails
set -o pipefail
# exits if any of your variables is not set
set -o nounset

echo "Add sysctl vm.overcommit_memory=1"
echo "1" > /proc/sys/vm/overcommit_memory

export REDIS_PASSWORD="${CACHE_STORAGE_PASSWORD}"

echo "Starting redis server..."

echo "Redis server is up"

# Start redis server
redis-server --bind 0.0.0.0 --requirepass "${REDIS_PASSWORD}" --maxmemory 256mb --maxmemory-policy allkeys-lru --appendonly yes

echo "Redis server started"

16 changes: 16 additions & 0 deletions backend/docker/web/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM python:3.11 AS base

WORKDIR /app
ADD . /app

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONBUFFERED 1

COPY requirements.txt .

RUN pip install --no-cache-dir -r requirements.txt

COPY ./docker/web/backend.sh /backend.sh
RUN sed -i 's/\r$//g' /backend.sh && chmod +x /backend.sh

ENTRYPOINT ["/backend.sh"]
16 changes: 16 additions & 0 deletions backend/docker/web/backend.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# if any of the commands in your code fails for any reason, the entire script fails
set -o errexit
# fail exit if one of your pipe command fails
set -o pipefail
# exits if any of your variables is not set
set -o nounset

export FASTAPI_HOST=$FASTAPI_HOST
export FASTAPI_PORT=$FASTAPI_PORT

if [ "${FASTAPI_HOST}" = "localhost" ]; then
export FASTAPI_HOST=0.0.0.0
fi

uvicorn src.main:app --host "${FASTAPI_HOST}" --port "${FASTAPI_PORT}" --reload
4 changes: 3 additions & 1 deletion backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ select = [
"F404",
"TCH",
]
ignore = []
ignore = [
"PGH004",
]
fixable = ["ALL"]
unfixable = []
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
Expand Down
Binary file modified backend/requirements.txt
Binary file not shown.
2 changes: 1 addition & 1 deletion backend/src/attraction/repositories/attraction_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
AttractionSchema,
AttractionSortedBy,
)
from src.core.common_schema import SortDirection
from src.common.schemas.common_schema import SortDirection

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion backend/src/attraction/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from pydantic import BaseModel

from src.core.common_schema import SortDirection
from src.common.schemas.common_schema import SortDirection
from src.file.models.schemas import MediaRead


Expand Down
1 change: 1 addition & 0 deletions backend/src/attraction/services/geocoding_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from requests import Session
from requests.exceptions import HTTPError, RequestException

from src.core.configs import GEOCODES_CO_API_KEY

logger = logging.getLogger(__name__)
Expand Down
14 changes: 0 additions & 14 deletions backend/src/auth/constants.py

This file was deleted.

46 changes: 0 additions & 46 deletions backend/src/auth/exceptions.py

This file was deleted.

5 changes: 0 additions & 5 deletions backend/src/auth/interfaces/__init__.py

This file was deleted.

35 changes: 0 additions & 35 deletions backend/src/auth/interfaces/repository.py

This file was deleted.

5 changes: 0 additions & 5 deletions backend/src/auth/repositories/__init__.py

This file was deleted.

68 changes: 0 additions & 68 deletions backend/src/auth/repositories/auth_repo.py

This file was deleted.

2 changes: 1 addition & 1 deletion backend/src/auth/routes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from src.auth.routes.router import router as auth_router
from src.auth.routes.auth_router import router as auth_router

__all__ = [
"auth_router",
Expand Down
Loading