feat: Implement initial schema and add various API, service, and management command enhancements across the application.

This commit is contained in:
pacnpal
2026-01-01 15:13:01 -05:00
parent c95f99ca10
commit b243b17af7
413 changed files with 11164 additions and 17433 deletions

View File

@@ -127,18 +127,14 @@ class TriggerTrendingCalculationAPIView(APIView):
try:
# Run trending calculation command
with redirect_stdout(trending_output), redirect_stderr(trending_output):
call_command(
"calculate_trending", "--content-type=all", "--limit=50"
)
call_command("calculate_trending", "--content-type=all", "--limit=50")
trending_completed = True
except Exception as e:
trending_output.write(f"Error: {str(e)}")
try:
# Run new content calculation command
with redirect_stdout(new_content_output), redirect_stderr(
new_content_output
):
with redirect_stdout(new_content_output), redirect_stderr(new_content_output):
call_command(
"calculate_new_content",
"--content-type=all",
@@ -153,7 +149,7 @@ class TriggerTrendingCalculationAPIView(APIView):
return Response(
{
"message": "Trending content calculation completed",
"detail": "Trending content calculation completed",
"trending_completed": trending_completed,
"new_content_completed": new_content_completed,
"completion_time": completion_time,
@@ -166,7 +162,7 @@ class TriggerTrendingCalculationAPIView(APIView):
except Exception as e:
return Response(
{
"error": "Failed to trigger trending content calculation",
"detail": "Failed to trigger trending content calculation",
"details": str(e),
},
status=status.HTTP_500_INTERNAL_SERVER_ERROR,
@@ -213,9 +209,7 @@ class NewContentAPIView(APIView):
days_back = min(int(request.query_params.get("days", 30)), 365)
# Get new content using direct calculation service
all_new_content = trending_service.get_new_content(
limit=limit * 2, days_back=days_back
)
all_new_content = trending_service.get_new_content(limit=limit * 2, days_back=days_back)
recently_added = []
newly_opened = []