1
0
forked from PGL/Clyde

Managing the message with backend

Using DTO to change the way discussions and message are sent to the
client
This commit is contained in:
2024-03-27 19:50:52 +01:00
parent 914f6bdf36
commit b4499e04c7
7 changed files with 155 additions and 4 deletions

View File

@@ -1,16 +1,19 @@
package ovh.herisson.Clyde.Services.Msg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import lombok.AllArgsConstructor;
import com.fasterxml.jackson.databind.util.JSONPObject;
import ovh.herisson.Clyde.Repositories.Msg.DiscussionRepository;
import ovh.herisson.Clyde.Tables.User;
import ovh.herisson.Clyde.Tables.Msg.Discussion;
import ovh.herisson.Clyde.Tables.Msg.Message;
@Service
@AllArgsConstructor
public class DiscussionService {
@Autowired
private DiscussionRepository discRepo;
public Discussion create(String name, User author){
@@ -21,4 +24,8 @@ public class DiscussionService {
return discRepo.findByMembership(author.getRegNo());
}
public Discussion CreateMessage(Discussion disc, Message msg){
disc.addMessage(msg);
return discRepo.save(disc);
}
}