Skip to content

Commit f4970a3

Browse files
Add MongoDB connection and user management routes with FastAPI
1 parent d394640 commit f4970a3

17 files changed

+153
-29
lines changed

.vscode/settings.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,11 @@
55
"python.testing.unittestEnabled": false,
66
"python.testing.pytestEnabled": true,
77
"python-envs.defaultEnvManager": "ms-python.python:system",
8-
"python-envs.pythonProjects": []
8+
"python-envs.pythonProjects": [],
9+
"mdb.presetConnections": [
10+
{
11+
"name": "Preset Connection",
12+
"connectionString": "mongodb://localhost:27017"
13+
}
14+
]
915
}
273 Bytes
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
from pymongo import MongoClient
3+
4+
db_client = MongoClient()
5+
112 Bytes
Binary file not shown.

Backend/FastAPI/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from routers import libreria, users, status_http
1515
from routers import basic_auth_users
1616
from routers import jwt_oauth_users
17+
from routers import users_database
1718

1819

1920
# Vamos a importar staticfiles para servir archivos estáticos como imágenes, CSS y JavaScript.
@@ -28,6 +29,7 @@
2829
app.include_router(status_http.router) # Incluyendo el router de status_http
2930
app.include_router(basic_auth_users.router) # Incluyendo el router de basic_auth_users
3031
app.include_router(jwt_oauth_users.router) # Incluyendo el router de jwt_oauth_users
32+
app.include_router(users_database.router) # Incluyendo el router de users_database
3133

3234
app.mount("/static", StaticFiles(directory = "static"), name = "static") # Montando la carpeta 'static' para servir archivos estáticos
3335

548 Bytes
Binary file not shown.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
# Import FastAPI y pydantic para crear una aplicación web y manejar datos
3+
# Importando BaseModel de pydantic para definir modelos de datos
4+
from pydantic import BaseModel
5+
6+
7+
# Entidad user_profile
8+
# Definimos un modelo de datos para representar un usuario
9+
class user_profile(BaseModel):
10+
Name: str
11+
Age: int
12+
# Surname: str
13+
# id_user: int

Backend/FastAPI/requirements.txt

Lines changed: 0 additions & 25 deletions
This file was deleted.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)