From bc37b8472687328c7ba2e8f101f934e00021c449 Mon Sep 17 00:00:00 2001 From: Mahdi Simin Date: Sat, 4 Apr 2026 04:51:28 +0330 Subject: [PATCH] feat/notification - restructure Notification app with new structure --- .../notification}/entity/channel.go | 0 .../notification}/entity/notification.go | 0 .../notification}/messagebroker/redis.go | 2 +- .../notification}/service/additem.go | 12 ++++++------ .../notification}/service/send.go | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) rename {notification-app => domain/notification}/entity/channel.go (100%) rename {notification-app => domain/notification}/entity/notification.go (100%) rename {notification-app => domain/notification}/messagebroker/redis.go (79%) rename {notification-app => domain/notification}/service/additem.go (76%) rename {notification-app => domain/notification}/service/send.go (57%) diff --git a/notification-app/entity/channel.go b/domain/notification/entity/channel.go similarity index 100% rename from notification-app/entity/channel.go rename to domain/notification/entity/channel.go diff --git a/notification-app/entity/notification.go b/domain/notification/entity/notification.go similarity index 100% rename from notification-app/entity/notification.go rename to domain/notification/entity/notification.go diff --git a/notification-app/messagebroker/redis.go b/domain/notification/messagebroker/redis.go similarity index 79% rename from notification-app/messagebroker/redis.go rename to domain/notification/messagebroker/redis.go index 31dc8033..c6974a9e 100644 --- a/notification-app/messagebroker/redis.go +++ b/domain/notification/messagebroker/redis.go @@ -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 { } diff --git a/notification-app/service/additem.go b/domain/notification/service/additem.go similarity index 76% rename from notification-app/service/additem.go rename to domain/notification/service/additem.go index b213b828..d79a9677 100644 --- a/notification-app/service/additem.go +++ b/domain/notification/service/additem.go @@ -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 } diff --git a/notification-app/service/send.go b/domain/notification/service/send.go similarity index 57% rename from notification-app/service/send.go rename to domain/notification/service/send.go index ef8b6d87..1d2c9211 100644 --- a/notification-app/service/send.go +++ b/domain/notification/service/send.go @@ -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