travaux intégration UI

This commit is contained in:
Maxime Duchene-Savard 2025-11-11 10:06:49 -05:00
parent 4f073a7361
commit 1f10620954
5 changed files with 55 additions and 15 deletions

2
.idea/misc.xml generated
View File

@ -8,7 +8,7 @@
</list> </list>
</option> </option>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="temurin-21" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_25" default="true" project-jdk-name="temurin-25" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />
</component> </component>
</project> </project>

5
example.env Normal file
View File

@ -0,0 +1,5 @@
BOLTS_DB_HOST=127.0.0.1
BOLTS_DB_PORT=5432
BOLTS_DB_NAME=bolts
BOLTS_DB_USER=root
BOLTS_DB_PASS=root

18
pom.xml
View File

@ -20,8 +20,8 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.14.0</version> <version>3.14.0</version>
<configuration> <configuration>
<source>21</source> <source>25</source>
<target>21</target> <target>25</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
@ -57,6 +57,12 @@
<dependencies> <dependencies>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>7.0.0</version>
</dependency>
<dependency> <dependency>
<groupId>io.javalin</groupId> <groupId>io.javalin</groupId>
<artifactId>javalin</artifactId> <artifactId>javalin</artifactId>
@ -127,13 +133,5 @@
<version>5.13.4</version> <version>5.13.4</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/com.h2database/h2 -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>2.3.230</version>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -0,0 +1,20 @@
package dev.mduchene;
import com.google.inject.AbstractModule;
public class BoltsDbModule extends AbstractModule {
private final Db db;
private BoltsDbModule(Db db) {
this.db = db;
}
public static BoltsDbModule of(Db db) {
return new BoltsDbModule(db);
}
@Override
protected void configure() {
bind(Db.class).toInstance(db);
}
}

View File

@ -21,18 +21,33 @@ public class Db implements AutoCloseable {
} }
public static class Builder { public static class Builder {
private String host;
private String url; private Integer port;
private String database;
private String user; private String user;
private String password; private String password;
private Builder() {} private Builder() {}
public Builder url(String url) {
this.url = url; public Builder host(String host) {
this.host = host;
return this; return this;
} }
public Builder port(Integer port) {
this.port = port;
return this;
}
public Builder database(String database) {
this.database = database;
return this;
}
public Builder user(String user) { public Builder user(String user) {
this.user = user; this.user = user;
return this; return this;
@ -47,6 +62,8 @@ public class Db implements AutoCloseable {
System.setProperty("org.jooq.no-tips", "true"); System.setProperty("org.jooq.no-tips", "true");
System.setProperty("org.jooq.no-logo", "true"); System.setProperty("org.jooq.no-logo", "true");
String url = String.format("jdbc:postgresql://%s:%d/%s", host, port, database);
Db db = new Db(); Db db = new Db();
HikariConfig config = new HikariConfig(); HikariConfig config = new HikariConfig();
config.setJdbcUrl(url); config.setJdbcUrl(url);