119 lines
5.7 KiB
Go
119 lines
5.7 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"apskel-pos-be/internal/entities"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
// ---- Request models ----
|
|
|
|
type SendNotificationRequest struct {
|
|
Title string `json:"title"`
|
|
Body string `json:"body"`
|
|
Type string `json:"type"`
|
|
Category string `json:"category"`
|
|
Priority entities.NotificationPriority `json:"priority"`
|
|
ImageURL string `json:"image_url"`
|
|
ActionURL string `json:"action_url"`
|
|
NotifiableType string `json:"notifiable_type"`
|
|
NotifiableID *uuid.UUID `json:"notifiable_id"`
|
|
Data map[string]interface{} `json:"data"`
|
|
ReceiverIDs []uuid.UUID `json:"receiver_ids"`
|
|
ScheduledAt *time.Time `json:"scheduled_at"`
|
|
ExpiredAt *time.Time `json:"expired_at"`
|
|
CreatedBy *uuid.UUID `json:"created_by"`
|
|
}
|
|
|
|
type BroadcastNotificationRequest struct {
|
|
Title string `json:"title"`
|
|
Body string `json:"body"`
|
|
Type string `json:"type"`
|
|
Category string `json:"category"`
|
|
Priority entities.NotificationPriority `json:"priority"`
|
|
ImageURL string `json:"image_url"`
|
|
ActionURL string `json:"action_url"`
|
|
NotifiableType string `json:"notifiable_type"`
|
|
NotifiableID *uuid.UUID `json:"notifiable_id"`
|
|
Data map[string]interface{} `json:"data"`
|
|
OrganizationID uuid.UUID `json:"organization_id"`
|
|
ScheduledAt *time.Time `json:"scheduled_at"`
|
|
ExpiredAt *time.Time `json:"expired_at"`
|
|
CreatedBy *uuid.UUID `json:"created_by"`
|
|
}
|
|
|
|
type MarkNotificationReadRequest struct {
|
|
NotificationReceiverID uuid.UUID `json:"notification_receiver_id"`
|
|
UserID uuid.UUID `json:"user_id"`
|
|
}
|
|
|
|
type ListNotificationsRequest struct {
|
|
Page int `json:"page"`
|
|
Limit int `json:"limit"`
|
|
UserID uuid.UUID `json:"user_id"`
|
|
IsRead *bool `json:"is_read"`
|
|
}
|
|
|
|
// ---- Response models ----
|
|
|
|
type NotificationResponse struct {
|
|
ID uuid.UUID `json:"id"`
|
|
Title string `json:"title"`
|
|
Body string `json:"body"`
|
|
Type string `json:"type"`
|
|
Category string `json:"category"`
|
|
Priority entities.NotificationPriority `json:"priority"`
|
|
ImageURL string `json:"image_url"`
|
|
ActionURL string `json:"action_url"`
|
|
NotifiableType string `json:"notifiable_type"`
|
|
NotifiableID *uuid.UUID `json:"notifiable_id"`
|
|
Data map[string]interface{} `json:"data"`
|
|
ScheduledAt *time.Time `json:"scheduled_at"`
|
|
SentAt *time.Time `json:"sent_at"`
|
|
ExpiredAt *time.Time `json:"expired_at"`
|
|
CreatedBy *uuid.UUID `json:"created_by"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type NotificationReceiverResponse struct {
|
|
ID uuid.UUID `json:"id"`
|
|
NotificationID uuid.UUID `json:"notification_id"`
|
|
UserID uuid.UUID `json:"user_id"`
|
|
IsRead bool `json:"is_read"`
|
|
ReadAt *time.Time `json:"read_at"`
|
|
IsDeleted bool `json:"is_deleted"`
|
|
DeletedAt *time.Time `json:"deleted_at"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
Notification *NotificationResponse `json:"notification,omitempty"`
|
|
}
|
|
|
|
type NotificationDeliveryResponse struct {
|
|
ID uuid.UUID `json:"id"`
|
|
NotificationReceiverID uuid.UUID `json:"notification_receiver_id"`
|
|
UserDeviceID uuid.UUID `json:"user_device_id"`
|
|
Channel entities.NotificationChannel `json:"channel"`
|
|
DeliveryStatus entities.NotificationDeliveryStatus `json:"delivery_status"`
|
|
Provider entities.NotificationProvider `json:"provider"`
|
|
ProviderMessageID string `json:"provider_message_id"`
|
|
SentAt *time.Time `json:"sent_at"`
|
|
DeliveredAt *time.Time `json:"delivered_at"`
|
|
FailedAt *time.Time `json:"failed_at"`
|
|
FailureReason string `json:"failure_reason"`
|
|
RetryCount int `json:"retry_count"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type ListNotificationsResponse struct {
|
|
Notifications []*NotificationReceiverResponse `json:"notifications"`
|
|
TotalCount int `json:"total_count"`
|
|
UnreadCount int `json:"unread_count"`
|
|
Page int `json:"page"`
|
|
Limit int `json:"limit"`
|
|
TotalPages int `json:"total_pages"`
|
|
}
|