Enhance Notification System with New API Endpoints and Response Structures
- Added new endpoints for marking notifications as seen and retrieving detailed notification information for both admin and user contexts, improving the flexibility of the notification system. - Implemented the MarkSeen and ViewNotification methods in the NotificationHandler, ensuring proper handling of notification visibility and details retrieval. - Updated the NotificationService interface to include methods for getting notification details and marking notifications as seen, enhancing service capabilities. - Enhanced the notification response structures to include additional fields such as Image, Seen, and ScheduledAt, providing richer data in API responses. - Updated API documentation with Swagger comments for the new endpoints and response formats, ensuring clarity for API consumers.
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package notification
|
||||
|
||||
import "tm/pkg/response"
|
||||
import (
|
||||
"time"
|
||||
"tm/pkg/response"
|
||||
)
|
||||
|
||||
// CreateRequest represents the request to create a notification
|
||||
type NotificationRequest struct {
|
||||
@@ -34,8 +37,9 @@ type NotificationResponse struct {
|
||||
ID string `json:"id"`
|
||||
UserID string `json:"user_id"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
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"`
|
||||
@@ -43,6 +47,10 @@ type NotificationResponse struct {
|
||||
Methods map[string]string `json:"methods"`
|
||||
Metadata map[string]any `json:"metadata"`
|
||||
ScheduleAt int64 `json:"schedule_at"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
UpdatedAt int64 `json:"updated_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"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user