@@ -2,44 +2,32 @@ syntax = "proto2";
22
33import "scalapb/scalapb.proto" ;
44import "model/notifications.proto" ;
5- import "message/schedule.proto" ;
65
7- package org .softnetwork.notification.message ;
6+ package app .softnetwork.notification.message ;
87
98option (scalapb.options ) = {
109 single_file : true
1110 flat_package : true
1211 import : "app.softnetwork.persistence.message._"
13- import : "org.softnetwork.akka.message.SchedulerEvents._"
1412 import : "app.softnetwork.persistence.model._"
15- import : "app.softnetwork.notification .message._"
13+ import : "app.softnetwork.scheduler .message.SchedulerEvents ._"
1614 import : "app.softnetwork.notification.model._"
17- import : "org.softnetwork.notification.model._"
18- preamble : "sealed trait NotificationEvent extends Event{def uuid: String}"
19- preamble : "sealed trait NotificationRecordedEvent[T<:Notification] extends NotificationEvent{def notification: T; val uuid = notification.uuid}"
20- preamble : "sealed trait NotificationToSchedulerEvent extends SchedulerEventWithCommand with NotificationEvent with Entity {val uuid = ALL_KEY}"
21- preamble : "trait NotificationCommandEvent extends NotificationEvent"
22- preamble : "trait AddNotificationCommandEvent extends NotificationCommandEvent {def notification: Notification; val uuid = notification.uuid}"
23- preamble : "trait WrapNotificationCommandEvent extends NotificationCommandEvent {def event: NotificationCommandEvent; lazy val uuid = event.uuid}"
15+ preamble : "sealed trait NotificationEvent extends ExternalSchedulerEvent"
16+ preamble : "trait ExternalNotificationEvent extends NotificationEvent"
17+ preamble : "trait NotificationCommandEvent extends ExternalNotificationEvent {def command: Option[NotificationCommand]}"
18+ preamble : "trait AddNotificationCommandEvent extends ExternalNotificationEvent {def notification: Notification}"
2419 preserve_unknown_fields : false
2520};
2621
27- message MailRecordedEvent {
22+ message NotificationRecordedEvent {
2823 option (scalapb.message ).extends = "ProtobufEvent" ;
29- option (scalapb.message ).extends = "NotificationRecordedEvent[Mail]" ;
30- required org.softnetwork.notification.model.Mail notification = 1 ;
31- }
32-
33- message SMSRecordedEvent {
34- option (scalapb.message ).extends = "ProtobufEvent" ;
35- option (scalapb.message ).extends = "NotificationRecordedEvent[SMS]" ;
36- required org.softnetwork.notification.model.SMS notification = 1 ;
37- }
38-
39- message PushRecordedEvent {
40- option (scalapb.message ).extends = "ProtobufEvent" ;
41- option (scalapb.message ).extends = "NotificationRecordedEvent[Push]" ;
42- required org.softnetwork.notification.model.Push notification = 1 ;
24+ option (scalapb.message ).extends = "NotificationEvent" ;
25+ option (scalapb.message ).extends = "NotificationRecordedEventDecorator" ;
26+ oneof wrapped {
27+ app.softnetwork.notification.model.Mail mail = 1 ;
28+ app.softnetwork.notification.model.SMS sms = 2 ;
29+ app.softnetwork.notification.model.Push push = 3 ;
30+ }
4331}
4432
4533message NotificationRemovedEvent {
@@ -48,38 +36,38 @@ message NotificationRemovedEvent{
4836 required string uuid = 1 ;
4937}
5038
51- message ScheduleForNotificationAdded {
39+ message ExternalEntityToNotificationEvent {
5240 option (scalapb.message ).extends = "ProtobufEvent" ;
53- option (scalapb.message ).extends = "NotificationToSchedulerEvent " ;
54- required app.softnetwork.scheduler. message.AddSchedule command = 1 ;
55- }
56-
57- message ScheduleForNotificationRemoved {
58- option (scalapb . message).extends = "ProtobufEvent" ;
59- option (scalapb . message).extends = "NotificationToSchedulerEvent" ;
60- required app.softnetwork.scheduler.message.RemoveSchedule command = 1 ;
41+ option (scalapb.message ).extends = "NotificationEvent " ;
42+ option (scalapb . message).extends = "ExternalEntityToNotificationEventDecorator" ;
43+ oneof wrapped {
44+ app.softnetwork.notification.message.AddMailCommandEvent addMail = 1 ;
45+ app.softnetwork.notification. message.AddSMSCommandEvent addSMS = 2 ;
46+ app.softnetwork.notification. message.AddPushCommandEvent addPush = 3 ;
47+ app.softnetwork.notification. message.RemoveNotificationCommandEvent removeNotification = 4 ;
48+ }
6149}
6250
6351message AddMailCommandEvent {
6452 option (scalapb.message ).extends = "ProtobufEvent" ;
6553 option (scalapb.message ).extends = "AddNotificationCommandEvent" ;
66- required org .softnetwork.notification.model.Mail notification = 1 ;
54+ required app .softnetwork.notification.model.Mail notification = 1 ;
6755}
6856
6957message AddSMSCommandEvent {
7058 option (scalapb.message ).extends = "ProtobufEvent" ;
7159 option (scalapb.message ).extends = "AddNotificationCommandEvent" ;
72- required org .softnetwork.notification.model.SMS notification = 1 ;
60+ required app .softnetwork.notification.model.SMS notification = 1 ;
7361}
7462
7563message AddPushCommandEvent {
7664 option (scalapb.message ).extends = "ProtobufEvent" ;
7765 option (scalapb.message ).extends = "AddNotificationCommandEvent" ;
78- required org .softnetwork.notification.model.Push notification = 1 ;
66+ required app .softnetwork.notification.model.Push notification = 1 ;
7967}
8068
8169message RemoveNotificationCommandEvent {
8270 option (scalapb.message ).extends = "ProtobufEvent" ;
83- option (scalapb.message ).extends = "NotificationCommandEvent " ;
71+ option (scalapb.message ).extends = "ExternalNotificationEvent " ;
8472 required string uuid = 1 ;
8573}
0 commit comments