Repository: Learnathon-By-Geeky-Solutions/binarybrain
Pull request #29: Automatically Seed Initial Roles on Application Startup
Author: login: bayazidHossain2
Created: 2025-04-14T01:53:06Z | Merged: 2025-04-14T04:46:36Z

If 'ADMIN', 'TEACHER', 'STUDENT' role is not exist in the ROLE table then insert these role name automatically.


Diff:
diff --git a/classroom-microservice/src/main/java/com/binarybrain/classroom/controller/ClassroomController.java b/classroom-microservice/src/main/java/com/binarybrain/classroom/controller/ClassroomController.java
index d734572b1..c2e2fa85d 100644
--- a/classroom-microservice/src/main/java/com/binarybrain/classroom/controller/ClassroomController.java
+++ b/classroom-microservice/src/main/java/com/binarybrain/classroom/controller/ClassroomController.java
@@ -89,6 +89,14 @@ public ResponseEntity<Classroom> addCourseToClassroom(@PathVariable Long classro
         return new ResponseEntity<>(classroom, HttpStatus.OK);
     }
 
+    @DeleteMapping("/{classroomId}/remove-course/{courseId}")
+    ResponseEntity<Classroom> removeCourseFromClassroomById(@PathVariable Long classroomId,
+                                                             @PathVariable Long courseId,
+                                                             @RequestHeader("X-User-Username") String username){
+        Classroom classroom = classroomService.removeCourseFromClassroomById(classroomId, courseId, username);
+        return new ResponseEntity<>(classroom, HttpStatus.OK);
+    }
+
     @GetMapping("/{classroomId}/courses")
     public ResponseEntity<List<CourseDto>> getAllCourseInClassroom(@PathVariable Long classroomId,
                                                                    @RequestHeader("X-User-Username") String username) {
diff --git a/classroom-microservice/src/main/java/com/binarybrain/classroom/service/ClassroomService.java b/classroom-microservice/src/main/java/com/binarybrain/classroom/service/ClassroomService.java
index cabb607b9..0da036371 100644
--- a/classroom-microservice/src/main/java/com/binarybrain/classroom/service/ClassroomService.java
+++ b/classroom-microservice/src/main/java/com/binarybrain/classroom/service/ClassroomService.java
@@ -18,5 +18,6 @@ public interface ClassroomService {
     Classroom removeStudentFromClassroomById(Long classroomId, Long studentId, String username);
     List<Classroom> getClassroomsByStudentId(Long studentId);
     Classroom addCourseToClassroom(Long classroomId, Long courseId, String username);
+    Classroom removeCourseFromClassroomById(Long classroomId, Long courseId, String username);
     List<CourseDto> getAllCourseInClassroom(Long classroomId, String username);
 }
diff --git a/classroom-microservice/src/main/java/com/binarybrain/classroom/service/impl/ClassroomserviceImpl.java b/classroom-microservice/src/main/java/com/binarybrain/classroom/service/impl/ClassroomserviceImpl.java
index f5d270d38..46f9872e9 100644
--- a/classroom-microservice/src/main/java/com/binarybrain/classroom/service/impl/ClassroomserviceImpl.java
+++ b/classroom-microservice/src/main/java/com/binarybrain/classroom/service/impl/ClassroomserviceImpl.java
@@ -132,6 +132,25 @@ public Classroom addCourseToClassroom(Long classroomId, Long courseId, String us
         return classroomRepository.save(classroom);
     }
 
+    @Override
+    public Classroom removeCourseFromClassroomById(Long classroomId, Long courseId, String username) {
+        try {
+            Classroom classroom = getClassroomById(classroomId, username);
+            validateClassroomModificationPermission(classroom, username);
+
+            if (!classroom.getCourseIds().contains(courseId)) {
+                throw new ResourceNotFoundException("This Course is not added in this classroom!");
+            }
+            Set<Long> courseIds = new HashSet<>(Set.copyOf(classroom.getCourseIds()));
+            courseIds.remove(courseId);
+            classroom.setCourseIds(courseIds);
+            return classroomRepository.save(classroom);
+
+        }catch (FeignException.BadRequest e){
+            throw new ResourceNotFoundException("Course not found with id: " + courseId);
+        }
+    }
+
     @Override
     public List<CourseDto> getAllCourseInClassroom(Long classroomId, String username) {
         Classroom classroom = getClassroomById(classroomId, username);
diff --git a/classroom-microservice/src/test/java/com/binarybrain/classroom/controller/ClassroomControllerTest.java b/classroom-microservice/src/test/java/com/binarybrain/classroom/controller/ClassroomControllerTest.java
index c23d6f092..906a005ff 100644
--- a/classroom-microservice/src/test/java/com/binarybrain/classroom/controller/ClassroomControllerTest.java
+++ b/classroom-microservice/src/test/java/com/binarybrain/classroom/controller/ClassroomControllerTest.java
@@ -23,8 +23,7 @@
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.*;
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
 
 @ActiveProfiles("test")
 @SpringBootTest
@@ -38,6 +37,7 @@ class ClassroomControllerTest {
     private static final Long CLASSROOM_ID_1 = 1L;
     private static final Long CLASSROOM_ID_2 = 2L;
     private static final Long CLASSROOM_ID_3 = 3L;
+    private static final Long CLASSROOM_ID_4 = 4L;
     private static final Long COURSE_ID = 1L;
 
     @Autowired
@@ -61,6 +61,7 @@ class ClassroomControllerTest {
     private Classroom classroom1;
     private Classroom classroom2;
     private Classroom classroom3;
+    private Classroom classroom4;
 
     @BeforeEach
     void setUp() {
@@ -79,6 +80,7 @@ private void initializeTestData() {
         classroom1 = createClassroom(CLASSROOM_ID_1, "Classroom 1", TEACHER_ID, Set.of(STUDENT_ID), null);
         classroom2 = createClassroom(CLASSROOM_ID_2, "Classroom 2", TEACHER_ID, Set.of(STUDENT_ID), null);
         classroom3 = createClassroom(CLASSROOM_ID_3, "Classroom 3", TEACHER_ID, Set.of(STUDENT_ID, NEW_STUDENT_ID), null);
+        classroom4 = createClassroom(CLASSROOM_ID_4, "Classroom 4", TEACHER_ID, Set.of(STUDENT_ID, NEW_STUDENT_ID), Set.of(COURSE_ID));
     }
 
     private UserDto createUserDto(Long id, String firstName, String lastName, String username, String email, String roleName, Long roleId) {
@@ -124,6 +126,7 @@ private void setupClassroomMocks() {
         when(classroomRepository.findById(CLASSROOM_ID_1)).thenReturn(Optional.of(classroom1));
         when(classroomRepository.findById(CLASSROOM_ID_2)).thenReturn(Optional.of(classroom2));
         when(classroomRepository.findById(CLASSROOM_ID_3)).thenReturn(Optional.of(classroom3));
+        when(classroomRepository.findById(CLASSROOM_ID_4)).thenReturn(Optional.of(classroom4));
         when(classroomRepository.findByTeacherId(TEACHER_ID)).thenReturn(List.of(classroom1));
         when(classroomRepository.findByStudentIdsContaining(STUDENT_ID)).thenReturn(List.of(classroom1));
         when(classroomRepository.save(any(Classroom.class))).thenAnswer(invocation -> invocation.getArgument(0));
@@ -221,6 +224,17 @@ void addCourseToClassroom() throws Exception {
                 .andExpect(content().json(asJsonString(updatedClassroom)));
     }
 
+    @Test
+    void removeCourseFromClassroomById() throws Exception {
+        Classroom updatedClassroom = createClassroom(CLASSROOM_ID_4, "Classroom 4", TEACHER_ID, Set.of(STUDENT_ID, NEW_STUDENT_ID), Set.of());
+        when(classroomRepository.save(classroom4)).thenReturn(updatedClassroom);
+
+        mockMvc.perform(delete("/api/v1/private/classroom/" + CLASSROOM_ID_4 + "/remove-course/" + COURSE_ID)
+                        .header("X-User-Username", TEACHER_USERNAME))
+                .andExpect(status().isOk())
+                .andExpect(content().json(asJsonString(updatedClassroom)));
+    }
+
     @Test
     void getAllCourseInClassroom() throws Exception {
         Classroom classroomWithCourse = createClassroom(CLASSROOM_ID_3, "Classroom 3", TEACHER_ID, Set.of(STUDENT_ID, NEW_STUDENT_ID), Set.of(COURSE_ID));
diff --git a/classroom-microservice/src/test/java/com/binarybrain/classroom/service/ClassroomServiceImplTest.java b/classroom-microservice/src/test/java/com/binarybrain/classroom/service/ClassroomServiceImplTest.java
index dc2e2f1df..542e423a2 100644
--- a/classroom-microservice/src/test/java/com/binarybrain/classroom/service/ClassroomServiceImplTest.java
+++ b/classroom-microservice/src/test/java/com/binarybrain/classroom/service/ClassroomServiceImplTest.java
@@ -271,6 +271,33 @@ void addCourseToClassroom_WhenCourseAlreadyExists_ShouldThrowException() {
         verify(classroomRepository, never()).save(any());
     }
 
+    @Test
+    void removeCourseFromClassroomById_ShouldRemoveCourse() {
+        classroom.getCourseIds().add(3L);
+        when(userService.getUserProfile("teacher")).thenReturn(teacher);
+        when(classroomRepository.findById(1L)).thenReturn(Optional.of(classroom));
+        when(classroomRepository.save(any(Classroom.class))).thenReturn(classroom);
+
+        Classroom result = classroomService.removeCourseFromClassroomById(1L, 3L, "teacher");
+
+        assertFalse(result.getCourseIds().contains(3L));
+    }
+
+    @Test
+    void removeCourseFromClassroomById_WhenCourseNotInClassroom_ShouldThrowNotFoundException() {
+        classroom.getCourseIds().add(99L);
+        when(userService.getUserProfile("teacher")).thenReturn(teacher);
+        when(classroomRepository.findById(1L)).thenReturn(Optional.of(classroom));
+
+        ResourceNotFoundException exception = assertThrows(
+                ResourceNotFoundException.class,
+                () -> classroomService.removeCourseFromClassroomById(1L, 100L, "teacher")
+        );
+
+        assertEquals("This Course is not added in this classroom!", exception.getMessage());
+        verify(classroomRepository, never()).save(any());
+    }
+
     @Test
     void getAllCourseInClassroom_ShouldReturnCourses() {
         classroom.getCourseIds().add(1L);
diff --git a/online-classroom-management/src/main/java/com/binarybrain/user/config/DataInitializer.java b/online-classroom-management/src/main/java/com/binarybrain/user/config/DataInitializer.java
new file mode 100644
index 000000000..03b409bbd
--- /dev/null
+++ b/online-classroom-management/src/main/java/com/binarybrain/user/config/DataInitializer.java
@@ -0,0 +1,30 @@
+package com.binarybrain.user.config;
+
+import com.binarybrain.user.model.Role;
+import com.binarybrain.user.repository.RoleRepository;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.stereotype.Component;
+
+@Component
+public class DataInitializer implements CommandLineRunner {
+
+    private final RoleRepository roleRepository;
+
+    public DataInitializer(RoleRepository roleRepository) {
+        this.roleRepository = roleRepository;
+    }
+
+    @Override
+    public void run(String... args) {
+        createRoleIfNotExist("ADMIN");
+        createRoleIfNotExist("TEACHER");
+        createRoleIfNotExist("STUDENT");
+    }
+
+    private void createRoleIfNotExist(String roleName){
+        roleRepository.findByName(roleName)
+                .orElseGet(() ->
+                        roleRepository.save(new Role(roleName))
+                );
+    }
+}


Reviews:
user: login: coderabbitai[bot]
body: **Actionable comments posted: 2**

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: ASSERTIVE**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between af8ff3ee3fd889567ff4a69225f872219dab4ced and cf60ae91926f8f82576f51765f921fe8be8f1490.

</details>

<details>
<summary>📒 Files selected for processing (6)</summary>

* `classroom-microservice/src/main/java/com/binarybrain/classroom/controller/ClassroomController.java` (1 hunks)
* `classroom-microservice/src/main/java/com/binarybrain/classroom/service/ClassroomService.java` (1 hunks)
* `classroom-microservice/src/main/java/com/binarybrain/classroom/service/impl/ClassroomserviceImpl.java` (1 hunks)
* `classroom-microservice/src/test/java/com/binarybrain/classroom/controller/ClassroomControllerTest.java` (6 hunks)
* `classroom-microservice/src/test/java/com/binarybrain/classroom/service/ClassroomServiceImplTest.java` (1 hunks)
* `online-classroom-management/src/main/java/com/binarybrain/user/config/DataInitializer.java` (1 hunks)

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (2)</summary>

* GitHub Check: build-and-analyze
* GitHub Check: Analyze (java-kotlin)

</details>

<details>
<summary>🔇 Additional comments (9)</summary><blockquote>

<details>
<summary>classroom-microservice/src/main/java/com/binarybrain/classroom/service/ClassroomService.java (1)</summary>

`21-21`: **METHOD INTERFACE ADDITION DETECTED.**

ANALYSIS COMPLETE. NEW METHOD SIGNATURE FOLLOWS EXISTING API DESIGN PATTERNS. PARAMETER TYPES AND NAMING CONVENTIONS MAINTAIN CONSISTENCY WITH RELATED METHODS SUCH AS `removeStudentFromClassroomById` AND `addCourseToClassroom`.

</details>
<details>
<summary>classroom-microservice/src/main/java/com/binarybrain/classroom/controller/ClassroomController.java (1)</summary>

`92-98`: **ENDPOINT IMPLEMENTATION SATISFIES REQUIREMENTS.**

CONTROLLER METHOD IMPLEMENTATION FOLLOWS ESTABLISHED PATTERNS:
- DELETE HTTP METHOD CORRECTLY UTILIZED FOR RESOURCE REMOVAL
- PATH VARIABLE EXTRACTION MATCHES EXISTING ENDPOINTS
- PROPER SERVICE DELEGATION OBSERVED
- RESPONSE ENTITY CONSTRUCTION FOLLOWS CONTROLLER CONVENTIONS

</details>
<details>
<summary>classroom-microservice/src/main/java/com/binarybrain/classroom/service/impl/ClassroomserviceImpl.java (1)</summary>

`135-152`: **SERVICE IMPLEMENTATION LOGIC VERIFIED.**

METHOD EXECUTION SEQUENCE VALIDATED:
1. CLASSROOM RETRIEVAL OPERATION
2. PERMISSION VALIDATION CHECK
3. COURSE EXISTENCE VERIFICATION
4. COLLECTION MANIPULATION
5. PERSISTENCE OPERATION
6. EXCEPTION HANDLING PROTOCOL

CODE MAINTAINS CONSISTENT ERROR HANDLING PATTERN WITH RELATED METHODS. SECURITY VALIDATION IS PROPERLY IMPLEMENTED.

</details>
<details>
<summary>classroom-microservice/src/test/java/com/binarybrain/classroom/service/ClassroomServiceImplTest.java (1)</summary>

`286-299`: **TEST CASE LOGIC IS OPERATIONAL. NO ISSUES DETECTED.**

THIS TEST CORRECTLY VERIFIES THAT ATTEMPTING TO REMOVE NON-EXISTENT COURSE FROM CLASSROOM THROWS APPROPRIATE EXCEPTION WITH EXPECTED MESSAGE.

</details>
<details>
<summary>classroom-microservice/src/test/java/com/binarybrain/classroom/controller/ClassroomControllerTest.java (5)</summary>

`40-40`: **CONSTANT DECLARATION ACCEPTED.**

NEW CLASSROOM ID CONSTANT PROPERLY DEFINED FOR TEST PURPOSES.

---

`64-64`: **VARIABLE DECLARATION ACCEPTED.**

CLASSROOM4 VARIABLE PROPERLY DECLARED FOR TEST CASES.

---

`83-83`: **CLASSROOM4 INITIALIZATION ACCEPTED.**

INITIALIZATION CORRECTLY INCLUDES COURSE ID IN SET. APPROPRIATE SETUP FOR COURSE REMOVAL TEST.

---

`129-129`: **MOCK SETUP ACCEPTED.**

CLASSROOM4 MOCK PROPERLY CONFIGURED TO RETURN EXPECTED VALUE.

---

`227-236`: **TEST METHOD IMPLEMENTATION ACCEPTED.**

TEST FOR REMOVING COURSE FROM CLASSROOM PERFORMS APPROPRIATE ASSERTIONS:
1. CHECKS STATUS IS OK
2. VALIDATES RESPONSE JSON MATCHES EXPECTED CLASSROOM WITHOUT COURSE

REQUEST PATH AND STRUCTURE FOLLOW CONSISTENT API DESIGN PATTERN.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: NONE
submitted_at: 2025-04-14T01:55:47Z
user: login: coderabbitai[bot]
body: **Actionable comments posted: 1**

<details>
<summary>📜 Review details</summary>

**Configuration used: CodeRabbit UI**
**Review profile: ASSERTIVE**
**Plan: Pro**

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between cf60ae91926f8f82576f51765f921fe8be8f1490 and 049baee5502d53ebcd47385a811e81463c427082.

</details>

<details>
<summary>📒 Files selected for processing (2)</summary>

* `classroom-microservice/src/test/java/com/binarybrain/classroom/service/ClassroomServiceImplTest.java` (1 hunks)
* `online-classroom-management/src/main/java/com/binarybrain/user/config/DataInitializer.java` (1 hunks)

</details>

<details>
<summary>⏰ Context from checks skipped due to timeout of 90000ms (3)</summary>

* GitHub Check: build-and-analyze
* GitHub Check: Analyze (java-kotlin)
* GitHub Check: build-and-analyze

</details>

<details>
<summary>🔇 Additional comments (2)</summary><blockquote>

<details>
<summary>classroom-microservice/src/test/java/com/binarybrain/classroom/service/ClassroomServiceImplTest.java (2)</summary>

`274-284`: **APPROPRIATE TEST IMPLEMENTATION DETECTED.**

TEST METHOD SUCCESSFULLY VERIFIES COURSE REMOVAL FUNCTIONALITY. MOCKING CONFIGURATION AND ASSERTION LOGIC ARE CORRECTLY IMPLEMENTED. LINE 283 CORRECTLY ASSERTS THAT COURSE ID IS REMOVED FROM COURSEID COLLECTION.

---

`286-299`: **EXCEPTION HANDLING TEST LOGIC PROPERLY IMPLEMENTED.**

TEST CORRECTLY VERIFIES THAT APPROPRIATE EXCEPTION IS THROWN WHEN ATTEMPTING TO REMOVE NON-EXISTENT COURSE FROM CLASSROOM. VERIFICATION THAT REPOSITORY SAVE METHOD IS NEVER CALLED IS COMMENDABLE ADDITION.

</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->
state: COMMENTED
author_association: NONE
submitted_at: 2025-04-14T02:08:58Z

Review comments:
diff_hunk: @@ -0,0 +1,30 @@
+package com.binarybrain.user.config;
+
+import com.binarybrain.user.model.Role;
+import com.binarybrain.user.repository.RoleRepository;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.stereotype.Component;
+
+@Component
+public class DataInitializer implements CommandLineRunner {
+
+    private final RoleRepository roleRepository;
+
+    public DataInitializer(RoleRepository roleRepository) {
+        this.roleRepository = roleRepository;
+    }
+
+    @Override
+    public void run(String... args) {
+        createRoleIfNotExist("ADMIN");
+        createRoleIfNotExist("TEACHER");
+        createRoleIfNotExist("STUDENT");
+    }
+
+    private void createRoleIfNotExist(String roleName){
+        roleRepository.findByName(roleName)
+                .orElseGet(()->{Role newRole = new Role(roleName);
+                    return roleRepository.save(newRole);
+                });
+    }
+}
path: online-classroom-management/src/main/java/com/binarybrain/user/config/DataInitializer.java
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**INITIALIZATION SEQUENCE IMPLEMENTATION SATISFACTORY.**

DATA INITIALIZER SUCCESSFULLY IMPLEMENTS CommandLineRunner INTERFACE FOR APPLICATION STARTUP EXECUTION. CORE ROLES "ADMIN", "TEACHER", AND "STUDENT" WILL BE AUTOMATICALLY SEEDED INTO DATABASE IF NOT PRESENT.


LAMBDA EXPRESSION CAN BE OPTIMIZED FOR IMPROVED READABILITY:

```diff
-        roleRepository.findByName(roleName)
-                .orElseGet(()->{Role newRole = new Role(roleName);
-                    return roleRepository.save(newRole);
-                });
+        roleRepository.findByName(roleName)
+                .orElseGet(() -> roleRepository.save(new Role(roleName)));
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
package com.binarybrain.user.config;

import com.binarybrain.user.model.Role;
import com.binarybrain.user.repository.RoleRepository;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class DataInitializer implements CommandLineRunner {

    private final RoleRepository roleRepository;

    public DataInitializer(RoleRepository roleRepository) {
        this.roleRepository = roleRepository;
    }

    @Override
    public void run(String... args) {
        createRoleIfNotExist("ADMIN");
        createRoleIfNotExist("TEACHER");
        createRoleIfNotExist("STUDENT");
    }

    private void createRoleIfNotExist(String roleName){
        roleRepository.findByName(roleName)
                .orElseGet(() -> roleRepository.save(new Role(roleName)));
    }
}
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->

✅ Addressed in commit 049baee
created_at: 2025-04-14T01:55:46Z
author_association: NONE
diff_hunk: @@ -271,6 +271,33 @@ void addCourseToClassroom_WhenCourseAlreadyExists_ShouldThrowException() {
         verify(classroomRepository, never()).save(any());
     }
 
+    @Test
+    void removeCourseFromClassroomById_ShouldRemoveCourse() {
+        classroom.getCourseIds().add(3L);
+        when(userService.getUserProfile("teacher")).thenReturn(teacher);
+        when(classroomRepository.findById(1L)).thenReturn(Optional.of(classroom));
+        when(classroomRepository.save(any(Classroom.class))).thenReturn(classroom);
+
+        Classroom result = classroomService.removeCourseFromClassroomById(1L, 3L, "teacher");
+
+        assertFalse(result.getStudentIds().contains(3L));
+    }
path: classroom-microservice/src/test/java/com/binarybrain/classroom/service/ClassroomServiceImplTest.java
user: login: coderabbitai[bot]
body: _⚠️ Potential issue_

**ERROR DETECTED IN ASSERTION STATEMENT. LOGIC FLAW PRESENT.**

THE TEST METHOD `removeCourseFromClassroomById_ShouldRemoveCourse` CONTAINS INCORRECT ASSERTION. LINE 283 CHECKS `result.getStudentIds().contains(3L)` WHEN IT SHOULD CHECK `result.getCourseIds().contains(3L)`. THIS IS TESTING STUDENT REMOVAL INSTEAD OF COURSE REMOVAL.


APPLY THIS FIX:
```diff
-        assertFalse(result.getStudentIds().contains(3L));
+        assertFalse(result.getCourseIds().contains(3L));
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
    @Test
    void removeCourseFromClassroomById_ShouldRemoveCourse() {
        classroom.getCourseIds().add(3L);
        when(userService.getUserProfile("teacher")).thenReturn(teacher);
        when(classroomRepository.findById(1L)).thenReturn(Optional.of(classroom));
        when(classroomRepository.save(any(Classroom.class))).thenReturn(classroom);

        Classroom result = classroomService.removeCourseFromClassroomById(1L, 3L, "teacher");

        assertFalse(result.getCourseIds().contains(3L));
    }
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->

✅ Addressed in commit 049baee
created_at: 2025-04-14T01:55:47Z
author_association: NONE
diff_hunk: @@ -0,0 +1,30 @@
+package com.binarybrain.user.config;
+
+import com.binarybrain.user.model.Role;
+import com.binarybrain.user.repository.RoleRepository;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.stereotype.Component;
+
+@Component
+public class DataInitializer implements CommandLineRunner {
+
+    private final RoleRepository roleRepository;
+
+    public DataInitializer(RoleRepository roleRepository) {
+        this.roleRepository = roleRepository;
+    }
+
+    @Override
+    public void run(String... args) {
+        createRoleIfNotExist("ADMIN");
+        createRoleIfNotExist("TEACHER");
+        createRoleIfNotExist("STUDENT");
+    }
+
+    private void createRoleIfNotExist(String roleName){
+        roleRepository.findByName(roleName)
+                .orElseGet(() ->
+                        roleRepository.save(new Role(roleName))
+                );
+    }
+}
path: online-classroom-management/src/main/java/com/binarybrain/user/config/DataInitializer.java
user: login: coderabbitai[bot]
body: _🧹 Nitpick (assertive)_

**INITIALIZATION SEQUENCE IMPLEMENTATION SATISFACTORY.**

DATA INITIALIZER SUCCESSFULLY IMPLEMENTS CommandLineRunner INTERFACE FOR APPLICATION STARTUP EXECUTION. CORE ROLES "ADMIN", "TEACHER", AND "STUDENT" WILL BE AUTOMATICALLY SEEDED INTO DATABASE IF NOT PRESENT.

SUGGESTION: ADD LOGGING STATEMENTS TO PROVIDE VISIBILITY OF ROLE CREATION PROCESS DURING APPLICATION STARTUP.



```diff
+ import org.slf4j.Logger;
+ import org.slf4j.LoggerFactory;

  @Component
  public class DataInitializer implements CommandLineRunner {
  
+     private static final Logger log = LoggerFactory.getLogger(DataInitializer.class);
      private final RoleRepository roleRepository;
      
      // ...
      
      private void createRoleIfNotExist(String roleName){
          roleRepository.findByName(roleName)
                  .orElseGet(() -> {
+                     log.info("Creating missing role: {}", roleName);
                      return roleRepository.save(new Role(roleName));
                  });
      }
```


<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

`````suggestion
package com.binarybrain.user.config;

import com.binarybrain.user.model.Role;
import com.binarybrain.user.repository.RoleRepository;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Component
public class DataInitializer implements CommandLineRunner {

    private static final Logger log = LoggerFactory.getLogger(DataInitializer.class);
    private final RoleRepository roleRepository;

    public DataInitializer(RoleRepository roleRepository) {
        this.roleRepository = roleRepository;
    }

    @Override
    public void run(String... args) {
        createRoleIfNotExist("ADMIN");
        createRoleIfNotExist("TEACHER");
        createRoleIfNotExist("STUDENT");
    }

    private void createRoleIfNotExist(String roleName) {
        roleRepository.findByName(roleName)
                .orElseGet(() -> {
                    log.info("Creating missing role: {}", roleName);
                    return roleRepository.save(new Role(roleName));
                });
    }
}
`````

</details>

<!-- suggestion_end -->

<!-- This is an auto-generated comment by CodeRabbit -->
created_at: 2025-04-14T02:08:58Z
author_association: NONE

PR comments:
user: login: Warhammer4000
created_at: 2025-04-14T01:53:15Z
body: ![](https://res.cloudinary.com/snyk/image/upload/r-d/scm-platform/snyk-pull-requests/pr-banner-default.svg)

### :tada: **Snyk checks have passed. No issues have been found so far.**

:white_check_mark: **security/snyk** check is complete. No issues have been found. [(View Details)](https://app.snyk.io/org/warhammer4000/pr-checks/7ff1d4d3-63d5-4048-96e6-465f9e086411?refs=049baee5502d53ebcd47385a811e81463c427082&source=prChecksComment)



author_association: CONTRIBUTOR
user: login: coderabbitai[bot]
created_at: 2025-04-14T01:53:16Z
body: <!-- This is an auto-generated comment: summarize by coderabbit.ai -->
<!-- walkthrough_start -->

<details>
<summary>📝 Walkthrough</summary>

## Summary by CodeRabbit

- **New Features**
	- Enhanced classroom management now allows users to remove courses from classrooms.
	- The system now automatically initializes essential user roles (Admin, Teacher, and Student) at startup.
## Walkthrough
The pull request introduces new functionality for removing a course from a classroom in the classroom microservice. A new DELETE endpoint is added to the controller, supported by corresponding additions to the service interface and its implementation. Comprehensive unit tests verify both successful removal and error handling scenarios. Additionally, a new DataInitializer class is added to the user module to initialize roles during application startup.

## Changes

| Files | Change Summary |
| --- | --- |
| `classroom-microservice/.../ClassroomController.java`, `classroom-microservice/.../ClassroomService.java`, `classroom-microservice/.../ClassroomserviceImpl.java` | Added new method `removeCourseFromClassroomById` with request handling, service logic including validation, error handling, and repository interaction for course removal from a classroom. |
| `classroom-microservice/.../ClassroomControllerTest.java`, `classroom-microservice/.../ClassroomServiceImplTest.java` | Introduced unit tests and test data to validate successful course removal and proper exception handling when the course is absent. |
| `online-classroom-management/.../DataInitializer.java` | Added a new CommandLineRunner implementation to initialize roles ("ADMIN", "TEACHER", "STUDENT") at application startup. |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant Client as HTTP Client
    participant CC as ClassroomController
    participant CS as ClassroomService
    participant CSI as ClassroomServiceImpl
    participant Repo as ClassroomRepository
    Client->>CC: DELETE /classroom/{classroomId}/course/{courseId} (with username header)
    CC->>CS: removeCourseFromClassroomById(classroomId, courseId, username)
    CS->>CSI: removeCourseFromClassroomById(classroomId, courseId, username)
    CSI->>Repo: Retrieve classroom by classroomId
    alt Course exists in classroom
        CSI->>Repo: Save updated classroom (course removed)
        Repo-->>CSI: Return updated classroom
    else Course not found
        CSI-->>CC: Throw ResourceNotFoundException
    end
    CSI-->>CS: Return updated classroom
    CS-->>CC: Return updated classroom
    CC-->>Client: HTTP 200 OK with updated classroom
```

```mermaid
sequenceDiagram
    participant App as Application Startup
    participant DI as DataInitializer
    participant Repo as RoleRepository
    App->>DI: run()
    DI->>Repo: Check if "ADMIN" role exists
    alt "ADMIN" exists
        Repo-->>DI: Exists
    else
        DI->>Repo: Save "ADMIN" role
    end
    DI->>Repo: Check if "TEACHER" role exists
    alt "TEACHER" exists
        Repo-->>DI: Exists
    else
        DI->>Repo: Save "TEACHER" role
    end
    DI->>Repo: Check if "STUDENT" role exists
    alt "STUDENT" exists
        Repo-->>DI: Exists
    else
        DI->>Repo: Save "STUDENT" role
    end
```

## Poem
> Beep boop! Code streams align in our domain,  
> Courses vanish with a swift, precise refrain.  
> Tests ensure each byte and bit behaves as planned,  
> Roles ignite at startup, exactly as manned.  
> Circuit cheers echo—geeky updates, hand in hand!

</details>

<!-- walkthrough_end -->

<!-- announcements_start -->

> [!TIP]
> <details>
> <summary>⚡💬 Agentic Chat (Pro Plan, General Availability)</summary>
> 
> - We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.
> 
> </details>

<!-- announcements_end -->
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpADK2VmgqyjcEj2wAbb5AokAI7Y0riQ4rjedJAARACCeCzU8AxovvL2JNEAkhjq8GmQNvhRyPhYcdzc3inJ5Q64LrjY3DGQAO5oyIjYAszqNPRy4bCe2IiUkAJosmgAXvC0ABL4iIjaGABM6Bj0qIvs8ABm8NFdkBhOApObAJwaMKNeFNyrnvhHI6i2KMgEkGRYJgGJ5cE80FUaqlx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GFDFAlGgDaA7AwCPMojgzUUdBoH4csyOGStZw9GUeuwD1wiGNkYuFKQ1kPA8cSIwbxGyF8btH8cjECaHT5tMpeqeDdA9HHG8PgTCdL0KSEKGvoE1T/vNzOOt1kARwcTxB2nwAJgOqycjDlzCG0YAJaIHTRTxFtTeM8AKc8HLzHVKbliuOQGIbhJ0N+sqauyHXojfoYT1AKrIwBptHVM2oHCaZoFFLScnDqv+hhvgUGmYAEEcmHF0Nxkhy0c8eqpXnLlBCeFaLCeOHIIspt2VqE0kzVsdM1tUmkx1v1jdP1sUwiC9KgHxXotRSfpfoKDfooALKQSAY2BAfVDAZXBDxTr3KRQttRWtsqV9AgmsxRo0GJfQAoCIEQFvKwEzKhbyFfrxnfsDoAcRaRGRc8SanRd3Mzs7OzptradiaiHib8fdEjAJaXxRFkbpHs0bq9pvhpYPthfheYEAYHqRdAfZaIFf0TS1gMHdkU31mpkSHwuwSDn8DQFDna3XkjjlRUBjhdnjkMF1fknUGUMWEQGUICBhjoGUKbA1HtaTigAYCOAADYzI0ASBbgABGW4TYINo4AADnjc2AAFYAB2WNpNiNtNpNo4aNiNo4EgON64BNiNkyW4MyP13VsyUt6YLIJNpNsyTYWgJNgAZhIAEAYFoBMhTebbjaTbQDjYjYjYLZLaDebYYBMk2BTbMjje2G1cdZEmdddfdZIE9dir1ntaAA= -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details>
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---



<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=Learnathon-By-Geeky-Solutions/binarybrain&utm_content=29):

- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
  - `I pushed a fix in commit <commit_id>, please review it.`
  - `Generate unit testing code for this file.`
  - `Open a follow-up GitHub issue for this discussion.`
- Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples:
  - `@coderabbitai generate unit testing code for this file.`
  -	`@coderabbitai modularize this function.`
- PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
  - `@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.`
  - `@coderabbitai read src/utils.ts and generate unit testing code.`
  - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.`
  - `@coderabbitai help me debug CodeRabbit configuration file.`

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

### CodeRabbit Commands (Invoked using PR comments)

- `@coderabbitai pause` to pause the reviews on a PR.
- `@coderabbitai resume` to resume the paused reviews.
- `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
- `@coderabbitai full review` to do a full review from scratch and review all the files again.
- `@coderabbitai summary` to regenerate the summary of the PR.
- `@coderabbitai generate docstrings` to [generate docstrings](https://docs.coderabbit.ai/finishing-touches/docstrings) for this PR.
- `@coderabbitai resolve` resolve all the CodeRabbit review comments.
- `@coderabbitai plan` to trigger planning for file edits and PR creation.
- `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository.
- `@coderabbitai help` to get help.

### Other keywords and placeholders

- Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed.
- Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description.
- Add `@coderabbitai` anywhere in the PR title to generate the title automatically.

### CodeRabbit Configuration File (`.coderabbit.yaml`)

- You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository.
- Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json`

### Documentation and Community

- Visit our [Documentation](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->
author_association: NONE
user: login: sonarqubecloud[bot]
created_at: 2025-04-14T02:09:11Z
body: ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=Learnathon-By-Geeky-Solutions_binarybrain&pullRequest=29) **Quality Gate passed**  
Issues  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=Learnathon-By-Geeky-Solutions_binarybrain&pullRequest=29&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=Learnathon-By-Geeky-Solutions_binarybrain&pullRequest=29&issueStatuses=ACCEPTED)

Measures  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=Learnathon-By-Geeky-Solutions_binarybrain&pullRequest=29&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [92.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=Learnathon-By-Geeky-Solutions_binarybrain&pullRequest=29&metric=new_coverage&view=list)  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=Learnathon-By-Geeky-Solutions_binarybrain&pullRequest=29&metric=new_duplicated_lines_density&view=list)  
  
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=Learnathon-By-Geeky-Solutions_binarybrain&pullRequest=29)


author_association: NONE