feat/notification - restructure Notification app with new structure

This commit is contained in:
Mahdi Simin 2026-04-04 04:51:28 +03:30
parent 6b150111c7
commit bc37b84726
5 changed files with 8 additions and 8 deletions

View File

@ -1,6 +1,6 @@
package messagebroker package messagebroker
import "git.gocasts.ir/ebhomengo/niki/notification-app/entity" import "git.gocasts.ir/ebhomengo/niki/domain/notification/entity"
type redis struct { type redis struct {
} }

View File

@ -3,10 +3,10 @@ package service
import ( import (
_ "time" _ "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 MessageBroker MessageBroker
Repository Repository Repository Repository
Channel Channel Channel Channel
@ -31,7 +31,7 @@ type NotificationServiceRequest struct {
Recipinet string Recipinet string
} }
func (n *notifservice) NewNotification(r NotificationServiceRequest) *entity.Notification { func (n *Notifservice) NewNotification(r NotificationServiceRequest) *entity.Notification {
// TODO add validation of notification properties // TODO add validation of notification properties
return &entity.Notification{ return &entity.Notification{
Type: r.Type, 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 { if err := n.Channel.SendMessage(notification); err != nil {
return err return err
} }
return nil return nil
} }
func (n *notifservice) Add(notification *entity.Notification) error { func (n *Notifservice) Add(notification *entity.Notification) error {
err := n.MessageBroker.AddItem(*notification) err := n.MessageBroker.AddItem(*notification)
if err != nil { if err != nil {
return err return err
@ -56,7 +56,7 @@ func (n *notifservice) Add(notification *entity.Notification) error {
return nil 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 { if err := n.MessageBroker.RemoveItem(*notification); err != nil {
return err return err
} }

View File

@ -1,6 +1,6 @@
package service package service
import "git.gocasts.ir/ebhomengo/niki/notification-app/entity" import "git.gocasts.ir/ebhomengo/niki/domain/notification/entity"
type sender interface { type sender interface {
Send(notification entity.Notification) error Send(notification entity.Notification) error