Skip to content

Commit

Permalink
feat: init docker database
Browse files Browse the repository at this point in the history
  • Loading branch information
skuzow committed Feb 23, 2023
1 parent 0513473 commit ca1ec94
Show file tree
Hide file tree
Showing 10 changed files with 98 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"editor.defaultFormatter": "vscode.html-language-features"
},
"editor.tabSize": 2,
"java.compile.nullAnalysis.mode": "automatic"
"java.compile.nullAnalysis.mode": "automatic",
"java.configuration.updateBuildConfiguration": "interactive"
}
5 changes: 5 additions & 0 deletions back/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM openjdk:17

COPY target/alist-0.0.1.jar alist-0.0.1.jar

ENTRYPOINT ["java", "-jar", "/alist-0.0.1.jar"]
43 changes: 37 additions & 6 deletions back/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,52 @@
</parent>
<groupId>net.daw</groupId>
<artifactId>alist</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>alist</name>
<description>Demo project for Spring Boot</description>
<description>Alist backend</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mustache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mustache</artifactId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.32</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>

Expand All @@ -42,6 +65,14 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
10 changes: 4 additions & 6 deletions back/src/main/java/net/daw/alist/models/Comment.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
import java.sql.Blob;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.*;

import com.fasterxml.jackson.annotation.JsonIgnore;

Expand All @@ -19,8 +15,10 @@ public class Comment {
private Long id;

private Date date;
private User author;
private String content;

@OneToOne
private User author;

@Lob
@JsonIgnore
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package net.daw.alist.repositories;

import net.daw.alist.models.Comment;
import org.springframework.data.jpa.repository.JpaRepository;

public interface CommentRepository extends JpaRepository<Comment, Long> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package net.daw.alist.repositories;

import net.daw.alist.models.PostItem;
import org.springframework.data.jpa.repository.JpaRepository;

public interface PostItemRepository extends JpaRepository<PostItem, Long> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package net.daw.alist.repositories;

import net.daw.alist.models.Post;
import org.springframework.data.jpa.repository.JpaRepository;

public interface PostRepository extends JpaRepository<Post, Long> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package net.daw.alist.repositories;

import net.daw.alist.models.Topic;
import org.springframework.data.jpa.repository.JpaRepository;

public interface TopicRepository extends JpaRepository<Topic, Long> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package net.daw.alist.repositories;

import net.daw.alist.models.User;
import org.springframework.data.jpa.repository.JpaRepository;

public interface UserRepository extends JpaRepository<User, Long> {
}
15 changes: 15 additions & 0 deletions back/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# mysql properties
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/alist
spring.datasource.username=alist
spring.datasource.password=y0JlZhO3z8
spring.jpa.hibernate.ddl-auto=create-drop
spring.jpa.show-sql=false
spring.jpa.database=mysql
spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect

spring.jackson.serialization.INDENT_OUTPUT=true
spring.jpa.properties.hibernate.format_sql=true
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE

spring.mustache.suffix=.html
logging.level.org.springframework.web=DEBUG
server.port=8443

0 comments on commit ca1ec94

Please sign in to comment.