File tree 10 files changed +58
-31
lines changed 10 files changed +58
-31
lines changed Original file line number Diff line number Diff line change 44
44
<orderEntry type =" sourceFolder" forTests =" false" />
45
45
<orderEntry type =" library" name =" Maven: org.springframework.boot:spring-boot-starter-web:2.7.1" level =" project" />
46
46
<orderEntry type =" library" name =" Maven: org.springframework.boot:spring-boot-starter:2.7.1" level =" project" />
47
- <orderEntry type =" library" name =" Maven: org.springframework.boot:spring-boot:2.7.1" level =" project" />
48
- <orderEntry type =" library" name =" Maven: org.springframework.boot:spring-boot-autoconfigure:2.7.1" level =" project" />
49
47
<orderEntry type =" library" name =" Maven: org.springframework.boot:spring-boot-starter-logging:2.7.1" level =" project" />
50
48
<orderEntry type =" library" name =" Maven: ch.qos.logback:logback-classic:1.2.11" level =" project" />
51
49
<orderEntry type =" library" name =" Maven: ch.qos.logback:logback-core:1.2.11" level =" project" />
132
130
<orderEntry type =" library" name =" Maven: mysql:mysql-connector-java:8.0.29" level =" project" />
133
131
<orderEntry type =" library" name =" Maven: org.modelmapper.extensions:modelmapper-spring:3.1.0" level =" project" />
134
132
<orderEntry type =" library" name =" Maven: org.modelmapper:modelmapper:3.1.0" level =" project" />
133
+ <orderEntry type =" library" name =" Maven: org.springframework.boot:spring-boot-devtools:2.7.1" level =" project" />
134
+ <orderEntry type =" library" name =" Maven: org.springframework.boot:spring-boot:2.7.1" level =" project" />
135
+ <orderEntry type =" library" name =" Maven: org.springframework.boot:spring-boot-autoconfigure:2.7.1" level =" project" />
135
136
</component >
136
137
</module >
Original file line number Diff line number Diff line change 76
76
<plugin >
77
77
<groupId >org.springframework.boot</groupId >
78
78
<artifactId >spring-boot-maven-plugin</artifactId >
79
+ <configuration >
80
+ <excludes >
81
+ <exclude >
82
+ <groupId >org.projectlombok</groupId >
83
+ <artifactId >lombok</artifactId >
84
+ </exclude >
85
+ </excludes >
86
+ </configuration >
79
87
</plugin >
80
88
</plugins >
81
89
</build >
Original file line number Diff line number Diff line change 1
1
package lk .ijse .dep .note ;
2
2
3
+ import org .modelmapper .ModelMapper ;
4
+ import org .springframework .boot .SpringApplication ;
5
+ import org .springframework .boot .autoconfigure .SpringBootApplication ;
6
+ import org .springframework .context .annotation .Bean ;
7
+
8
+ @ SpringBootApplication
3
9
public class AppInitializer {
4
- public static void main (String [] args ) {
5
10
11
+ @ Bean
12
+ public ModelMapper modelMapper (){
13
+ return new ModelMapper ();
14
+ }
15
+ public static void main (String [] args ) {
16
+ SpringApplication .run (AppInitializer .class ,args );
6
17
}
7
18
}
Original file line number Diff line number Diff line change 1
- package lk .ijse .dep .note .repository . custom ;
1
+ package lk .ijse .dep .note .repository ;
2
2
3
3
import lk .ijse .dep .note .entity .Note ;
4
4
import lk .ijse .dep .note .entity .User ;
5
+ import org .springframework .data .repository .CrudRepository ;
5
6
6
7
import java .util .List ;
7
8
8
9
public interface NoteRepository extends CrudRepository <Note ,Integer > {
9
10
10
11
11
12
List <Note > findAllNotesByUser (User user );
13
+ long countNotesByUser (User user );
14
+
12
15
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- package lk .ijse .dep .note .repository . custom ;
1
+ package lk .ijse .dep .note .repository ;
2
2
3
3
import lk .ijse .dep .note .entity .User ;
4
+ import org .springframework .data .repository .CrudRepository ;
4
5
6
+ import java .util .List ;
5
7
6
8
public interface UserRepository extends CrudRepository <User ,String > {
7
- boolean existUserByEmail (String email );
9
+ boolean existsUserByEmail (String email );
10
+
11
+ List <User > getUsersByFullNameLike (String query );
8
12
}
Original file line number Diff line number Diff line change 3
3
import lk .ijse .dep .note .dto .NoteDTO ;
4
4
import lk .ijse .dep .note .entity .Note ;
5
5
import lk .ijse .dep .note .entity .User ;
6
- import lk .ijse .dep .note .repository .custom . NoteRepository ;
7
- import lk .ijse .dep .note .repository .custom . UserRepository ;
6
+ import lk .ijse .dep .note .repository .NoteRepository ;
7
+ import lk .ijse .dep .note .repository .UserRepository ;
8
8
import lk .ijse .dep .note .service .Noteservice ;
9
9
import lk .ijse .dep .note .service .exception .NotFoundException ;
10
10
import lk .ijse .dep .note .service .exception .UnauthorizedAccessException ;
Original file line number Diff line number Diff line change 2
2
3
3
import lk .ijse .dep .note .dto .UserDTO ;
4
4
import lk .ijse .dep .note .entity .User ;
5
- import lk .ijse .dep .note .repository .custom . UserRepository ;
5
+ import lk .ijse .dep .note .repository .UserRepository ;
6
6
import lk .ijse .dep .note .service .UserService ;
7
7
import lk .ijse .dep .note .service .exception .DuplicateEmailException ;
8
8
import lk .ijse .dep .note .service .exception .NotFoundException ;
@@ -27,7 +27,7 @@ public class UserServiceImpl implements UserService {
27
27
28
28
@ Override
29
29
public UserDTO registerUser (UserDTO user ) throws DuplicateEmailException {
30
- if (userRepository .existUserByEmail (user .getEmail ()) ) throw new DuplicateEmailException ("Email already exists" );
30
+ if (userRepository .existsUserByEmail (user .getEmail ()) ) throw new DuplicateEmailException ("Email already exists" );
31
31
user .setId (UUID .randomUUID ().toString ());
32
32
return transformer .getUserDTO (userRepository .save (transformer .getUserEntity (user )));
33
33
}
@@ -49,7 +49,7 @@ public UserDTO getUserInfo(String userId) throws NotFoundException {
49
49
50
50
@ Override
51
51
public void deleteUser (String userId ) throws NotFoundException {
52
- if (!userRepository .existById (userId )) throw new NotFoundException ("Invalid User id" );
52
+ if (!userRepository .existsById (userId )) throw new NotFoundException ("Invalid User id" );
53
53
userRepository .deleteById (userId );
54
54
55
55
Original file line number Diff line number Diff line change 1
- jpa :
2
- show-sql : true
3
- generate-ddl : true
4
- dialect : org.hibernate.dialect.MySQL8Dialect
1
+ spring :
2
+ datasource :
3
+ hikari :
4
+ maximum-pool-size : 10
5
+ driver-class-name : com.mysql.cj.jdbc.Driver
6
+ username : root
7
+ password : 12345678
8
+ url : jdbc:mysql://localhost:3306/dep8_notes?createDatabaseIfNotExist=true
5
9
6
- hikari :
7
- jdbc-url : jdbc:mysql://localhost:3306/dep8_notes?createDatabaseIfNotExist=true
8
- username : root
9
- password : 12345678
10
- driver-classname : com.mysql.cj.jdbc.Driver
11
- max-pool-size : 10
10
+
11
+ jpa :
12
+ generate-ddl : true
13
+ show-sql : true
14
+ database-platform : org.hibernate.dialect.MySQL8Dialect
15
+ hibernate :
16
+ naming :
17
+ physical-strategy : org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
18
+
19
+ server :
20
+ servlet :
21
+ context-path : /notes
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments