Files
tm_back/pkg/notification/interfaces.go
T
n.nakhostin 108629278a Integrate Notification Service into Tender Management System
- Added a new notification service to handle various notification types (email, SMS, push, OTP).
- Implemented configuration for the notification service, allowing customization via environment variables.
- Updated user and customer services to utilize the notification service for sending welcome emails and status updates.
- Introduced a builder pattern for constructing notification requests, enhancing usability and flexibility.
- Enhanced error handling and logging for notification operations, ensuring robust service integration.
- Updated documentation to include usage examples and configuration details for the new notification SDK.
2025-09-16 15:35:36 +03:30

57 lines
1.7 KiB
Go

package notification
import (
"context"
)
// NotificationService defines the interface for notification operations
type NotificationService interface {
// SendNotification sends a notification using the configured client
SendNotification(ctx context.Context, req *NotificationRequest) (*NotificationResponse, error)
// SendEmail sends an email notification
SendEmail(ctx context.Context, email, message, userID string) (*NotificationResponse, error)
// SendSMS sends an SMS notification
SendSMS(ctx context.Context, phoneNumber, message, userID string) (*NotificationResponse, error)
// SendPush sends a push notification
SendPush(ctx context.Context, deviceToken, message, userID string) (*NotificationResponse, error)
// SendOTP sends an OTP notification
SendOTP(ctx context.Context, phoneNumber, message, userID string) (*NotificationResponse, error)
// Health checks if the notification service is available
Health(ctx context.Context) error
}
// Builder provides a fluent interface for building notification requests
type Builder interface {
// SetEventType sets the event type
SetEventType(eventType EventType) Builder
// SetMessage sets the notification message
SetMessage(message string) Builder
// SetUserID sets the user ID
SetUserID(userID string) Builder
// SetEmail sets the email address
SetEmail(email string) Builder
// SetSMS sets the SMS phone number
SetSMS(phoneNumber string) Builder
// SetPush sets the push device token
SetPush(deviceToken string) Builder
// SetOTP sets the OTP phone number
SetOTP(phoneNumber string) Builder
// Build creates the notification request
Build() (*NotificationRequest, error)
// Send builds and sends the notification
Send(ctx context.Context) (*NotificationResponse, error)
}