-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
84 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
sql_uri = | ||
salt = | ||
sql_uri = | ||
salt = | ||
redis_password = | ||
redis_database= | ||
redis_port= | ||
server_ip= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import api.middleware | ||
from api.config import app | ||
import logging | ||
from api.config import app, redis_client | ||
from api.routers import ( | ||
account, | ||
challenge, | ||
|
@@ -8,19 +9,32 @@ | |
profile, | ||
trainer, | ||
workout, | ||
images, | ||
) | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
app.include_router(account.router) | ||
app.include_router(challenge.router) | ||
app.include_router(profile.router) | ||
app.include_router(trainer.router) | ||
app.include_router(event.router) | ||
app.include_router(dashboard.router) | ||
app.include_router(workout.router) | ||
app.include_router(images.router) | ||
|
||
|
||
@app.get("/") | ||
async def root(): | ||
return { | ||
"message": "Welcome to the Workout with Me API. If you're interested in becoming a developer, please contact [email protected]!" | ||
} | ||
|
||
|
||
@app.on_event("startup") | ||
async def startup(): | ||
# check redis server | ||
if await redis_client.ping(): | ||
logger.info("REDIS SERVER CONNECTED!") | ||
else: | ||
logger.fatal("REDIS SERVER IS NOT ACCESSIBLE!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import json | ||
|
||
from fastapi import APIRouter, HTTPException, status | ||
from sqlalchemy import select | ||
from sqlalchemy.ext.asyncio import AsyncSession | ||
from sqlalchemy.sql.expression import select, insert, delete | ||
from api.config import redis_client | ||
import api.routers.functions.account as account_functions | ||
import api.routers.models.account as account_models | ||
from api.database.database import USERDATA_ENGINE | ||
from api.database.functions import hashbrown, sqlalchemy_result | ||
from api.database.models import Registration, Tokens, Blocks | ||
from api.routers.functions.general import get_token_user_id | ||
from fastapi.responses import FileResponse | ||
import os | ||
from api.database.functions import redis_decode | ||
|
||
router = APIRouter() | ||
|
||
|
||
@router.get("/v1/image/{image_id}", tags=["images"]) | ||
async def get_image(image_id: str) -> json: | ||
"""get image copy""" | ||
image_route = await redis_client.get(image_id) | ||
image_route = redis_decode(bytes_encoded=image_route) | ||
return FileResponse("C:/Users/thear/Documents/GitHub/API/images/8/profile.jpeg") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters