- Added new notification handling in the wallet service to notify admins when wallet balances are low or insufficient. - Created a new file for wallet notifications and moved relevant functions from the wallet service to this new file. - Updated the wallet service to publish wallet events including wallet type. - Refactored the client code to improve readability and maintainability. - Enhanced the bet handler to support pagination and status filtering for bets. - Updated routes and handlers for user search functionality to improve clarity and organization. - Modified cron job scheduling to comment out unused jobs for clarity. - Updated the WebSocket broadcast to include wallet type in notifications. - Adjusted the makefile to include Kafka in the docker-compose setup for local development.
20 lines
617 B
Go
20 lines
617 B
Go
package event
|
|
|
|
import "github.com/SamuelTariku/FortuneBet-Backend/internal/domain"
|
|
|
|
type WalletEventType string
|
|
|
|
const (
|
|
WalletBalanceUpdated WalletEventType = "wallet.balance.updated"
|
|
WalletLowAlert WalletEventType = "wallet.alert.low_balance"
|
|
)
|
|
|
|
type WalletEvent struct {
|
|
EventType WalletEventType `json:"event_type"`
|
|
WalletID int64 `json:"wallet_id"`
|
|
UserID int64 `json:"user_id"`
|
|
Balance domain.Currency `json:"balance"`
|
|
WalletType domain.WalletType `json:"wallet_type"`
|
|
Trigger string `json:"trigger"` // e.g. "AddToWallet", "DeductFromWallet"
|
|
}
|