Browse Source

moved to postgres DB

David Thornley 6 years ago
parent
commit
f90a7cd0bf

+ 10
- 5
server-springboot/pom.xml View File

34
             <artifactId>spring-boot-starter-web</artifactId>
34
             <artifactId>spring-boot-starter-web</artifactId>
35
         </dependency>
35
         </dependency>
36
 
36
 
37
+        <dependency>
38
+            <groupId>org.postgresql</groupId>
39
+            <artifactId>postgresql</artifactId>
40
+            <version>42.2.1</version>
41
+        </dependency>
37
         <!--<dependency>-->
42
         <!--<dependency>-->
38
             <!--<groupId>mysql</groupId>-->
43
             <!--<groupId>mysql</groupId>-->
39
             <!--<artifactId>mysql-connector-java</artifactId>-->
44
             <!--<artifactId>mysql-connector-java</artifactId>-->
47
             <groupId>org.springframework.boot</groupId>
52
             <groupId>org.springframework.boot</groupId>
48
             <artifactId>spring-boot-starter-data-rest</artifactId>
53
             <artifactId>spring-boot-starter-data-rest</artifactId>
49
         </dependency>
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
         <dependency>
60
         <dependency>
56
             <groupId>org.springframework.boot</groupId>
61
             <groupId>org.springframework.boot</groupId>
57
             <artifactId>spring-boot-starter-test</artifactId>
62
             <artifactId>spring-boot-starter-test</artifactId>

+ 1
- 1
server-springboot/src/main/java/com/ziplinegreen/vault/Model/User.java View File

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

+ 14
- 8
server-springboot/src/main/resources/application.properties View File

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
 #spring.datasource.url=jdbc:mysql://localhost:3306/zipLine?useSSL=false
18
 #spring.datasource.url=jdbc:mysql://localhost:3306/zipLine?useSSL=false
13
 #spring.datasource.username=root
19
 #spring.datasource.username=root

+ 14
- 8
server-springboot/target/classes/application.properties View File

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
 #spring.datasource.url=jdbc:mysql://localhost:3306/zipLine?useSSL=false
18
 #spring.datasource.url=jdbc:mysql://localhost:3306/zipLine?useSSL=false
13
 #spring.datasource.username=root
19
 #spring.datasource.username=root

BIN
server-springboot/target/classes/com/ziplinegreen/vault/Config/WebSocketConfig.class View File


BIN
server-springboot/target/classes/com/ziplinegreen/vault/Controller/PostController.class View File


BIN
server-springboot/target/classes/com/ziplinegreen/vault/Controller/UserController.class View File


BIN
server-springboot/target/classes/com/ziplinegreen/vault/Model/Post.class View File


BIN
server-springboot/target/classes/com/ziplinegreen/vault/Model/User.class View File


BIN
server-springboot/target/classes/com/ziplinegreen/vault/Repository/UserRepository.class View File


BIN
server-springboot/target/classes/com/ziplinegreen/vault/Repository/UsersRepository.class View File


BIN
server-springboot/target/classes/com/ziplinegreen/vault/Service/PostService.class View File


BIN
server-springboot/target/classes/com/ziplinegreen/vault/Service/UserService.class View File


+ 1
- 8
server-springboot/target/classes/static/app.js View File

20
         console.log('Connected: ' + frame);
20
         console.log('Connected: ' + frame);
21
         stompClient.subscribe('/topic/posts', function (greeting) {
21
         stompClient.subscribe('/topic/posts', function (greeting) {
22
             showGreeting(JSON.parse(greeting.body).message, JSON.parse(greeting.body).userName);
22
             showGreeting(JSON.parse(greeting.body).message, JSON.parse(greeting.body).userName);
23
-            //showGreeting()
24
         });
23
         });
25
     });
24
     });
26
 }
25
 }
34
 }
33
 }
35
 
34
 
36
 var userId = 1;
35
 var userId = 1;
37
-var userPostUrl = "/app/posts/1";
36
+var userPostUrl = "/app/posts";
38
 
37
 
39
 function user1() {
38
 function user1() {
40
     $('#user1').prop("disabled", true);
39
     $('#user1').prop("disabled", true);
46
     $('#user1').prop("disabled", false);
45
     $('#user1').prop("disabled", false);
47
     $('#user2').prop("disabled", true);
46
     $('#user2').prop("disabled", true);
48
     userId = 2;
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
 function sendName() {
51
 function sendName() {
59
 
52
 

+ 26
- 0
src/main/java/com/ziplinegreen/vault/Model/Repo.java View File

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
+}