feat: add notification events handling and MQTT integration

- Implemented notification event publishing with a new NotificationEventPublisher interface.
- Created a noopNotificationEventPublisher for testing purposes.
- Added functionality to publish notification created events via MQTT.
- Introduced a new stream event publisher for handling job logs and updates.
- Added database migration for popup_ads table.
- Created tests for notification events and popup ads functionality.
- Established MQTT connection and publishing helpers for event messages.
This commit is contained in:
2026-03-29 15:47:09 +00:00
parent a910e6c624
commit 863a0ea2f6
42 changed files with 4606 additions and 576 deletions

View File

@@ -43,6 +43,10 @@ type PaymentRepository interface {
ExecuteSubscriptionPayment(ctx context.Context, userID string, plan *model.Plan, termMonths int32, paymentMethod string, paymentRecord *model.Payment, invoiceID string, now time.Time, validateFunding func(currentWalletBalance float64) (float64, error)) (*model.PlanSubscription, float64, error)
}
type NotificationEventPublisher interface {
PublishNotificationCreated(ctx context.Context, notification *model.Notification) error
}
type AccountRepository interface {
DeleteUserAccount(ctx context.Context, userID string) error
ClearUserData(ctx context.Context, userID string) error
@@ -76,6 +80,18 @@ type AdTemplateRepository interface {
DeleteByIDAndClearVideos(ctx context.Context, id string) error
}
type PopupAdRepository interface {
ListByUser(ctx context.Context, userID string, limit int32, offset int) ([]model.PopupAd, int64, error)
ListForAdmin(ctx context.Context, search string, userID string, limit int32, offset int) ([]model.PopupAd, int64, error)
GetByID(ctx context.Context, id string) (*model.PopupAd, error)
GetByIDAndUser(ctx context.Context, id string, userID string) (*model.PopupAd, error)
GetActiveByUser(ctx context.Context, userID string) (*model.PopupAd, error)
Create(ctx context.Context, item *model.PopupAd) error
Save(ctx context.Context, item *model.PopupAd) error
DeleteByIDAndUser(ctx context.Context, id string, userID string) (int64, error)
DeleteByID(ctx context.Context, id string) (int64, error)
}
type PlayerConfigRepository interface {
ListByUser(ctx context.Context, userID string) ([]model.PlayerConfig, error)
ListForAdmin(ctx context.Context, search string, userID string, limit int32, offset int) ([]model.PlayerConfig, int64, error)