Remove obsolete endpoints (#89)
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s
Remove endpoints api/login/token and api/login/profile --------- Co-authored-by: Thomas Peetz <thomas.peetz@cimt-ag.de> Reviewed-on: #89
This commit was merged in pull request #89.
This commit is contained in:
@@ -3,6 +3,7 @@ from fastapi import APIRouter, HTTPException, status
|
||||
from sqlalchemy import select
|
||||
from src.core.log_conf import logger
|
||||
|
||||
from src.core.security import CurrentUser
|
||||
from src.db.models.admin import Profile
|
||||
from src.db.repository.user import create_new_profile, get_profile_details
|
||||
from src.db.session import SessionDep
|
||||
@@ -11,8 +12,13 @@ from src.schema.user.profile import ProfileResponse, ProfileModel
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/profile", response_model=ProfileModel)
|
||||
async def read_profile(current_user: CurrentUser):
|
||||
return current_user
|
||||
|
||||
@router.get("/profiles", response_model=List[ProfileResponse])
|
||||
def get_all_profiles(db: SessionDep) -> List[ProfileResponse]: # type: ignore
|
||||
def get_all_profiles(db: SessionDep) -> List[ProfileResponse]:
|
||||
results: List[ProfileResponse] = []
|
||||
profiles = db.scalars(select(Profile)).all()
|
||||
for profile in profiles:
|
||||
@@ -21,7 +27,7 @@ def get_all_profiles(db: SessionDep) -> List[ProfileResponse]: # type: ignore
|
||||
return results
|
||||
|
||||
@router.get("/profiles/{profile_id}", response_model=ProfileResponse)
|
||||
def get_profile(profile_id: str, db: SessionDep) -> ProfileResponse: # type: ignore
|
||||
def get_profile(profile_id: str, db: SessionDep) -> ProfileResponse:
|
||||
profile = db.get(Profile, profile_id)
|
||||
if not profile:
|
||||
raise HTTPException(status_code=404, detail="MediaActor could not be found")
|
||||
@@ -37,8 +43,8 @@ def delete_profile(profile_id: str, db: SessionDep): # type: ignore
|
||||
delete_profile(profile_id=profile_id, db=db)
|
||||
|
||||
@router.post("/profiles", status_code=status.HTTP_201_CREATED)
|
||||
def add_profile(new_profile: ProfileModel, db: SessionDep) -> ProfileResponse: # type: ignore
|
||||
logger.info(f"add profile {new_profile.user_name}")
|
||||
def add_profile(new_profile: ProfileModel, db: SessionDep) -> ProfileResponse:
|
||||
logger.info(f"add profile {new_profile.username}")
|
||||
try:
|
||||
profile: Profile = create_new_profile(new_profile, db)
|
||||
except:
|
||||
|
||||
Reference in New Issue
Block a user