forked from ebhomengo/niki
1
0
Fork 0
niki/service/notification/kindboxreq_assigned.go

29 lines
930 B
Go
Raw Normal View History

package notification
import (
"context"
"fmt"
params "git.gocasts.ir/ebhomengo/niki/param"
adminserviceparam "git.gocasts.ir/ebhomengo/niki/param/admin/admin"
kbparam "git.gocasts.ir/ebhomengo/niki/param/admin/kind_box_req"
smsmsg "git.gocasts.ir/ebhomengo/niki/pkg/sms_msg"
)
func (s Service) KindBoxReqAssigned(req params.NotificationKindBoxReqAssigned) {
const op = "notification.KindBoxReqAssigned"
ctx := context.Background()
kb, err := s.KindBoxReqSvc.Get(ctx, kbparam.GetKindBoxReqRequest{
KindBoxID: req.KindBoxReqID,
})
if err != nil {
fmt.Println(fmt.Errorf("error(%s):%w", op, err))
}
bnf, gErr := s.AdminSvc.AdminExistByID(ctx, adminserviceparam.AdminExistByIDRequest{AdminID: kb.Data.SenderAgentID})
if gErr != nil {
fmt.Println(fmt.Errorf("error(%s):%w", op, gErr))
}
s.smsAdapter.Send(bnf.Admin.PhoneNumber, fmt.Sprintf(smsmsg.SmsMsgKindBoxReqAssigned, bnf.Admin.FirstName, kb.Data.ID))
}