37 lines
1.3 KiB
Go
37 lines
1.3 KiB
Go
package service
|
|
|
|
import "bitbucket.org/nemt/nemt-portal-api/domain/entity"
|
|
|
|
// userService is the domain service for user operations
|
|
type notificationService struct {
|
|
svc *Service
|
|
}
|
|
|
|
// newUserService returns an instance of userService
|
|
func newNotificationService(svc *Service) *notificationService {
|
|
return ¬ificationService{
|
|
svc: svc,
|
|
}
|
|
}
|
|
|
|
// Save the ride for a expected user
|
|
func (s *notificationService) Create(notification entity.Notification) (entity.Notification, error) {
|
|
return s.svc.db.Notification().Create(notification)
|
|
}
|
|
|
|
func (c *notificationService) GetByUserUUIDAndReadStatus(userUUID string, status string, isRead bool) ([]entity.Notification, error) {
|
|
return c.svc.db.Notification().GetByUserUUIDAndReadStatus(userUUID, status, isRead)
|
|
}
|
|
|
|
func (c *notificationService) GetByUserUUID(userUUID string, status string) ([]entity.Notification, error) {
|
|
return c.svc.db.Notification().GetByUserUUID(userUUID, status)
|
|
}
|
|
|
|
func (c *notificationService) ReadStatus(notificationUUID string, isRead bool) error {
|
|
return c.svc.db.Notification().ReadStatus(notificationUUID, isRead)
|
|
}
|
|
|
|
func (c *notificationService) GetLastNotificationFromPhoneNumber(notificationType string, phoneNumber string, status string) (entity.Notification, error) {
|
|
return c.svc.db.Notification().GetLastNotificationFromPhoneNumber(notificationType, phoneNumber, status)
|
|
}
|