Skip to content

homework done Sevinj&Lala#66

Open
Sevinc1003 wants to merge 25 commits intoironhack-labs:mainfrom
Sevinc1003:main
Open

homework done Sevinj&Lala#66
Sevinc1003 wants to merge 25 commits intoironhack-labs:mainfrom
Sevinc1003:main

Conversation

@Sevinc1003
Copy link
Copy Markdown

No description provided.

@RequestMapping("/courses")
public class CourseController {

private static CourseService courseService;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are missing on the controllers dependency injection:
public CourseController(CourseService courseService) {
this.courseService = courseService;
}

The same for Student and Teacher controllers.

import az.ironschool.ironschool.entities.Course;
import az.ironschool.ironschool.entities.Teacher;
import az.ironschool.ironschool.utils.Logging;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add @service to both classes. Without it, Spring's component scan doesn't register them.

import java.util.List;
import java.util.Map;

public class TeacherService {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add @service to both classes. Without it, Spring's component scan doesn't register them.

@Service
public class StudentService {

private static Map<String, Student> students;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private final Map<String, Student> students = new HashMap<>();

All 3 Map fields (in the 3 different services) are declared but never initialized — they're null.



@GetMapping("/lookup/{id}")
public Course lookupCourse(@PathVariable String courseId){
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GetMapping("/lookup/{id}") and @PathVariable String courseId have to match. Either id or courseId

Check other controllers for the same pattern.

@NotBlank(message = "name bos ola bilmez")
private String name;

@NotBlank(message = "price bos ola bilmez")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you are using double use another annotation like @positive or @min()

@ahpoise
Copy link
Copy Markdown

ahpoise commented Mar 12, 2026

It would also be good to have some exception handling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants