← back to de1yura__Adaptive-fit

Function bodies 285 total

All specs Real LLM only Function bodies
getUser method · java · L90-L94 (5 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/DayTemplateController.java
    private User getUser(Authentication authentication) {
        String email = authentication.getName();
        return userRepository.findByEmail(email)
                .orElseThrow(() -> new ResourceNotFoundException("User not found"));
    }
NutritionController class · java · L25-L70 (46 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/NutritionController.java
public class NutritionController {

    private final NutritionService nutritionService;
    private final UserRepository userRepository;

    public NutritionController(NutritionService nutritionService, UserRepository userRepository) {
        this.nutritionService = nutritionService;
        this.userRepository = userRepository;
    }

    @GetMapping("/targets")
    @Operation(summary = "Get nutrition targets", description = "Returns the user's current nutrition plan with macro targets")
    public ResponseEntity<NutritionPlanResponse> getTargets(Authentication authentication) {
        Long userId = getUserId(authentication);
        return ResponseEntity.ok(nutritionService.getTargets(userId));
    }

    @PostMapping("/log")
    @Operation(summary = "Log nutrition", description = "Logs a nutrition entry with calories and macro breakdown")
    public ResponseEntity<Map<String, Object>> logNutrition(
            @Valid @RequestBody NutritionLogRequest request,
            Authenti
NutritionController method · java · L30-L33 (4 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/NutritionController.java
    public NutritionController(NutritionService nutritionService, UserRepository userRepository) {
        this.nutritionService = nutritionService;
        this.userRepository = userRepository;
    }
getTargets method · java · L37-L40 (4 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/NutritionController.java
    public ResponseEntity<NutritionPlanResponse> getTargets(Authentication authentication) {
        Long userId = getUserId(authentication);
        return ResponseEntity.ok(nutritionService.getTargets(userId));
    }
logNutrition method · java · L44-L55 (12 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/NutritionController.java
    public ResponseEntity<Map<String, Object>> logNutrition(
            @Valid @RequestBody NutritionLogRequest request,
            Authentication authentication) {
        Long userId = getUserId(authentication);
        NutritionLog log = nutritionService.logNutrition(userId, request);

        Map<String, Object> result = new LinkedHashMap<>();
        result.put("message", "Nutrition logged successfully");
        result.put("logId", log.getId());
        result.put("logDate", log.getLogDate().toString());
        return ResponseEntity.status(HttpStatus.CREATED).body(result);
    }
getHistory method · java · L59-L62 (4 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/NutritionController.java
    public ResponseEntity<List<NutritionLog>> getHistory(Authentication authentication) {
        Long userId = getUserId(authentication);
        return ResponseEntity.ok(nutritionService.getHistory(userId));
    }
getUserId method · java · L64-L69 (6 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/NutritionController.java
    private Long getUserId(Authentication authentication) {
        String email = authentication.getName();
        User user = userRepository.findByEmail(email)
                .orElseThrow(() -> new ResourceNotFoundException("User not found"));
        return user.getId();
    }
Generated by Repobility's multi-pass static-analysis pipeline (https://repobility.com)
OnboardingController class · java · L25-L113 (89 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/OnboardingController.java
public class OnboardingController {

    private final OnboardingService onboardingService;
    private final UserRepository userRepository;
    private final UserProfileRepository userProfileRepository;

    public OnboardingController(OnboardingService onboardingService, UserRepository userRepository,
                                UserProfileRepository userProfileRepository) {
        this.onboardingService = onboardingService;
        this.userRepository = userRepository;
        this.userProfileRepository = userProfileRepository;
    }

    @PostMapping("/submit")
    @Operation(summary = "Submit onboarding", description = "Submits the user's onboarding profile and generates an initial workout plan")
    public ResponseEntity<Map<String, Object>> submitOnboarding(
            @Valid @RequestBody OnboardingRequest request,
            Authentication authentication) {
        Long userId = getUserId(authentication);
        WorkoutPlan workoutPlan = onboardingService.submitOnboardi
OnboardingController method · java · L31-L36 (6 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/OnboardingController.java
    public OnboardingController(OnboardingService onboardingService, UserRepository userRepository,
                                UserProfileRepository userProfileRepository) {
        this.onboardingService = onboardingService;
        this.userRepository = userRepository;
        this.userProfileRepository = userProfileRepository;
    }
submitOnboarding method · java · L40-L51 (12 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/OnboardingController.java
    public ResponseEntity<Map<String, Object>> submitOnboarding(
            @Valid @RequestBody OnboardingRequest request,
            Authentication authentication) {
        Long userId = getUserId(authentication);
        WorkoutPlan workoutPlan = onboardingService.submitOnboarding(userId, request);

        return ResponseEntity.status(HttpStatus.CREATED).body(Map.of(
                "message", "Onboarding completed successfully",
                "workoutDays", workoutPlan.getWorkoutDays().size(),
                "daysPerWeek", workoutPlan.getDaysPerWeek()
        ));
    }
getOnboardingStatus method · java · L55-L59 (5 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/OnboardingController.java
    public ResponseEntity<Map<String, Boolean>> getOnboardingStatus(Authentication authentication) {
        Long userId = getUserId(authentication);
        boolean completed = onboardingService.getOnboardingStatus(userId);
        return ResponseEntity.ok(Map.of("completed", completed));
    }
getProfile method · java · L63-L81 (19 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/OnboardingController.java
    public ResponseEntity<Map<String, Object>> getProfile(Authentication authentication) {
        Long userId = getUserId(authentication);
        UserProfile profile = userProfileRepository.findByUserId(userId)
                .orElseThrow(() -> new ResourceNotFoundException("Profile not found"));

        Map<String, Object> data = new LinkedHashMap<>();
        data.put("fitnessGoal", profile.getFitnessGoal());
        data.put("experienceLevel", profile.getExperienceLevel());
        data.put("daysPerWeek", profile.getDaysPerWeek());
        data.put("sessionDurationMinutes", profile.getSessionDurationMinutes());
        data.put("equipmentAccess", profile.getEquipmentAccess());
        data.put("dietaryPreference", profile.getDietaryPreference());
        data.put("heightCm", profile.getHeightCm());
        data.put("weightKg", profile.getWeightKg());
        data.put("age", profile.getAge());
        data.put("goalDurationWeeks", profile.getGoalDurationWeeks());

        return 
updateProfile method · java · L85-L105 (21 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/OnboardingController.java
    public ResponseEntity<Map<String, String>> updateProfile(
            @Valid @RequestBody OnboardingRequest request,
            Authentication authentication) {
        Long userId = getUserId(authentication);
        UserProfile profile = userProfileRepository.findByUserId(userId)
                .orElseThrow(() -> new ResourceNotFoundException("Profile not found"));

        profile.setFitnessGoal(request.getFitnessGoal());
        profile.setExperienceLevel(request.getExperienceLevel());
        profile.setDaysPerWeek(request.getDaysPerWeek());
        profile.setSessionDurationMinutes(request.getSessionDurationMinutes());
        profile.setEquipmentAccess(request.getEquipmentAccess());
        profile.setDietaryPreference(request.getDietaryPreference());
        profile.setHeightCm(request.getHeightCm());
        profile.setWeightKg(request.getWeightKg());
        profile.setAge(request.getAge());
        profile.setGoalDurationWeeks(request.getGoalDurationWeeks());
        u
getUserId method · java · L107-L112 (6 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/OnboardingController.java
    private Long getUserId(Authentication authentication) {
        String email = authentication.getName();
        User user = userRepository.findByEmail(email)
                .orElseThrow(() -> new ResourceNotFoundException("User not found"));
        return user.getId();
    }
ProgressController class · java · L20-L52 (33 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/ProgressController.java
public class ProgressController {

    private final ProgressService progressService;
    private final UserRepository userRepository;

    public ProgressController(ProgressService progressService, UserRepository userRepository) {
        this.progressService = progressService;
        this.userRepository = userRepository;
    }

    @GetMapping("/dashboard")
    @Operation(summary = "Get dashboard", description = "Returns summary dashboard data including adherence, streaks, and recent activity")
    public ResponseEntity<DashboardResponse> getDashboard(Authentication authentication) {
        Long userId = getUserId(authentication);
        DashboardResponse dashboard = progressService.getDashboard(userId);
        return ResponseEntity.ok(dashboard);
    }

    @GetMapping("/export")
    @Operation(summary = "Export progress data", description = "Returns weight trend, weekly adherence, and plan history for charts")
    public ResponseEntity<ProgressResponse> exportProgress(Authentic
Want this analysis on your repo? https://repobility.com/scan/
ProgressController method · java · L25-L28 (4 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/ProgressController.java
    public ProgressController(ProgressService progressService, UserRepository userRepository) {
        this.progressService = progressService;
        this.userRepository = userRepository;
    }
getDashboard method · java · L32-L36 (5 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/ProgressController.java
    public ResponseEntity<DashboardResponse> getDashboard(Authentication authentication) {
        Long userId = getUserId(authentication);
        DashboardResponse dashboard = progressService.getDashboard(userId);
        return ResponseEntity.ok(dashboard);
    }
exportProgress method · java · L40-L44 (5 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/ProgressController.java
    public ResponseEntity<ProgressResponse> exportProgress(Authentication authentication) {
        Long userId = getUserId(authentication);
        ProgressResponse progress = progressService.getProgressData(userId);
        return ResponseEntity.ok(progress);
    }
getUserId method · java · L46-L51 (6 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/ProgressController.java
    private Long getUserId(Authentication authentication) {
        String email = authentication.getName();
        User user = userRepository.findByEmail(email)
                .orElseThrow(() -> new ResourceNotFoundException("User not found"));
        return user.getId();
    }
SavedSplitController class · java · L24-L95 (72 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/SavedSplitController.java
public class SavedSplitController {

    private final SavedSplitRepository savedSplitRepository;
    private final UserRepository userRepository;
    private final ObjectMapper objectMapper;

    public SavedSplitController(SavedSplitRepository savedSplitRepository,
                                UserRepository userRepository,
                                ObjectMapper objectMapper) {
        this.savedSplitRepository = savedSplitRepository;
        this.userRepository = userRepository;
        this.objectMapper = objectMapper;
    }

    @GetMapping
    @Operation(summary = "List saved splits", description = "Returns all saved workout splits for the authenticated user")
    public ResponseEntity<List<SavedSplit>> listSavedSplits(Authentication authentication) {
        User user = getUser(authentication);
        List<SavedSplit> splits = savedSplitRepository.findByUserOrderByCreatedAtDesc(user);
        return ResponseEntity.ok(splits);
    }

    @PostMapping
    @Operation(summ
SavedSplitController method · java · L30-L36 (7 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/SavedSplitController.java
    public SavedSplitController(SavedSplitRepository savedSplitRepository,
                                UserRepository userRepository,
                                ObjectMapper objectMapper) {
        this.savedSplitRepository = savedSplitRepository;
        this.userRepository = userRepository;
        this.objectMapper = objectMapper;
    }
listSavedSplits method · java · L40-L44 (5 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/SavedSplitController.java
    public ResponseEntity<List<SavedSplit>> listSavedSplits(Authentication authentication) {
        User user = getUser(authentication);
        List<SavedSplit> splits = savedSplitRepository.findByUserOrderByCreatedAtDesc(user);
        return ResponseEntity.ok(splits);
    }
createSavedSplit method · java · L48-L70 (23 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/SavedSplitController.java
    public ResponseEntity<SavedSplit> createSavedSplit(
            @RequestBody Map<String, Object> body,
            Authentication authentication) {
        User user = getUser(authentication);

        SavedSplit split = new SavedSplit();
        split.setUser(user);
        split.setName((String) body.get("name"));

        Object days = body.get("days");
        if (days instanceof String) {
            split.setDays((String) days);
        } else {
            try {
                split.setDays(objectMapper.writeValueAsString(days));
            } catch (JsonProcessingException e) {
                throw new com.adaptivefit.exception.BadRequestException("Invalid days JSON");
            }
        }

        SavedSplit saved = savedSplitRepository.save(split);
        return ResponseEntity.status(HttpStatus.CREATED).body(saved);
    }
About: code-quality intelligence by Repobility · https://repobility.com
deleteSavedSplit method · java · L75-L88 (14 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/SavedSplitController.java
    public ResponseEntity<Map<String, String>> deleteSavedSplit(
            @PathVariable Long id,
            Authentication authentication) {
        User user = getUser(authentication);
        SavedSplit split = savedSplitRepository.findById(id)
                .orElseThrow(() -> new ResourceNotFoundException("Saved split not found"));

        if (!split.getUser().getId().equals(user.getId())) {
            throw new ResourceNotFoundException("Saved split not found");
        }

        savedSplitRepository.delete(split);
        return ResponseEntity.ok(Map.of("message", "Saved split deleted successfully"));
    }
getUser method · java · L90-L94 (5 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/SavedSplitController.java
    private User getUser(Authentication authentication) {
        String email = authentication.getName();
        return userRepository.findByEmail(email)
                .orElseThrow(() -> new ResourceNotFoundException("User not found"));
    }
WorkoutController class · java · L25-L93 (69 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/WorkoutController.java
public class WorkoutController {

    private final WorkoutService workoutService;
    private final UserRepository userRepository;

    public WorkoutController(WorkoutService workoutService, UserRepository userRepository) {
        this.workoutService = workoutService;
        this.userRepository = userRepository;
    }

    @GetMapping("/week")
    @Operation(summary = "Get weekly schedule", description = "Returns the current week's workout schedule with day details")
    public ResponseEntity<Map<String, Object>> getWeeklySchedule(Authentication authentication) {
        Long userId = getUserId(authentication);
        return ResponseEntity.ok(workoutService.getWeeklySchedule(userId));
    }

    @GetMapping("/day/{dayId}")
    @Operation(summary = "Get day detail", description = "Returns detailed exercises for a specific workout day")
    public ResponseEntity<Map<String, Object>> getDayDetail(
            @PathVariable Long dayId,
            Authentication authentication) {
    
WorkoutController method · java · L30-L33 (4 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/WorkoutController.java
    public WorkoutController(WorkoutService workoutService, UserRepository userRepository) {
        this.workoutService = workoutService;
        this.userRepository = userRepository;
    }
getWeeklySchedule method · java · L37-L40 (4 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/WorkoutController.java
    public ResponseEntity<Map<String, Object>> getWeeklySchedule(Authentication authentication) {
        Long userId = getUserId(authentication);
        return ResponseEntity.ok(workoutService.getWeeklySchedule(userId));
    }
getDayDetail method · java · L44-L49 (6 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/WorkoutController.java
    public ResponseEntity<Map<String, Object>> getDayDetail(
            @PathVariable Long dayId,
            Authentication authentication) {
        Long userId = getUserId(authentication);
        return ResponseEntity.ok(workoutService.getDayDetail(userId, dayId));
    }
completeWorkout method · java · L53-L58 (6 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/WorkoutController.java
    public ResponseEntity<Map<String, Object>> completeWorkout(
            @Valid @RequestBody WorkoutLogRequest request,
            Authentication authentication) {
        Long userId = getUserId(authentication);
        return ResponseEntity.ok(workoutService.completeWorkout(userId, request));
    }
getAlternativeExercises method · java · L71-L76 (6 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/WorkoutController.java
    public ResponseEntity<List<Map<String, Object>>> getAlternativeExercises(
            @PathVariable Long exerciseId,
            Authentication authentication) {
        Long userId = getUserId(authentication);
        return ResponseEntity.ok(workoutService.getAlternativeExercises(userId, exerciseId));
    }
Want fix-PRs on findings? Install Repobility's GitHub App · github.com/apps/repobility-bot
substituteExercise method · java · L80-L85 (6 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/WorkoutController.java
    public ResponseEntity<Map<String, Object>> substituteExercise(
            @Valid @RequestBody SubstituteExerciseRequest request,
            Authentication authentication) {
        Long userId = getUserId(authentication);
        return ResponseEntity.ok(workoutService.substituteExercise(userId, request));
    }
getUserId method · java · L87-L92 (6 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/WorkoutController.java
    private Long getUserId(Authentication authentication) {
        String email = authentication.getName();
        User user = userRepository.findByEmail(email)
                .orElseThrow(() -> new ResourceNotFoundException("User not found"));
        return user.getId();
    }
WorkoutPlanController class · java · L25-L315 (291 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/WorkoutPlanController.java
public class WorkoutPlanController {

    private final WorkoutPlanRepository workoutPlanRepository;
    private final UserRepository userRepository;

    public WorkoutPlanController(WorkoutPlanRepository workoutPlanRepository, UserRepository userRepository) {
        this.workoutPlanRepository = workoutPlanRepository;
        this.userRepository = userRepository;
    }

    @GetMapping("/current")
    @Operation(summary = "Get current plan", description = "Returns the user's currently active workout plan")
    public ResponseEntity<WorkoutPlanResponse> getCurrentPlan(Authentication authentication) {
        Long userId = getUserId(authentication);
        WorkoutPlan plan = workoutPlanRepository.findByUserIdAndStatus(userId, PlanStatus.ACTIVE)
                .orElseThrow(() -> new ResourceNotFoundException("No active workout plan found"));
        return ResponseEntity.ok(WorkoutPlanResponse.fromEntity(plan));
    }

    @GetMapping("/history")
    @Operation(summary = "Get plan his
WorkoutPlanController method · java · L30-L33 (4 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/WorkoutPlanController.java
    public WorkoutPlanController(WorkoutPlanRepository workoutPlanRepository, UserRepository userRepository) {
        this.workoutPlanRepository = workoutPlanRepository;
        this.userRepository = userRepository;
    }
getCurrentPlan method · java · L37-L42 (6 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/WorkoutPlanController.java
    public ResponseEntity<WorkoutPlanResponse> getCurrentPlan(Authentication authentication) {
        Long userId = getUserId(authentication);
        WorkoutPlan plan = workoutPlanRepository.findByUserIdAndStatus(userId, PlanStatus.ACTIVE)
                .orElseThrow(() -> new ResourceNotFoundException("No active workout plan found"));
        return ResponseEntity.ok(WorkoutPlanResponse.fromEntity(plan));
    }
getPlanHistory method · java · L46-L53 (8 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/WorkoutPlanController.java
    public ResponseEntity<List<WorkoutPlanResponse>> getPlanHistory(Authentication authentication) {
        Long userId = getUserId(authentication);
        List<WorkoutPlan> plans = workoutPlanRepository.findByUserIdOrderByVersionDesc(userId);
        List<WorkoutPlanResponse> responses = plans.stream()
                .map(WorkoutPlanResponse::fromEntity)
                .toList();
        return ResponseEntity.ok(responses);
    }
getPlanById method · java · L57-L67 (11 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/WorkoutPlanController.java
    public ResponseEntity<WorkoutPlanResponse> getPlanById(
            @PathVariable Long planId,
            Authentication authentication) {
        Long userId = getUserId(authentication);
        WorkoutPlan plan = workoutPlanRepository.findById(planId)
                .orElseThrow(() -> new ResourceNotFoundException("Workout plan not found"));
        if (!plan.getUserId().equals(userId)) {
            throw new ResourceNotFoundException("Workout plan not found");
        }
        return ResponseEntity.ok(WorkoutPlanResponse.fromEntity(plan));
    }
updateRoutine method · java · L73-L123 (51 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/WorkoutPlanController.java
    public ResponseEntity<Map<String, Object>> updateRoutine(
            @RequestBody Map<String, Object> body,
            Authentication authentication) {
        Long userId = getUserId(authentication);
        WorkoutPlan plan = workoutPlanRepository.findByUserIdAndStatus(userId, PlanStatus.ACTIVE)
                .orElseThrow(() -> new ResourceNotFoundException("No active workout plan found"));

        Object routineObj = body.get("workoutRoutine");
        if (!(routineObj instanceof List)) {
            throw new BadRequestException("workoutRoutine must be an array");
        }

        List<Map<String, Object>> routine = (List<Map<String, Object>>) routineObj;

        // Clear existing days (cascade will remove exercises)
        plan.getWorkoutDays().clear();

        // Create new days and exercises from the routine
        for (Map<String, Object> dayData : routine) {
            WorkoutDay day = new WorkoutDay();
            day.setWorkoutPlan(plan);
            day.setD
Generated by Repobility's multi-pass static-analysis pipeline (https://repobility.com)
getPresets method · java · L127-L136 (10 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/WorkoutPlanController.java
    public ResponseEntity<List<Map<String, Object>>> getPresets() {
        List<Map<String, Object>> presets = List.of(
                Map.of("key", "ppl", "name", "Push / Pull / Legs", "description", "Classic 3-day split", "days", 3),
                Map.of("key", "upper_lower", "name", "Upper / Lower", "description", "4-day upper lower split", "days", 4),
                Map.of("key", "full_body", "name", "Full Body", "description", "3 full body sessions", "days", 3),
                Map.of("key", "bro_split", "name", "Bro Split", "description", "5-day bodypart split", "days", 5)
        );

        return ResponseEntity.ok(presets);
    }
generateFromPreset method · java · L140-L163 (24 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/WorkoutPlanController.java
    public ResponseEntity<Map<String, Object>> generateFromPreset(
            @RequestBody Map<String, String> body,
            Authentication authentication) {
        // Validate user is authenticated
        getUserId(authentication);

        String presetKey = body.get("presetKey");
        String equipment = body.getOrDefault("equipment", "gym");
        String goal = body.getOrDefault("goal", "general");

        if (presetKey == null) {
            throw new BadRequestException("presetKey is required");
        }

        List<Map<String, Object>> workoutRoutine = generatePresetRoutine(presetKey, equipment, goal);

        Map<String, Object> response = new LinkedHashMap<>();
        response.put("presetKey", presetKey);
        response.put("equipment", equipment);
        response.put("goal", goal);
        response.put("workoutRoutine", workoutRoutine);

        return ResponseEntity.ok(response);
    }
generatePresetRoutine method · java · L165-L279 (115 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/WorkoutPlanController.java
    private List<Map<String, Object>> generatePresetRoutine(String presetKey, String equipment, String goal) {
        return switch (presetKey) {
            case "ppl" -> List.of(
                    buildDay(1, "Push", "push", List.of(
                            buildExercise("Bench Press", "Chest", 4, 8),
                            buildExercise("Overhead Press", "Shoulders", 3, 10),
                            buildExercise("Incline Dumbbell Press", "Chest", 3, 10),
                            buildExercise("Lateral Raises", "Shoulders", 3, 15),
                            buildExercise("Tricep Pushdowns", "Triceps", 3, 12)
                    )),
                    buildDay(2, "Pull", "pull", List.of(
                            buildExercise("Barbell Rows", "Back", 4, 8),
                            buildExercise("Pull-Ups", "Back", 3, 8),
                            buildExercise("Face Pulls", "Rear Delts", 3, 15),
                            buildExercise("Barbell Curls", "
buildDay method · java · L281-L288 (8 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/WorkoutPlanController.java
    private Map<String, Object> buildDay(int day, String title, String splitType, List<Map<String, Object>> exercises) {
        Map<String, Object> dayMap = new LinkedHashMap<>();
        dayMap.put("day", day);
        dayMap.put("title", title);
        dayMap.put("splitType", splitType);
        dayMap.put("exercises", exercises);
        return dayMap;
    }
buildExercise method · java · L290-L297 (8 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/WorkoutPlanController.java
    private Map<String, Object> buildExercise(String name, String muscleGroup, int sets, int reps) {
        Map<String, Object> exercise = new LinkedHashMap<>();
        exercise.put("name", name);
        exercise.put("muscleGroup", muscleGroup);
        exercise.put("sets", sets);
        exercise.put("reps", reps);
        return exercise;
    }
getUserId method · java · L299-L304 (6 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/WorkoutPlanController.java
    private Long getUserId(Authentication authentication) {
        String email = authentication.getName();
        User user = userRepository.findByEmail(email)
                .orElseThrow(() -> new ResourceNotFoundException("User not found"));
        return user.getId();
    }
toInt method · java · L306-L314 (9 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/controller/WorkoutPlanController.java
    private int toInt(Object value) {
        if (value instanceof Integer) {
            return (Integer) value;
        }
        if (value instanceof Number) {
            return ((Number) value).intValue();
        }
        return Integer.parseInt(String.valueOf(value));
    }
ChangePasswordRequest class · java · L10-L18 (9 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/dto/request/ChangePasswordRequest.java
public class ChangePasswordRequest {

    @NotBlank(message = "Current password is required")
    private String currentPassword;

    @NotBlank(message = "New password is required")
    @Size(min = 8, message = "New password must be at least 8 characters")
    private String newPassword;
}
Want this analysis on your repo? https://repobility.com/scan/
CheckInRequest class · java · L13-L31 (19 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/dto/request/CheckInRequest.java
public class CheckInRequest {

    @NotNull
    @Min(1)
    private Integer weekNumber;

    @NotNull
    @Min(0)
    private Integer sessionsCompleted;

    @NotNull
    @Min(1)
    @Max(5)
    private Integer difficultyRating;

    private BigDecimal currentWeightKg;

    private String notes;
}
ExtraWorkoutRequest class · java · L11-L23 (13 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/dto/request/ExtraWorkoutRequest.java
public class ExtraWorkoutRequest {

    private List<ExerciseEntry> exercises;

    @Getter
    @Setter
    public static class ExerciseEntry {
        private String name;
        private Integer sets;
        private String reps;
        private BigDecimal weightKg;
    }
}
ExerciseEntry class · java · L17-L22 (6 LOC)
adaptivefit-api/src/main/java/com/adaptivefit/dto/request/ExtraWorkoutRequest.java
    public static class ExerciseEntry {
        private String name;
        private Integer sets;
        private String reps;
        private BigDecimal weightKg;
    }
‹ prevpage 2 / 6next ›