Files
tm_back/internal/notification/form.go
T
n.nakhostin aef91b4711 Add Notification Filters for Seen and Priority
- Introduced new optional fields in the SearchForm for filtering notifications by 'seen' status and 'priority', enhancing the flexibility of notification retrieval.
- Updated the GetNotifications method in the notification service to accommodate the new filters, ensuring they are included in the query parameters.
- Enhanced the notification client to support the new filters in API requests, improving the overall functionality of the notification system.
- Updated API documentation with Swagger comments to reflect the new query parameters, ensuring clarity for API consumers.
2025-09-22 09:57:14 +03:30

59 lines
2.4 KiB
Go

package notification
import (
"time"
"tm/pkg/response"
)
// CreateRequest represents the request to create a notification
type NotificationRequest struct {
Recipient []string `json:"recipient"`
Tender string `json:"tender" valid:"optional,stringlength(1|100)"`
Channels []DeliveryChannel `json:"channels" valid:"required"`
Type NotificationType `json:"type" valid:"required"`
Priority NotificationPriority `json:"priority" valid:"required"`
Target TargetAudienceType `json:"target" valid:"required"`
Title string `json:"title" valid:"required"`
Description string `json:"description" valid:"required"`
Link *string `json:"link" valid:"optional,url"`
ScheduleAt int64 `json:"schedule_at" valid:"optional"`
}
// SearchForm represents the form for searching notifications
type SearchForm struct {
Status string `query:"status" valid:"optional"`
Method string `query:"method" valid:"optional"`
EventType string `query:"event_type" valid:"optional"`
Type string `query:"type" valid:"optional"`
Recipient string `query:"recipient" valid:"optional"`
Seen *bool `query:"seen" valid:"optional"`
Priority string `query:"priority" valid:"optional"`
}
type NotificationListResponse struct {
Notifications []*NotificationResponse `json:"notifications"`
Meta *response.Meta `json:"meta"`
}
type NotificationResponse struct {
ID string `json:"id"`
UserID string `json:"user_id"`
Title string `json:"title"`
Message string `json:"message"`
Link *string `json:"link"`
Image *string `json:"image"`
Priority string `json:"priority"`
Type string `json:"type"`
EventType string `json:"event_type"`
Status string `json:"status"`
Methods map[string]string `json:"methods"`
Metadata map[string]any `json:"metadata"`
ScheduleAt int64 `json:"schedule_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Seen bool `json:"seen"`
SeenAt int64 `json:"seen_at"`
IsScheduled bool `json:"is_scheduled"`
ScheduledAt int64 `json:"scheduled_at"`
}