浏览代码

moved to postgres DB

David Thornley 6 年前
父节点
当前提交
f90a7cd0bf

+ 10
- 5
server-springboot/pom.xml 查看文件

@@ -34,6 +34,11 @@
34 34
             <artifactId>spring-boot-starter-web</artifactId>
35 35
         </dependency>
36 36
 
37
+        <dependency>
38
+            <groupId>org.postgresql</groupId>
39
+            <artifactId>postgresql</artifactId>
40
+            <version>42.2.1</version>
41
+        </dependency>
37 42
         <!--<dependency>-->
38 43
             <!--<groupId>mysql</groupId>-->
39 44
             <!--<artifactId>mysql-connector-java</artifactId>-->
@@ -47,11 +52,11 @@
47 52
             <groupId>org.springframework.boot</groupId>
48 53
             <artifactId>spring-boot-starter-data-rest</artifactId>
49 54
         </dependency>
50
-        <dependency>
51
-            <groupId>com.h2database</groupId>
52
-            <artifactId>h2</artifactId>
53
-            <scope>runtime</scope>
54
-        </dependency>
55
+        <!--<dependency>-->
56
+            <!--<groupId>com.h2database</groupId>-->
57
+            <!--<artifactId>h2</artifactId>-->
58
+            <!--<scope>runtime</scope>-->
59
+        <!--</dependency>-->
55 60
         <dependency>
56 61
             <groupId>org.springframework.boot</groupId>
57 62
             <artifactId>spring-boot-starter-test</artifactId>

+ 1
- 1
server-springboot/src/main/java/com/ziplinegreen/vault/Model/User.java 查看文件

@@ -10,7 +10,7 @@ import java.util.ArrayList;
10 10
 import java.util.List;
11 11
 
12 12
 @Entity
13
-@Table(name = "user")
13
+@Table(name = "vault_user")
14 14
 public class User extends AuditModel{
15 15
     @Id
16 16
     @GeneratedValue(strategy = GenerationType.IDENTITY)

+ 14
- 8
server-springboot/src/main/resources/application.properties 查看文件

@@ -1,13 +1,19 @@
1
-# H2
2
-spring.h2.console.enabled=true
3
-spring.h2.console.path=/h2
1
+## H2
2
+#spring.h2.console.enabled=true
3
+#spring.h2.console.path=/h2
4
+#
5
+## Datasource
6
+#spring.datasource.url=jdbc:h2:file:~/test
7
+#spring.datasource.username=sa
8
+#spring.datasource.password=
9
+#spring.datasource.driver-class-name=org.h2.Driver
10
+
4 11
 
5
-# Datasource
6
-spring.datasource.url=jdbc:h2:file:~/test
7
-spring.datasource.username=sa
8
-spring.datasource.password=
9
-spring.datasource.driver-class-name=org.h2.Driver
10 12
 
13
+spring.datasource.url= jdbc:postgresql://localhost:5432/thevault 
14
+spring.datasource.username=postgres
15
+spring.datasource.password=ZipCode4dot1   
16
+spring.jpa.hibernate.ddl-auto=update
11 17
 
12 18
 #spring.datasource.url=jdbc:mysql://localhost:3306/zipLine?useSSL=false
13 19
 #spring.datasource.username=root

+ 14
- 8
server-springboot/target/classes/application.properties 查看文件

@@ -1,13 +1,19 @@
1
-# H2
2
-spring.h2.console.enabled=true
3
-spring.h2.console.path=/h2
1
+## H2
2
+#spring.h2.console.enabled=true
3
+#spring.h2.console.path=/h2
4
+#
5
+## Datasource
6
+#spring.datasource.url=jdbc:h2:file:~/test
7
+#spring.datasource.username=sa
8
+#spring.datasource.password=
9
+#spring.datasource.driver-class-name=org.h2.Driver
10
+
4 11
 
5
-# Datasource
6
-spring.datasource.url=jdbc:h2:file:~/test
7
-spring.datasource.username=sa
8
-spring.datasource.password=
9
-spring.datasource.driver-class-name=org.h2.Driver
10 12
 
13
+spring.datasource.url= jdbc:postgresql://localhost:5432/thevault 
14
+spring.datasource.username=postgres
15
+spring.datasource.password=ZipCode4dot1   
16
+spring.jpa.hibernate.ddl-auto=update
11 17
 
12 18
 #spring.datasource.url=jdbc:mysql://localhost:3306/zipLine?useSSL=false
13 19
 #spring.datasource.username=root

二进制
server-springboot/target/classes/com/ziplinegreen/vault/Config/WebSocketConfig.class 查看文件


二进制
server-springboot/target/classes/com/ziplinegreen/vault/Controller/PostController.class 查看文件


二进制
server-springboot/target/classes/com/ziplinegreen/vault/Controller/UserController.class 查看文件


二进制
server-springboot/target/classes/com/ziplinegreen/vault/Model/Post.class 查看文件


二进制
server-springboot/target/classes/com/ziplinegreen/vault/Model/User.class 查看文件


二进制
server-springboot/target/classes/com/ziplinegreen/vault/Repository/UserRepository.class 查看文件


二进制
server-springboot/target/classes/com/ziplinegreen/vault/Repository/UsersRepository.class 查看文件


二进制
server-springboot/target/classes/com/ziplinegreen/vault/Service/PostService.class 查看文件


二进制
server-springboot/target/classes/com/ziplinegreen/vault/Service/UserService.class 查看文件


+ 1
- 8
server-springboot/target/classes/static/app.js 查看文件

@@ -20,7 +20,6 @@ function connect() {
20 20
         console.log('Connected: ' + frame);
21 21
         stompClient.subscribe('/topic/posts', function (greeting) {
22 22
             showGreeting(JSON.parse(greeting.body).message, JSON.parse(greeting.body).userName);
23
-            //showGreeting()
24 23
         });
25 24
     });
26 25
 }
@@ -34,7 +33,7 @@ function disconnect() {
34 33
 }
35 34
 
36 35
 var userId = 1;
37
-var userPostUrl = "/app/posts/1";
36
+var userPostUrl = "/app/posts";
38 37
 
39 38
 function user1() {
40 39
     $('#user1').prop("disabled", true);
@@ -46,14 +45,8 @@ function user2() {
46 45
     $('#user1').prop("disabled", false);
47 46
     $('#user2').prop("disabled", true);
48 47
     userId = 2;
49
-    userPostUrl = "/app/posts/2";
50 48
 }
51 49
 
52
-// function sendName() {
53
-//     stompClient.send("/app/posts/1", {}, JSON.stringify({'id': '','message': $("#message").val(),'userId': '1'}));
54
-// }
55
-
56
-
57 50
 
58 51
 function sendName() {
59 52
 

+ 26
- 0
src/main/java/com/ziplinegreen/vault/Model/Repo.java 查看文件

@@ -0,0 +1,26 @@
1
+package com.ziplinegreen.vault.Model;
2
+
3
+import javax.persistence.Entity;
4
+import javax.persistence.Table;
5
+import java.math.BigInteger;
6
+
7
+@Entity
8
+@Table(name = "repo")
9
+public class Repo {
10
+
11
+    private String clone_url;
12
+    private String created_at;
13
+    private String default_branch;
14
+    private String description;
15
+    private boolean empty;
16
+    private boolean fork;
17
+    private long forks_count;
18
+    private String full_name;
19
+    private String html_url;
20
+    private BigInteger id;
21
+    private boolean mirror;
22
+    private long name;
23
+    private long open_issues_count;
24
+    private User owner;
25
+
26
+}