1
0
forked from PGL/Clyde

notifications forum

This commit is contained in:
Debucquoy Anthony 2024-04-21 23:25:03 +02:00
parent 32810a9b01
commit 8ac1f7ed8b
Signed by untrusted user: tonitch
GPG Key ID: A78D6421F083D42E
3 changed files with 12 additions and 0 deletions

View File

@ -6,6 +6,7 @@ import lombok.AllArgsConstructor;
import ovh.herisson.Clyde.Repositories.CourseRepository; import ovh.herisson.Clyde.Repositories.CourseRepository;
import ovh.herisson.Clyde.Repositories.Msg.ForumRepository; import ovh.herisson.Clyde.Repositories.Msg.ForumRepository;
import ovh.herisson.Clyde.Repositories.Msg.TopicRepository; import ovh.herisson.Clyde.Repositories.Msg.TopicRepository;
import ovh.herisson.Clyde.Services.UserService;
import ovh.herisson.Clyde.Tables.Course; import ovh.herisson.Clyde.Tables.Course;
import ovh.herisson.Clyde.Tables.User; import ovh.herisson.Clyde.Tables.User;
import ovh.herisson.Clyde.Tables.Msg.Answer; import ovh.herisson.Clyde.Tables.Msg.Answer;
@ -16,17 +17,24 @@ import ovh.herisson.Clyde.Tables.Msg.Topic;
@AllArgsConstructor @AllArgsConstructor
public class ForumService { public class ForumService {
private UserService userServ;
private CourseRepository courseRepo; private CourseRepository courseRepo;
private ForumRepository forumRepo; private ForumRepository forumRepo;
private TopicRepository topicRepo; private TopicRepository topicRepo;
public void createForum(Course c, Forum f){ public void createForum(Course c, Forum f){
c.addForum(f); c.addForum(f);
for (User u: f.getRegister()) {
userServ.Notify(u, new Notification("forum.notification.forum.new", data.getSubject(), "/#/Forum"));
}
courseRepo.save(c); courseRepo.save(c);
} }
public void createTopic(Forum f, Topic data) { public void createTopic(Forum f, Topic data) {
f.addTopic(data); f.addTopic(data);
for (User u: f.getRegister()) {
userServ.Notify(u, new Notification("forum.notification.topic.new", data.getSubject(), "/#/Forum"));
}
forumRepo.save(f); forumRepo.save(f);
} }

View File

@ -125,6 +125,8 @@ msg.notification.new=You have a new message
forum.create=Create forum forum.create=Create forum
forum.create.name=New forum's name forum.create.name=New forum's name
forum.post.create.name=New post's title forum.post.create.name=New post's title
forum.notification.topic.new=New topic created
forum.notification.forum.new=New Forum created
firstname/name=Firstname/Name firstname/name=Firstname/Name
regNo=regNo regNo=regNo
From=From From=From

View File

@ -125,6 +125,8 @@ msg.notification.new=Vous avez un nouveau message!
forum.create=Créer un forum forum.create=Créer un forum
forum.create.name=Nom du forum forum.create.name=Nom du forum
forum.post.create.name=Titre du post forum.post.create.name=Titre du post
forum.notification.topic.new=Nouveau Topic crée
forum.notification.forum.new=Nouveau forum crée
firstname/name=Prénom/Nom firstname/name=Prénom/Nom
regNo=Matricule regNo=Matricule
From=De From=De