Skip to content

Commit 20bb2e3

Browse files
committed
Merge with main and resolve conflicts.
2 parents debcd0b + 11c82fc commit 20bb2e3

File tree

28 files changed

+1082
-52
lines changed

28 files changed

+1082
-52
lines changed

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,44 @@ Visit `localhost:8080/apidoc` to see the endpoints.
6262

6363
[depgraph-maven-plugin](https://github.com/ferstl/depgraph-maven-plugin) :
6464
`mvn com.github.ferstl:depgraph-maven-plugin:3.3.0:graph -DrepeatTransitiveDependenciesInTextGraph -DshowVersions -DgraphFormat=text -DshowGroupIds -DshowConflicts -DshowDuplicates`
65+
66+
67+
### 🌀 JPA (Hibernate)
68+
- JPA(Hibernate) limits: [Is your query too complex for JPA and Hibernate ?](https://thorben-janssen.com/query-complex-jpa-hibernate/#1_Use_subqueries_outside_of_WHERE_and_HAVING_clauses)
69+
- Native Queries
70+
- Defining and executing native queries
71+
- https://thorben-janssen.com/jpa-native-queries/#Createnbspad-hoc_native_queries
72+
- How to return DTOs from native queries
73+
- https://thorben-janssen.com/spring-data-jpa-dto-native-queries/
74+
75+
- Spring Data JPA
76+
- DTO projections : https://vladmihalcea.com/spring-jpa-dto-projection/
77+
78+
- Hibernate 6
79+
- Hibernate 6 and JPQL Window Functions: https://vladmihalcea.com/hibernate-jpql-window-functions/
80+
81+
82+
83+
- JOOQ
84+
- Hibernate & JOOQ interation:
85+
- https://thorben-janssen.com/hibernate-jooq-a-match-made-in-heaven/
86+
- https://thorben-janssen.com/hibernate-tip-how-to-integrate-an-external-query-builder/
87+
- Window functions
88+
- https://blog.jooq.org/probably-the-coolest-sql-feature-window-functions/
89+
- https://blog.jooq.org/the-difference-between-row_number-rank-and-dense_rank/
90+
- TOP N Queries
91+
- https://blog.jooq.org/how-to-write-efficient-top-n-queries-in-sql/
92+
93+
- DTO projections : https://blog.jooq.org/the-second-best-way-to-fetch-a-spring-data-jpa-dto-projection/
94+
95+
- Blaze Persistence – The Best Way to Write JPA Criteria Queries
96+
- https://persistence.blazebit.com/documentation/1.6/core/manual/en_US/index.html
97+
- https://vladmihalcea.com/blaze-persistence-jpa-criteria-queries/
98+
99+
- SQL RANK functions: https://www.sqlshack.com/overview-of-sql-rank-functions/
100+
- WINDOW functions: https://docs.snowflake.com/en/sql-reference/functions-analytic.html
101+
102+
103+
104+
### 🌀 WSL 2
105+
https://www.freecodecamp.org/news/how-to-install-wsl2-windows-subsystem-for-linux-2-on-windows-10/

essentialprogramming-api/lombok.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ lombok.copyableAnnotations += org.springframework.beans.factory.annotation.Quali
88
lombok.copyableAnnotations += org.springframework.context.annotation.Lazy
99

1010
lombok.addLombokGeneratedAnnotation = true
11+

essentialprogramming-api/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@
4747
<version>1.0.0-SNAPSHOT</version>
4848
</dependency>
4949

50+
<dependency>
51+
<groupId>com.essentialprogramming</groupId>
52+
<artifactId>essentialprogramming-logging</artifactId>
53+
<version>1.0.0-SNAPSHOT</version>
54+
</dependency>
55+
5056
<dependency>
5157
<groupId>com.essentialprogramming</groupId>
5258
<artifactId>db-migration</artifactId>

essentialprogramming-api/src/main/java/com/api/controller/UserController.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import io.swagger.v3.oas.annotations.responses.ApiResponses;
2626
import io.swagger.v3.oas.annotations.tags.Tag;
2727
import lombok.extern.slf4j.Slf4j;
28-
import org.apache.logging.log4j.ThreadContext;
2928

3029
import javax.annotation.security.RolesAllowed;
3130
import javax.inject.Inject;
@@ -45,6 +44,7 @@
4544
import java.util.concurrent.ExecutorService;
4645

4746
import static com.api.config.AppConfig.USER_API;
47+
import static com.api.exceptions.codes.ErrorCode.USER_ALREADY_EXISTS;
4848

4949
@Tag(description = USER_API, name = "User Services")
5050
@ApiErrorResponses
@@ -55,7 +55,6 @@ public class UserController {
5555
private final UserService userService;
5656
private final MeterRegistry meterRegistry;
5757

58-
5958
@Context
6059
private Language language;
6160

@@ -90,10 +89,7 @@ private Serializable createUser(UserInput userInput, Language language) throws G
9089
boolean isValid = userService.checkAvailabilityByEmail(userInput.getEmail());
9190
if (!isValid) {
9291

93-
ThreadContext.put("errorID", ErrorCode.USER_ALREADY_EXISTS.getCode());
94-
log.error(ErrorCode.USER_ALREADY_EXISTS.getDescription());
95-
ThreadContext.clearMap();
96-
92+
log.error(USER_ALREADY_EXISTS.getCode(), "User with email=`{}` already exists", userInput.getEmail());
9793
throw new ApiException(Messages.get("EMAIL.ALREADY.TAKEN", language), HTTPCustomStatus.INVALID_REQUEST);
9894
}
9995
return userService.save(userInput, language);

essentialprogramming-api/src/main/resources/log4j2.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<Appenders>
1212

1313
<Console name="consoleAppender" target="SYSTEM_OUT">
14-
<PatternLayout disableAnsi="false" pattern=" %d{yyyy-MM-dd HH:mm:ss} %highlight{${LOG_LEVEL_PATTERN:-%5p}}{FATAL=red blink, ERROR=red, WARN=yellow bold, INFO=blue, DEBUG=green bold, TRACE=light blue} --- [%15.15t] %style{%-41.41c{9.}}{cyan} : %m%n%ex"/>
14+
<PatternLayout disableAnsi="false" pattern=" %d{yyyy-MM-dd HH:mm:ss} %highlight{${LOG_LEVEL_PATTERN:-%5p}}{FATAL=red blink, ERROR=red, WARN=yellow bold, INFO=blue, DEBUG=green bold, TRACE=green} --- [%15.15t] %style{%-41.41c{9.}}{cyan} : %m%n%ex"/>
1515
</Console>
1616

1717

essentialprogramming-auth/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,12 @@
189189
<scope>compile</scope>
190190
</dependency>
191191

192+
<dependency>
193+
<groupId>com.essentialprogramming</groupId>
194+
<artifactId>essentialprogramming-logging</artifactId>
195+
<version>1.0.0-SNAPSHOT</version>
196+
</dependency>
197+
192198

193199
</dependencies>
194200

essentialprogramming-email/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@
6767
<version>1.0.0-SNAPSHOT</version>
6868
<scope>compile</scope>
6969
</dependency>
70+
71+
<dependency>
72+
<groupId>com.essentialprogramming</groupId>
73+
<artifactId>essentialprogramming-logging</artifactId>
74+
<version>1.0.0-SNAPSHOT</version>
75+
</dependency>
7076
</dependencies>
7177

7278
</project>

essentialprogramming-jobs/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
<version>1.0.0-SNAPSHOT</version>
2626
</dependency>
2727

28+
<dependency>
29+
<groupId>com.essentialprogramming</groupId>
30+
<artifactId>essentialprogramming-logging</artifactId>
31+
<version>1.0.0-SNAPSHOT</version>
32+
</dependency>
33+
2834
<!-- Spring -->
2935
<dependency>
3036
<groupId>org.springframework</groupId>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?xml version="1.0"?>
2+
3+
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
5+
6+
<modelVersion>4.0.0</modelVersion>
7+
8+
<artifactId>essentialprogramming-logging</artifactId>
9+
<packaging>jar</packaging>
10+
<version>1.0.0-SNAPSHOT</version>
11+
<name>essentialprogramming-logging</name>
12+
13+
<parent>
14+
<groupId>com.essentialprogramming</groupId>
15+
<artifactId>parent</artifactId>
16+
<relativePath>../parent</relativePath>
17+
<version>1.0.0-SNAPSHOT</version>
18+
</parent>
19+
20+
<dependencies>
21+
22+
</dependencies>
23+
24+
<build>
25+
<finalName>${project.artifactId}</finalName>
26+
27+
<plugins>
28+
<plugin>
29+
<groupId>org.apache.maven.plugins</groupId>
30+
<artifactId>maven-compiler-plugin</artifactId>
31+
<version>3.8.1</version>
32+
<configuration>
33+
<source>${java-version}</source>
34+
<target>${java-version}</target>
35+
<compilerArgs>
36+
<arg>-Xlint:all,-processing</arg>
37+
</compilerArgs>
38+
<showWarnings>true</showWarnings>
39+
<showDeprecation>true</showDeprecation>
40+
<encoding>${project.build.sourceEncoding}</encoding>
41+
</configuration>
42+
</plugin>
43+
</plugins>
44+
</build>
45+
</project>

0 commit comments

Comments
 (0)