mirror of
https://github.com/yusufipk/RepoHub.git
synced 2026-09-11 18:46:07 +00:00
refactor: Remove experience level from recommendation system
- Remove experienceLevel from UserProfile, RecommendationRequest, and PackagePreset types - Remove experience level validation and handling from GET/POST endpoints - Disable localStorage persistence in useRecommendationProfile hook (session-only storage) - Disable automatic onboarding modal on first visit - Set recommendations section to expanded by default - Add empty state card for recommendations with wizard button - Add translations
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { RecommendationService } from "@/services/recommendationService";
|
||||
import { RecommendationRequest, UserCategory, ExperienceLevel } from "@/types/recommendations";
|
||||
import { RecommendationRequest, UserCategory } from "@/types/recommendations";
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
try {
|
||||
@@ -79,7 +79,6 @@ export async function POST(request: NextRequest) {
|
||||
{
|
||||
platform_id: body.platform_id,
|
||||
categories: body.categories,
|
||||
experienceLevel: body.experienceLevel,
|
||||
limit,
|
||||
}
|
||||
);
|
||||
@@ -90,7 +89,6 @@ export async function POST(request: NextRequest) {
|
||||
userProfile: {
|
||||
categories: body.categories,
|
||||
platform: body.platform_id,
|
||||
experienceLevel: body.experienceLevel,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
@@ -110,7 +108,6 @@ export async function GET(request: NextRequest) {
|
||||
const { searchParams } = new URL(request.url);
|
||||
const platformId = searchParams.get("platform_id");
|
||||
const categoriesParam = searchParams.get("categories");
|
||||
const experienceLevel = searchParams.get("experience_level");
|
||||
const limit = searchParams.get("limit");
|
||||
|
||||
// Validate required fields
|
||||
@@ -174,17 +171,6 @@ export async function GET(request: NextRequest) {
|
||||
);
|
||||
}
|
||||
|
||||
// Validate experience level if provided
|
||||
const validExperienceLevels: ExperienceLevel[] = ["beginner", "intermediate", "advanced"];
|
||||
if (experienceLevel && !validExperienceLevels.includes(experienceLevel as ExperienceLevel)) {
|
||||
return NextResponse.json(
|
||||
{
|
||||
error: `Invalid experience_level. Must be one of: ${validExperienceLevels.join(", ")}`,
|
||||
},
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
// Set default limit
|
||||
const parsedLimit =
|
||||
limit && parseInt(limit) > 0 && parseInt(limit) <= 50
|
||||
@@ -196,7 +182,6 @@ export async function GET(request: NextRequest) {
|
||||
{
|
||||
platform_id: platformId,
|
||||
categories: categories as UserCategory[],
|
||||
experienceLevel: experienceLevel as ExperienceLevel | undefined,
|
||||
limit: parsedLimit,
|
||||
}
|
||||
);
|
||||
@@ -207,7 +192,6 @@ export async function GET(request: NextRequest) {
|
||||
userProfile: {
|
||||
categories,
|
||||
platform: platformId,
|
||||
experienceLevel,
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user