Przeglądaj źródła

teacher fully integrated

rjsmall90 6 lat temu
rodzic
commit
104c3a593c

+ 2
- 2
src/main/java/com/passionproject/project_spitball20/controller/TeacherController.java Wyświetl plik

@@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.*;
15 15
 
16 16
 @CrossOrigin
17 17
 @RestController
18
-@RequestMapping("profile")
18
+@RequestMapping("teacher_profile")
19 19
 public class TeacherController {
20 20
 
21 21
     @Autowired
@@ -28,7 +28,7 @@ public class TeacherController {
28 28
     public ResponseEntity<Teacher> registerUser(@RequestBody Teacher newTeacher) {
29 29
         Teacher teacher = new Teacher();
30 30
         HttpStatus status = HttpStatus.CONFLICT;
31
-        if(teacherService.findEmail(newTeacher.getEmail()).equals(null) && teacherService.findName(newTeacher.getFullName()).equals(null)) {
31
+        if(teacherService.findEmail(newTeacher.getEmail()).equals(null)){ //&& teacherService.findName(newTeacher.getFullName()).equals(null)) {
32 32
             teacher = teacherService.save(newTeacher);
33 33
             status  = HttpStatus.CREATED;
34 34
         }

+ 2
- 2
src/main/java/com/passionproject/project_spitball20/controller/UserController.java Wyświetl plik

@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.*;
12 12
 
13 13
 @CrossOrigin
14 14
 @RestController
15
-@RequestMapping("profile")
15
+@RequestMapping("user_profile")
16 16
 public class UserController {
17 17
 
18 18
     @Autowired
@@ -25,7 +25,7 @@ public class UserController {
25 25
     public ResponseEntity<User> registerUser(@RequestBody User newUser) {
26 26
         User user = new User();
27 27
         HttpStatus status = HttpStatus.CONFLICT;
28
-        if(userService.findEmail(newUser.getEmail()).equals(null) && userService.findName(newUser.getDisplayName()).equals(null)) {
28
+        if(userService.findEmail(newUser.getEmail()).equals(null)) { //&& userService.findName(newUser.getDisplayName()).equals(null)) {
29 29
             user = userService.save(newUser);
30 30
             status  = HttpStatus.CREATED;
31 31
         }

+ 4
- 0
src/main/java/com/passionproject/project_spitball20/model/Teacher.java Wyświetl plik

@@ -54,4 +54,8 @@ public class Teacher {
54 54
     public void setPassword(String password) {
55 55
         this.password = password;
56 56
     }
57
+
58
+    public String getFullName() {
59
+        return firstName + lastName;
60
+    }
57 61
 }

+ 2
- 2
src/main/java/com/passionproject/project_spitball20/repositories/TeacherRepository.java Wyświetl plik

@@ -7,7 +7,7 @@ import org.springframework.stereotype.Repository;
7 7
 @Repository
8 8
 public interface TeacherRepository extends JpaRepository<Teacher, Long> {
9 9
 
10
-     Teacher findByEmail(String email);
10
+    Teacher findByEmail(String email);
11 11
 
12
-    Teacher findByName(String fullName);
12
+    //Teacher findByName(String fullName);
13 13
 }

+ 1
- 1
src/main/java/com/passionproject/project_spitball20/repositories/UserRepository.java Wyświetl plik

@@ -9,6 +9,6 @@ public interface UserRepository extends JpaRepository<User, Long> {
9 9
 
10 10
    User findByEmail(String email);
11 11
 
12
-   User findByName(String fullName);
12
+   //User findByName(String fullName);
13 13
 
14 14
 }

+ 3
- 3
src/main/java/com/passionproject/project_spitball20/service/TeacherService.java Wyświetl plik

@@ -23,9 +23,9 @@ public class TeacherService {
23 23
         return teacherRepository.findById(id).get();
24 24
     }
25 25
 
26
-    public Teacher findName(String fullName) {
27
-        return teacherRepository.findByName(fullName);
28
-    }
26
+//    public Teacher findName(String fullName) {
27
+//        return teacherRepository.findByName(fullName);
28
+//    }
29 29
 
30 30
     public Teacher findEmail(String email) {
31 31
         return teacherRepository.findByEmail(email);

+ 3
- 3
src/main/java/com/passionproject/project_spitball20/service/UserService.java Wyświetl plik

@@ -24,9 +24,9 @@ public class UserService {
24 24
         return userRepository.findByEmail(email);
25 25
     }
26 26
 
27
-    public User findName(String displayName) {
28
-        return userRepository.findByName(displayName);
29
-    }
27
+//    public User findName(String displayName) {
28
+//        return userRepository.findByName(displayName);
29
+//    }
30 30
 
31 31
     public User find(Long id) {
32 32
         return userRepository.findById(id).get();