Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.minerva.api.service;

import io.minerva.api.component.CurrentUser;
import io.minerva.api.exceptions.EntityNotFoundException;
import io.minerva.api.exceptions.UnauthorizedException;
import io.minerva.api.model.data.node.Clazz;
import io.minerva.api.model.data.node.StudyPlan;
Expand Down Expand Up @@ -106,7 +107,7 @@ public StudyPlanDto getStudyPlan(UUID classId) {
Clazz clazz = getAuthorizedClass(classId);
StudyPlan plan = studyPlanRepository.findByClassId(classId)
.orElseThrow(
() -> new RuntimeException("No study plan found for this class"));
() -> new EntityNotFoundException("No study plan found for this class"));
return computeDto(clazz, plan);
}

Expand All @@ -126,7 +127,7 @@ public StudyPlanDto updateStudyPlan(UUID classId, UpdateStudyPlanRequestDto requ
Clazz clazz = getAuthorizedClass(classId);
StudyPlan plan = studyPlanRepository.findByClassId(classId)
.orElseThrow(
() -> new RuntimeException("No study plan found for this class"));
() -> new EntityNotFoundException("No study plan found for this class"));

plan.setDailyGoalOverride(request.getDailyGoalOverride());
studyPlanRepository.save(plan);
Expand All @@ -145,7 +146,7 @@ public void deleteStudyPlan(UUID classId) {
getAuthorizedClass(classId);
StudyPlan plan = studyPlanRepository.findByClassId(classId)
.orElseThrow(
() -> new RuntimeException("No study plan found for this class"));
() -> new EntityNotFoundException("No study plan found for this class"));
studyPlanRepository.deleteStudyPlanById(plan.getId());
}

Expand Down
2 changes: 1 addition & 1 deletion minerva-hub/src/pages/app/ClassDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function ClassDetailPage() {

const {data: classData, isLoading: isLoadingClass} = useClass(id!);
const {data: topics, isLoading: isLoadingTopics} = useTopics(id);
const {data: studyPlan, isError: studyPlanNotFound} = useStudyPlan(id);
const {data: studyPlan, isError: studyPlanNotFound} = useStudyPlan(classData?.examDate ? id : undefined);
const createTopicMutation = useCreateTopic();
const updateTopicMutation = useUpdateTopic();
const deleteTopicMutation = useDeleteTopic();
Expand Down
Loading