Enhance Notification and User Models with New Fields and Update Swagger Documentation
- Added 'image' and 'link' fields to the NotificationRequest and NotificationResponse structures, improving the flexibility of notification content. - Updated the 'created_at', 'updated_at', and 'schedule_at' fields to use integer types for Unix timestamps, ensuring consistency in time handling. - Expanded the tender status enumeration to include 'closed', 'modified', 'suspended', and 'published', enhancing the representation of tender states. - Reflected these changes in the Swagger documentation, ensuring accurate API specifications for clients.
This commit is contained in:
@@ -33,6 +33,8 @@ type NotificationRequest struct {
|
||||
EventType EventType `json:"event_type"`
|
||||
Priority string `json:"priority"`
|
||||
ScheduledAt int64 `json:"scheduled_at"`
|
||||
Link string `json:"link"`
|
||||
Image string `json:"image"`
|
||||
Metadata map[string]any `json:"metadata"`
|
||||
Methods NotificationMethods `json:"methods"`
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ type Model struct {
|
||||
Title string
|
||||
Type string
|
||||
Priority string
|
||||
Link string
|
||||
Image string
|
||||
ScheduledAt int64
|
||||
Recipient string
|
||||
UserID string
|
||||
@@ -41,6 +43,8 @@ func (s *Service) SendEmail(ctx context.Context, model Model) (*NotificationResp
|
||||
Type: model.Type,
|
||||
Priority: model.Priority,
|
||||
ScheduledAt: model.ScheduledAt,
|
||||
Link: model.Link,
|
||||
Image: model.Image,
|
||||
Methods: NotificationMethods{
|
||||
Email: model.Recipient,
|
||||
},
|
||||
@@ -59,6 +63,8 @@ func (s *Service) SendSMS(ctx context.Context, model Model) (*NotificationRespon
|
||||
Type: model.Type,
|
||||
Priority: model.Priority,
|
||||
ScheduledAt: model.ScheduledAt,
|
||||
Link: model.Link,
|
||||
Image: model.Image,
|
||||
Methods: NotificationMethods{
|
||||
SMS: model.Recipient,
|
||||
},
|
||||
@@ -77,6 +83,8 @@ func (s *Service) SendPush(ctx context.Context, model Model) (*NotificationRespo
|
||||
Type: model.Type,
|
||||
Priority: model.Priority,
|
||||
ScheduledAt: model.ScheduledAt,
|
||||
Link: model.Link,
|
||||
Image: model.Image,
|
||||
Methods: NotificationMethods{
|
||||
Push: model.Recipient,
|
||||
},
|
||||
@@ -95,6 +103,8 @@ func (s *Service) SendOTP(ctx context.Context, model Model) (*NotificationRespon
|
||||
Type: model.Type,
|
||||
Priority: model.Priority,
|
||||
ScheduledAt: model.ScheduledAt,
|
||||
Link: model.Link,
|
||||
Image: model.Image,
|
||||
Methods: NotificationMethods{
|
||||
OTP: model.Recipient,
|
||||
},
|
||||
@@ -134,6 +144,8 @@ func (s *Service) Health(ctx context.Context) error {
|
||||
Type: "info",
|
||||
Priority: "low",
|
||||
ScheduledAt: 0,
|
||||
Link: "",
|
||||
Image: "",
|
||||
Methods: NotificationMethods{
|
||||
Email: "test@example.com",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user