- 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.
85 lines
3.5 KiB
Go
85 lines
3.5 KiB
Go
package domain
|
|
|
|
import (
|
|
"time"
|
|
|
|
dbgen "github.com/SamuelTariku/FortuneBet-Backend/gen/db"
|
|
)
|
|
|
|
|
|
type ResultLog struct {
|
|
ID int64 `json:"id"`
|
|
StatusNotFinishedCount int `json:"status_not_finished_count"`
|
|
StatusNotFinishedBets int `json:"status_not_finished_bets"`
|
|
StatusToBeFixedCount int `json:"status_to_be_fixed_count"`
|
|
StatusToBeFixedBets int `json:"status_to_be_fixed_bets"`
|
|
StatusPostponedCount int `json:"status_postponed_count"`
|
|
StatusPostponedBets int `json:"status_postponed_bets"`
|
|
StatusEndedCount int `json:"status_ended_count"`
|
|
StatusEndedBets int `json:"status_ended_bets"`
|
|
StatusRemovedCount int `json:"status_removed_count"`
|
|
StatusRemovedBets int `json:"status_removed_bets"`
|
|
RemovedCount int `json:"removed"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type CreateResultLog struct {
|
|
StatusNotFinishedCount int `json:"status_not_finished_count"`
|
|
StatusNotFinishedBets int `json:"status_not_finished_bets"`
|
|
StatusToBeFixedCount int `json:"status_to_be_fixed_count"`
|
|
StatusToBeFixedBets int `json:"status_to_be_fixed_bets"`
|
|
StatusPostponedCount int `json:"status_postponed_count"`
|
|
StatusPostponedBets int `json:"status_postponed_bets"`
|
|
StatusEndedCount int `json:"status_ended_count"`
|
|
StatusEndedBets int `json:"status_ended_bets"`
|
|
StatusRemovedCount int `json:"status_removed_count"`
|
|
StatusRemovedBets int `json:"status_removed_bets"`
|
|
RemovedCount int `json:"removed"`
|
|
}
|
|
|
|
type ResultLogFilter struct {
|
|
CreatedBefore ValidTime
|
|
CreatedAfter ValidTime
|
|
}
|
|
type ResultStatusBets struct {
|
|
StatusNotFinished []int64 `json:"status_not_finished"`
|
|
StatusToBeFixed []int64 `json:"status_to_be_fixed"`
|
|
StatusPostponed []int64 `json:"status_postponed"`
|
|
StatusEnded []int64 `json:"status_ended"`
|
|
StatusRemoved []int64 `json:"status_removed"`
|
|
}
|
|
|
|
func ConvertDBResultLog(result dbgen.ResultLog) ResultLog {
|
|
return ResultLog{
|
|
ID: result.ID,
|
|
StatusNotFinishedCount: int(result.StatusNotFinishedCount),
|
|
StatusNotFinishedBets: int(result.StatusNotFinishedBets),
|
|
StatusToBeFixedCount: int(result.StatusToBeFixedCount),
|
|
StatusToBeFixedBets: int(result.StatusToBeFixedBets),
|
|
StatusPostponedCount: int(result.StatusPostponedCount),
|
|
StatusPostponedBets: int(result.StatusPostponedBets),
|
|
StatusEndedCount: int(result.StatusEndedCount),
|
|
StatusEndedBets: int(result.StatusEndedBets),
|
|
StatusRemovedCount: int(result.StatusRemovedCount),
|
|
StatusRemovedBets: int(result.StatusRemovedBets),
|
|
RemovedCount: int(result.RemovedCount),
|
|
CreatedAt: result.CreatedAt.Time,
|
|
}
|
|
}
|
|
|
|
func ConvertCreateResultLog(result CreateResultLog) dbgen.CreateResultLogParams {
|
|
return dbgen.CreateResultLogParams{
|
|
StatusNotFinishedCount: int32(result.StatusNotFinishedCount),
|
|
StatusNotFinishedBets: int32(result.StatusNotFinishedBets),
|
|
StatusToBeFixedCount: int32(result.StatusToBeFixedCount),
|
|
StatusToBeFixedBets: int32(result.StatusToBeFixedBets),
|
|
StatusPostponedCount: int32(result.StatusPostponedCount),
|
|
StatusPostponedBets: int32(result.StatusPostponedBets),
|
|
StatusEndedCount: int32(result.StatusEndedCount),
|
|
StatusEndedBets: int32(result.StatusEndedBets),
|
|
StatusRemovedCount: int32(result.StatusRemovedCount),
|
|
StatusRemovedBets: int32(result.StatusRemovedBets),
|
|
RemovedCount: int32(result.RemovedCount),
|
|
}
|
|
}
|