popok 502 fix
This commit is contained in:
parent
c5796b07f0
commit
3768ff857a
27
cmd/main.go
27
cmd/main.go
|
|
@ -115,6 +115,7 @@ func main() {
|
|||
wallet.WalletStore(store),
|
||||
wallet.TransferStore(store),
|
||||
notificatioStore,
|
||||
notificationSvc,
|
||||
logger,
|
||||
)
|
||||
|
||||
|
|
@ -206,22 +207,22 @@ func main() {
|
|||
httpserver.StartTicketCrons(*ticketSvc)
|
||||
|
||||
// Fetch companies and branches for live wallet metrics update
|
||||
ctx := context.Background()
|
||||
// ctx := context.Background()
|
||||
|
||||
companies := []domain.GetCompany{
|
||||
{ID: 1, Name: "Company A", WalletBalance: 1000.0},
|
||||
}
|
||||
// companies := []domain.GetCompany{
|
||||
// {ID: 1, Name: "Company A", WalletBalance: 1000.0},
|
||||
// }
|
||||
|
||||
branches := []domain.BranchWallet{
|
||||
{ID: 10, Name: "Branch Z", CompanyID: 1, Balance: 500.0},
|
||||
}
|
||||
// branches := []domain.BranchWallet{
|
||||
// {ID: 10, Name: "Branch Z", CompanyID: 1, Balance: 500.0},
|
||||
// }
|
||||
|
||||
notificationSvc.UpdateLiveWalletMetrics(ctx, companies, branches)
|
||||
if err != nil {
|
||||
log.Println("Failed to update live metrics:", err)
|
||||
} else {
|
||||
log.Println("Live metrics broadcasted successfully")
|
||||
}
|
||||
// notificationSvc.UpdateLiveWalletMetrics(ctx, companies, branches)
|
||||
// if err != nil {
|
||||
// log.Println("Failed to update live metrics:", err)
|
||||
// } else {
|
||||
// log.Println("Live metrics broadcasted successfully")
|
||||
// }
|
||||
|
||||
issueReportingRepo := repository.NewReportedIssueRepository(store)
|
||||
|
||||
|
|
|
|||
|
|
@ -14,11 +14,12 @@ type Service struct {
|
|||
logger *slog.Logger
|
||||
}
|
||||
|
||||
func NewService(walletStore WalletStore, transferStore TransferStore, notificationStore notificationservice.NotificationStore, logger *slog.Logger) *Service {
|
||||
func NewService(walletStore WalletStore, transferStore TransferStore, notificationStore notificationservice.NotificationStore, notificationSvc *notificationservice.Service, logger *slog.Logger) *Service {
|
||||
return &Service{
|
||||
walletStore: walletStore,
|
||||
transferStore: transferStore,
|
||||
notificationStore: notificationStore,
|
||||
notificationSvc: notificationSvc,
|
||||
logger: logger,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ func (s *Service) DeductFromWallet(ctx context.Context, id int64, amount domain.
|
|||
return domain.Transfer{}, nil
|
||||
}
|
||||
|
||||
go s.notificationSvc.UpdateLiveWalletMetricForWallet(ctx, wallet)
|
||||
// go s.notificationSvc.UpdateLiveWalletMetricForWallet(ctx, wallet)
|
||||
|
||||
// Log the transfer here for reference
|
||||
newTransfer, err := s.transferStore.CreateTransfer(ctx, domain.CreateTransfer{
|
||||
|
|
|
|||
|
|
@ -108,7 +108,11 @@ func (h *Handler) HandlePlayerInfo(c *fiber.Ctx) error {
|
|||
func (h *Handler) HandleBet(c *fiber.Ctx) error {
|
||||
var req domain.PopOKBetRequest
|
||||
if err := c.BodyParser(&req); err != nil {
|
||||
return fiber.NewError(fiber.StatusBadRequest, "Invalid bet request")
|
||||
return c.Status(fiber.StatusBadRequest).JSON(domain.ErrorResponse{
|
||||
Message: "Invalid bet request",
|
||||
Error: err.Error(),
|
||||
})
|
||||
// return fiber.NewError(fiber.StatusBadRequest, "Invalid bet request")
|
||||
}
|
||||
|
||||
resp, _ := h.virtualGameSvc.ProcessBet(c.Context(), &req)
|
||||
|
|
@ -179,7 +183,11 @@ func (h *Handler) GetGameList(c *fiber.Ctx) error {
|
|||
|
||||
games, err := h.virtualGameSvc.ListGames(c.Context(), currency)
|
||||
if err != nil {
|
||||
return fiber.NewError(fiber.StatusBadGateway, "failed to fetch games")
|
||||
return c.Status(fiber.StatusBadGateway).JSON(domain.ErrorResponse{
|
||||
Message: "Falied to fetch games",
|
||||
Error: err.Error(),
|
||||
})
|
||||
// return fiber.NewError(fiber.StatusBadGateway, "failed to fetch games")
|
||||
}
|
||||
return c.JSON(games)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -259,9 +259,9 @@ func (a *App) initAppRoutes() {
|
|||
group.Post("/veli/start-game", a.authMiddleware, h.StartGame)
|
||||
group.Post("/veli/start-demo-game", a.authMiddleware, h.StartDemoGame)
|
||||
a.fiber.Post("/balance", h.GetBalance)
|
||||
a.fiber.Post("/bet", h.PlaceBet)
|
||||
a.fiber.Post("/win", h.RegisterWin)
|
||||
a.fiber.Post("/cancel", h.CancelTransaction)
|
||||
// a.fiber.Post("/bet", h.PlaceBet)
|
||||
// a.fiber.Post("/win", h.RegisterWin)
|
||||
// a.fiber.Post("/cancel", h.CancelTransaction)
|
||||
group.Post("/veli/gaming-activity", h.GetGamingActivity)
|
||||
|
||||
//mongoDB logs
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user