File tree Expand file tree Collapse file tree 10 files changed +58
-31
lines changed Expand file tree Collapse file tree 10 files changed +58
-31
lines changed Original file line number Diff line number Diff line change 4444 <orderEntry type =" sourceFolder" forTests =" false" />
4545 <orderEntry type =" library" name =" Maven: org.springframework.boot:spring-boot-starter-web:2.7.1" level =" project" />
4646 <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" />
4947 <orderEntry type =" library" name =" Maven: org.springframework.boot:spring-boot-starter-logging:2.7.1" level =" project" />
5048 <orderEntry type =" library" name =" Maven: ch.qos.logback:logback-classic:1.2.11" level =" project" />
5149 <orderEntry type =" library" name =" Maven: ch.qos.logback:logback-core:1.2.11" level =" project" />
132130 <orderEntry type =" library" name =" Maven: mysql:mysql-connector-java:8.0.29" level =" project" />
133131 <orderEntry type =" library" name =" Maven: org.modelmapper.extensions:modelmapper-spring:3.1.0" level =" project" />
134132 <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" />
135136 </component >
136137</module >
Original file line number Diff line number Diff line change 7676 <plugin >
7777 <groupId >org.springframework.boot</groupId >
7878 <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 >
7987 </plugin >
8088 </plugins >
8189 </build >
Original file line number Diff line number Diff line change 11package lk .ijse .dep .note ;
22
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
39public class AppInitializer {
4- public static void main (String [] args ) {
510
11+ @ Bean
12+ public ModelMapper modelMapper (){
13+ return new ModelMapper ();
14+ }
15+ public static void main (String [] args ) {
16+ SpringApplication .run (AppInitializer .class ,args );
617 }
718}
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 ;
22
33import lk .ijse .dep .note .entity .Note ;
44import lk .ijse .dep .note .entity .User ;
5+ import org .springframework .data .repository .CrudRepository ;
56
67import java .util .List ;
78
89public interface NoteRepository extends CrudRepository <Note ,Integer > {
910
1011
1112 List <Note > findAllNotesByUser (User user );
13+ long countNotesByUser (User user );
14+
1215}
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 ;
22
33import lk .ijse .dep .note .entity .User ;
4+ import org .springframework .data .repository .CrudRepository ;
45
6+ import java .util .List ;
57
68public interface UserRepository extends CrudRepository <User ,String > {
7- boolean existUserByEmail (String email );
9+ boolean existsUserByEmail (String email );
10+
11+ List <User > getUsersByFullNameLike (String query );
812}
Original file line number Diff line number Diff line change 33import lk .ijse .dep .note .dto .NoteDTO ;
44import lk .ijse .dep .note .entity .Note ;
55import 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 ;
88import lk .ijse .dep .note .service .Noteservice ;
99import lk .ijse .dep .note .service .exception .NotFoundException ;
1010import lk .ijse .dep .note .service .exception .UnauthorizedAccessException ;
Original file line number Diff line number Diff line change 22
33import lk .ijse .dep .note .dto .UserDTO ;
44import lk .ijse .dep .note .entity .User ;
5- import lk .ijse .dep .note .repository .custom . UserRepository ;
5+ import lk .ijse .dep .note .repository .UserRepository ;
66import lk .ijse .dep .note .service .UserService ;
77import lk .ijse .dep .note .service .exception .DuplicateEmailException ;
88import lk .ijse .dep .note .service .exception .NotFoundException ;
@@ -27,7 +27,7 @@ public class UserServiceImpl implements UserService {
2727
2828 @ Override
2929 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" );
3131 user .setId (UUID .randomUUID ().toString ());
3232 return transformer .getUserDTO (userRepository .save (transformer .getUserEntity (user )));
3333 }
@@ -49,7 +49,7 @@ public UserDTO getUserInfo(String userId) throws NotFoundException {
4949
5050 @ Override
5151 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" );
5353 userRepository .deleteById (userId );
5454
5555
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
59
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