Files
tm_back/internal/notification/entity.go
T
n.nakhostin 9037cb5917 Refactor Notification Management and Enhance Customer Features
- Updated the notification handling logic to utilize a new SDK for sending notifications, improving the flexibility and scalability of the notification system.
- Introduced new methods in the notification service for sending notifications to users and customers based on various target audience types, enhancing the notification delivery capabilities.
- Added a new endpoint to assign companies to a customer, improving customer management functionalities.
- Refactored the customer entity and forms to replace 'CompanyIDs' with 'Companies', ensuring consistency across the data model.
- Enhanced API documentation with Swagger comments for the new endpoint and updated notification structures, ensuring clarity for API consumers.
2025-09-20 16:54:51 +03:30

67 lines
2.3 KiB
Go

package notification
// NotificationType represents the type of notification
type NotificationType string
const (
NotificationTypeInfo NotificationType = "info"
NotificationTypeWarning NotificationType = "warning"
NotificationTypeAlert NotificationType = "alert"
NotificationTypeReject NotificationType = "reject"
)
// NotificationPriority represents the priority level of notification
type NotificationPriority string
const (
NotificationPriorityLow NotificationPriority = "low"
NotificationPriorityMedium NotificationPriority = "medium"
NotificationPriorityImportant NotificationPriority = "important"
)
// DeliveryChannel represents the delivery channel for notification
type DeliveryChannel string
const (
DeliveryChannelPush DeliveryChannel = "push"
DeliveryChannelEmail DeliveryChannel = "email"
)
// DeliveryStatus represents the delivery status of notification
type NotificationStatus string
const (
DeliveryStatusPending NotificationStatus = "pending"
DeliveryStatusSent NotificationStatus = "sent"
DeliveryStatusFailed NotificationStatus = "failed"
)
// TargetAudienceType represents the type of target audience
// Supported audience types:
// - all_users: All users in the system
// - specific_users: Specific users by their IDs
// - all_role: All users with a specific role (e.g., all admins)
// - specific_role: Users with a specific role, optionally filtered by tender
// - specific_company: All users belonging to a specific company
// - all_companies: All users from all companies
// - specific_customer: All users belonging to a specific customer
// - all_customers: All users from all customers
type TargetAudienceType string
const (
TargetAudienceAllUsers TargetAudienceType = "all_users"
TargetAudienceSpecificUsers TargetAudienceType = "specific_users"
TargetAudienceAllRole TargetAudienceType = "all_role"
TargetAudienceSpecificRole TargetAudienceType = "specific_role"
TargetAudienceAllCompanies TargetAudienceType = "all_companies"
TargetAudienceSpecificCompany TargetAudienceType = "specific_company"
TargetAudienceAllCustomers TargetAudienceType = "all_customers"
TargetAudienceSpecificCustomer TargetAudienceType = "specific_customer"
)
type notificationRecipient struct {
UserID string
Email string
DeviceTokens []string
}