diff --git a/src/main/java/com/example/demo/config/WebSocketConfig.java b/src/main/java/com/example/demo/config/WebSocketConfig.java index 9efe38e77..030b6e68b 100644 --- a/src/main/java/com/example/demo/config/WebSocketConfig.java +++ b/src/main/java/com/example/demo/config/WebSocketConfig.java @@ -11,7 +11,7 @@ public class WebSocketConfig implements WebSocketMessageBrokerConfigurer { @Override public void registerStompEndpoints(StompEndpointRegistry stompEndpointRegistry) { - stompEndpointRegistry.addEndpoint("/websocket-chat") + stompEndpointRegistry.addEndpoint("/chat") .setAllowedOrigins("*") .withSockJS(); } diff --git a/src/main/java/com/example/demo/dto/MessageDTO.java b/src/main/java/com/example/demo/dto/MessageDTO.java new file mode 100644 index 000000000..79e513e1c --- /dev/null +++ b/src/main/java/com/example/demo/dto/MessageDTO.java @@ -0,0 +1,14 @@ +package com.example.demo.dto; + +public class MessageDTO { + + private String message; + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/src/main/java/com/example/demo/models/Message.java b/src/main/java/com/example/demo/models/Message.java index aeb5834cb..a4076b5bf 100644 --- a/src/main/java/com/example/demo/models/Message.java +++ b/src/main/java/com/example/demo/models/Message.java @@ -15,13 +15,13 @@ public class Message { Long id; @ManyToOne @JoinColumn(name = "profile_id") - @JsonIgnoreProperties("messages") + // @JsonIgnoreProperties("messages") Profile profile; String body; Date timestamp; @ManyToOne @JoinColumn(name = "channel_id") - @JsonIgnoreProperties("messages") + // @JsonIgnoreProperties("messages") Channel channel; diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 532817cf8..94980e58a 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,5 +1,5 @@ spring.datasource.url=jdbc:mysql://localhost:3306/chatter_box -spring.datasource.username=zach +spring.datasource.username=root spring.datasource.password=zipcode0 spring.jpa.hibernate.ddl-auto=update spring.jpa.show-sql=true diff --git a/target/classes/application.properties b/target/classes/application.properties index 532817cf8..94980e58a 100644 --- a/target/classes/application.properties +++ b/target/classes/application.properties @@ -1,5 +1,5 @@ spring.datasource.url=jdbc:mysql://localhost:3306/chatter_box -spring.datasource.username=zach +spring.datasource.username=root spring.datasource.password=zipcode0 spring.jpa.hibernate.ddl-auto=update spring.jpa.show-sql=true diff --git a/target/classes/com/example/demo/WebsocketApplication$1.class b/target/classes/com/example/demo/WebsocketApplication$1.class new file mode 100644 index 000000000..0383987a4 Binary files /dev/null and b/target/classes/com/example/demo/WebsocketApplication$1.class differ diff --git a/target/classes/com/example/demo/WebsocketApplication.class b/target/classes/com/example/demo/WebsocketApplication.class new file mode 100644 index 000000000..463f80fd0 Binary files /dev/null and b/target/classes/com/example/demo/WebsocketApplication.class differ diff --git a/target/classes/com/example/demo/config/WebSocketConfig.class b/target/classes/com/example/demo/config/WebSocketConfig.class new file mode 100644 index 000000000..ec0ecdd6e Binary files /dev/null and b/target/classes/com/example/demo/config/WebSocketConfig.class differ diff --git a/target/classes/com/example/demo/controller/SocketController.class b/target/classes/com/example/demo/controller/SocketController.class new file mode 100644 index 000000000..8d0b3e952 Binary files /dev/null and b/target/classes/com/example/demo/controller/SocketController.class differ diff --git a/target/classes/com/example/demo/dto/MessageDTO.class b/target/classes/com/example/demo/dto/MessageDTO.class new file mode 100644 index 000000000..4d0b19cc7 Binary files /dev/null and b/target/classes/com/example/demo/dto/MessageDTO.class differ diff --git a/target/classes/com/example/demo/models/Message.class b/target/classes/com/example/demo/models/Message.class index 2e1832482..0debf0301 100644 Binary files a/target/classes/com/example/demo/models/Message.class and b/target/classes/com/example/demo/models/Message.class differ diff --git a/target/classes/com/example/demo/repository/MessageRepo.class b/target/classes/com/example/demo/repository/MessageRepo.class index aa8a258cb..3526db893 100644 Binary files a/target/classes/com/example/demo/repository/MessageRepo.class and b/target/classes/com/example/demo/repository/MessageRepo.class differ