niki/notification-app/service/additem.go

49 lines
945 B
Go

package service
import (
_ "time"
"git.gocasts.ir/ebhomengo/niki/notification-app/entity"
)
type notifservice struct {
//MessageBroker MessageBroker
}
func NewNotifservice() *notifservice {
return &notifservice{}
}
func (n *notifservice) NewNotification(notificationType entity.NotificationType, Recipinet, Body string) *entity.Notification {
return &entity.Notification{
Type: notificationType,
Recipinet: Recipinet,
Body: Body,
Status: entity.Pending,
}
}
func (n *notifservice) Send(notification entity.Notification) error {
return nil
}
func (n *notifservice) Add(notification *entity.Notification) error {
return nil
}
type MessageBroker interface {
AddItem(notification entity.Notification) error
RemoveItem(notification entity.Notification) error
HealthCheck() error
}
func main() {
f := NewNotifservice()
notif := f.NewNotification(entity.SMS, "09201008697", "Hello World")
f.Add(notif)
}