From 2455c8280cc1d5151e9e431dc905fa9535ba600d Mon Sep 17 00:00:00 2001 From: Backend IM Bot Date: Sat, 29 Mar 2025 21:15:18 +0000 Subject: [PATCH] Update code in endpoints/afrogospel.post.py --- endpoints/afrogospel.post.py | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/endpoints/afrogospel.post.py b/endpoints/afrogospel.post.py index 3b86ace..398fd60 100644 --- a/endpoints/afrogospel.post.py +++ b/endpoints/afrogospel.post.py @@ -1,22 +1,15 @@ -from fastapi import APIRouter, Depends, HTTPException, status -from sqlalchemy.orm import Session -from typing import List -from core.database import get_db -from models.song import Song -from schemas.song import SongSchema -from helpers.song_helpers import get_random_afrogospel_songs +from fastapi import APIRouter, status +from typing import Dict +import random router = APIRouter() -@router.post("/afrogospel", status_code=200, response_model=List[SongSchema]) -async def get_random_afrogospel( - db: Session = Depends(get_db) -): - """Get random afrogospel songs""" - songs = get_random_afrogospel_songs(db) - if not songs: - raise HTTPException( - status_code=status.HTTP_404_NOT_FOUND, - detail="No afrogospel songs found" - ) - return songs \ No newline at end of file +@router.post("/afrogospel", status_code=status.HTTP_200_OK, response_model=Dict[str, str]) +async def get_random_month(): + months = [ + "January", "February", "March", "April", + "May", "June", "July", "August", + "September", "October", "November", "December" + ] + random_month = random.choice(months) + return {"month": random_month} \ No newline at end of file