feat(backend): add a user favorites route

This commit is contained in:
Kentai Radiquum 2024-05-01 12:01:34 +05:00
parent f535d09e97
commit 332e1d1918
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
4 changed files with 40 additions and 0 deletions

View file

@ -0,0 +1,33 @@
from fastapi import APIRouter
from fastapi import Request
from modules.proxy import apiRequest
from modules.proxy import ENDPOINTS
router = APIRouter()
@router.get("", summary="Get user favorites list")
async def GetUserFavorites(request: Request, token: str, page: int = 0):
return await apiRequest(
request, ENDPOINTS["user"]["favorite"], f"/all/{page}", query=f"?token={token}"
)
@router.get("/list/{release_id}/add", summary="Add release to user favorites")
async def addReleaseToFavorites(request: Request, release_id: int, token: str):
return await apiRequest(
request,
ENDPOINTS["user"]["favorite"],
f"/add/{release_id}",
query=f"?token={token}",
)
@router.get("/list/{release_id}/delete", summary="Remove release from user favorites")
async def deleteReleaseFromFavorites(request: Request, release_id: int, token: str):
return await apiRequest(
request,
ENDPOINTS["user"]["favorite"],
f"/delete/{release_id}",
query=f"?token={token}",
)