Files
tm_back/internal/notification/entity.go
T
Mazyar b671dc3fd8
continuous-integration/drone/push Build is passing
Enhance notification system with in-app delivery support
- Added `DeliveryChannelInApp` to support in-app notifications.
- Introduced `EventTypeInApp` constant for identifying in-app notifications.
- Updated `AdminNotifications` and `CustomerNotifications` handlers to set the event type to `EventTypeInApp`.
- Modified the `GetByUserID` repository method to handle filtering for in-app notifications, allowing for more flexible retrieval options.
- Updated the `persistNotification` method to include in-app as a delivery method.

This update improves the notification system by enabling in-app notifications, enhancing user engagement and notification management capabilities.
2026-06-21 14:47:15 +03:30

71 lines
2.5 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"
DeliveryChannelInApp DeliveryChannel = "in_app"
)
// EventTypeInApp identifies notifications stored for the in-app notification center.
const EventTypeInApp = "in_app"
// 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
}