package mappers import ( "apskel-pos-be/internal/entities" "apskel-pos-be/internal/models" ) func NotificationEntityToResponse(e *entities.Notification) *models.NotificationResponse { if e == nil { return nil } return &models.NotificationResponse{ ID: e.ID, Title: e.Title, Body: e.Body, Type: e.Type, Category: e.Category, Priority: e.Priority, ImageURL: e.ImageURL, ActionURL: e.ActionURL, NotifiableType: e.NotifiableType, NotifiableID: e.NotifiableID, Data: e.Data, ScheduledAt: e.ScheduledAt, SentAt: e.SentAt, ExpiredAt: e.ExpiredAt, CreatedBy: e.CreatedBy, CreatedAt: e.CreatedAt, UpdatedAt: e.UpdatedAt, } } func NotificationReceiverEntityToResponse(e *entities.NotificationReceiver) *models.NotificationReceiverResponse { if e == nil { return nil } resp := &models.NotificationReceiverResponse{ ID: e.ID, NotificationID: e.NotificationID, UserID: e.UserID, IsRead: e.IsRead, ReadAt: e.ReadAt, IsDeleted: e.IsDeleted, DeletedAt: e.DeletedAt, CreatedAt: e.CreatedAt, UpdatedAt: e.UpdatedAt, } if e.Notification != nil { resp.Notification = NotificationEntityToResponse(e.Notification) } return resp } func NotificationReceiverEntitiesToResponses(entities []*entities.NotificationReceiver) []*models.NotificationReceiverResponse { if entities == nil { return nil } responses := make([]*models.NotificationReceiverResponse, len(entities)) for i, e := range entities { responses[i] = NotificationReceiverEntityToResponse(e) } return responses } func NotificationDeliveryEntityToResponse(e *entities.NotificationDelivery) *models.NotificationDeliveryResponse { if e == nil { return nil } return &models.NotificationDeliveryResponse{ ID: e.ID, NotificationReceiverID: e.NotificationReceiverID, UserDeviceID: e.UserDeviceID, Channel: e.Channel, DeliveryStatus: e.DeliveryStatus, Provider: e.Provider, ProviderMessageID: e.ProviderMessageID, SentAt: e.SentAt, DeliveredAt: e.DeliveredAt, FailedAt: e.FailedAt, FailureReason: e.FailureReason, RetryCount: e.RetryCount, CreatedAt: e.CreatedAt, UpdatedAt: e.UpdatedAt, } }