forked from ebhomengo/niki
feat/notification - restructure Notification app with new structure
This commit is contained in:
parent
6b150111c7
commit
bc37b84726
|
|
@ -1,6 +1,6 @@
|
|||
package messagebroker
|
||||
|
||||
import "git.gocasts.ir/ebhomengo/niki/notification-app/entity"
|
||||
import "git.gocasts.ir/ebhomengo/niki/domain/notification/entity"
|
||||
|
||||
type redis struct {
|
||||
}
|
||||
|
|
@ -3,10 +3,10 @@ package service
|
|||
import (
|
||||
_ "time"
|
||||
|
||||
"git.gocasts.ir/ebhomengo/niki/notification-app/entity"
|
||||
"git.gocasts.ir/ebhomengo/niki/domain/notification/entity"
|
||||
)
|
||||
|
||||
type notifservice struct {
|
||||
type Notifservice struct {
|
||||
MessageBroker MessageBroker
|
||||
Repository Repository
|
||||
Channel Channel
|
||||
|
|
@ -31,7 +31,7 @@ type NotificationServiceRequest struct {
|
|||
Recipinet string
|
||||
}
|
||||
|
||||
func (n *notifservice) NewNotification(r NotificationServiceRequest) *entity.Notification {
|
||||
func (n *Notifservice) NewNotification(r NotificationServiceRequest) *entity.Notification {
|
||||
// TODO add validation of notification properties
|
||||
return &entity.Notification{
|
||||
Type: r.Type,
|
||||
|
|
@ -41,14 +41,14 @@ func (n *notifservice) NewNotification(r NotificationServiceRequest) *entity.Not
|
|||
}
|
||||
}
|
||||
|
||||
func (n *notifservice) Send(notification entity.Notification) error {
|
||||
func (n *Notifservice) Send(notification entity.Notification) error {
|
||||
if err := n.Channel.SendMessage(notification); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *notifservice) Add(notification *entity.Notification) error {
|
||||
func (n *Notifservice) Add(notification *entity.Notification) error {
|
||||
err := n.MessageBroker.AddItem(*notification)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
@ -56,7 +56,7 @@ func (n *notifservice) Add(notification *entity.Notification) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (n *notifservice) Archive(notification *entity.Notification) error {
|
||||
func (n *Notifservice) Archive(notification *entity.Notification) error {
|
||||
if err := n.MessageBroker.RemoveItem(*notification); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package service
|
||||
|
||||
import "git.gocasts.ir/ebhomengo/niki/notification-app/entity"
|
||||
import "git.gocasts.ir/ebhomengo/niki/domain/notification/entity"
|
||||
|
||||
type sender interface {
|
||||
Send(notification entity.Notification) error
|
||||
Loading…
Reference in New Issue