Add Tiers and Game Prize
This commit is contained in:
@@ -40,6 +40,7 @@ type Router struct {
|
||||
chartOfAccountHandler *handler.ChartOfAccountHandler
|
||||
accountHandler *handler.AccountHandler
|
||||
orderIngredientTransactionHandler *handler.OrderIngredientTransactionHandler
|
||||
gamificationHandler *handler.GamificationHandler
|
||||
authMiddleware *middleware.AuthMiddleware
|
||||
}
|
||||
|
||||
@@ -90,7 +91,9 @@ func NewRouter(cfg *config.Config,
|
||||
accountService service.AccountService,
|
||||
accountValidator validator.AccountValidator,
|
||||
orderIngredientTransactionService service.OrderIngredientTransactionService,
|
||||
orderIngredientTransactionValidator validator.OrderIngredientTransactionValidator) *Router {
|
||||
orderIngredientTransactionValidator validator.OrderIngredientTransactionValidator,
|
||||
gamificationService service.GamificationService,
|
||||
gamificationValidator validator.GamificationValidator) *Router {
|
||||
|
||||
return &Router{
|
||||
config: cfg,
|
||||
@@ -120,6 +123,7 @@ func NewRouter(cfg *config.Config,
|
||||
chartOfAccountHandler: handler.NewChartOfAccountHandler(chartOfAccountService, chartOfAccountValidator),
|
||||
accountHandler: handler.NewAccountHandler(accountService, accountValidator),
|
||||
orderIngredientTransactionHandler: handler.NewOrderIngredientTransactionHandler(&orderIngredientTransactionService, orderIngredientTransactionValidator),
|
||||
gamificationHandler: handler.NewGamificationHandler(gamificationService, gamificationValidator),
|
||||
authMiddleware: authMiddleware,
|
||||
}
|
||||
}
|
||||
@@ -426,6 +430,88 @@ func (r *Router) addAppRoutes(rg *gin.Engine) {
|
||||
orderIngredientTransactions.POST("/bulk", r.orderIngredientTransactionHandler.BulkCreateOrderIngredientTransactions)
|
||||
}
|
||||
|
||||
gamification := protected.Group("/marketing")
|
||||
gamification.Use(r.authMiddleware.RequireAdminOrManager())
|
||||
{
|
||||
//customerPoints := gamification.Group("/customer-points")
|
||||
//{
|
||||
// customerPoints.POST("", r.gamificationHandler.CreateCustomerPoints)
|
||||
// customerPoints.GET("", r.gamificationHandler.ListCustomerPoints)
|
||||
// customerPoints.GET("/:id", r.gamificationHandler.GetCustomerPoints)
|
||||
// customerPoints.PUT("/:id", r.gamificationHandler.UpdateCustomerPoints)
|
||||
// customerPoints.DELETE("/:id", r.gamificationHandler.DeleteCustomerPoints)
|
||||
// customerPoints.GET("/customer/:customer_id", r.gamificationHandler.GetCustomerPointsByCustomerID)
|
||||
// customerPoints.POST("/customer/:customer_id/add", r.gamificationHandler.AddCustomerPoints)
|
||||
// customerPoints.POST("/customer/:customer_id/deduct", r.gamificationHandler.DeductCustomerPoints)
|
||||
//}
|
||||
|
||||
// Customer Tokens
|
||||
//customerTokens := gamification.Group("/customer-tokens")
|
||||
//{
|
||||
// customerTokens.POST("", r.gamificationHandler.CreateCustomerTokens)
|
||||
// customerTokens.GET("", r.gamificationHandler.ListCustomerTokens)
|
||||
// customerTokens.GET("/:id", r.gamificationHandler.GetCustomerTokens)
|
||||
// customerTokens.PUT("/:id", r.gamificationHandler.UpdateCustomerTokens)
|
||||
// customerTokens.DELETE("/:id", r.gamificationHandler.DeleteCustomerTokens)
|
||||
// customerTokens.GET("/customer/:customer_id/type/:token_type", r.gamificationHandler.GetCustomerTokensByCustomerIDAndType)
|
||||
// customerTokens.POST("/customer/:customer_id/type/:token_type/add", r.gamificationHandler.AddCustomerTokens)
|
||||
// customerTokens.POST("/customer/:customer_id/type/:token_type/deduct", r.gamificationHandler.DeductCustomerTokens)
|
||||
//}
|
||||
|
||||
// Tiers
|
||||
tiers := gamification.Group("/tiers")
|
||||
{
|
||||
tiers.POST("", r.gamificationHandler.CreateTier)
|
||||
tiers.GET("", r.gamificationHandler.ListTiers)
|
||||
tiers.GET("/:id", r.gamificationHandler.GetTier)
|
||||
tiers.PUT("/:id", r.gamificationHandler.UpdateTier)
|
||||
tiers.DELETE("/:id", r.gamificationHandler.DeleteTier)
|
||||
tiers.GET("/by-points/:points", r.gamificationHandler.GetTierByPoints)
|
||||
}
|
||||
|
||||
// Games
|
||||
games := gamification.Group("/games")
|
||||
{
|
||||
games.POST("", r.gamificationHandler.CreateGame)
|
||||
games.GET("", r.gamificationHandler.ListGames)
|
||||
games.GET("/active", r.gamificationHandler.GetActiveGames)
|
||||
games.GET("/:id", r.gamificationHandler.GetGame)
|
||||
games.PUT("/:id", r.gamificationHandler.UpdateGame)
|
||||
games.DELETE("/:id", r.gamificationHandler.DeleteGame)
|
||||
}
|
||||
|
||||
// Game Prizes
|
||||
gamePrizes := gamification.Group("/game-prizes")
|
||||
{
|
||||
gamePrizes.POST("", r.gamificationHandler.CreateGamePrize)
|
||||
gamePrizes.GET("", r.gamificationHandler.ListGamePrizes)
|
||||
gamePrizes.GET("/:id", r.gamificationHandler.GetGamePrize)
|
||||
gamePrizes.PUT("/:id", r.gamificationHandler.UpdateGamePrize)
|
||||
gamePrizes.DELETE("/:id", r.gamificationHandler.DeleteGamePrize)
|
||||
gamePrizes.GET("/game/:game_id", r.gamificationHandler.GetGamePrizesByGameID)
|
||||
gamePrizes.GET("/game/:game_id/available", r.gamificationHandler.GetAvailablePrizes)
|
||||
}
|
||||
|
||||
//// Game Plays
|
||||
//gamePlays := gamification.Group("/game-plays")
|
||||
//{
|
||||
// gamePlays.POST("", r.gamificationHandler.CreateGamePlay)
|
||||
// gamePlays.GET("", r.gamificationHandler.ListGamePlays)
|
||||
// gamePlays.GET("/:id", r.gamificationHandler.GetGamePlay)
|
||||
// gamePlays.POST("/play", r.gamificationHandler.PlayGame)
|
||||
//}
|
||||
|
||||
// Omset Tracker
|
||||
//omsetTracker := gamification.Group("/omset-tracker")
|
||||
//{
|
||||
// omsetTracker.POST("", r.gamificationHandler.CreateOmsetTracker)
|
||||
// omsetTracker.GET("", r.gamificationHandler.ListOmsetTrackers)
|
||||
// omsetTracker.GET("/:id", r.gamificationHandler.GetOmsetTracker)
|
||||
// omsetTracker.PUT("/:id", r.gamificationHandler.UpdateOmsetTracker)
|
||||
// omsetTracker.DELETE("/:id", r.gamificationHandler.DeleteOmsetTracker)
|
||||
//}
|
||||
}
|
||||
|
||||
outlets := protected.Group("/outlets")
|
||||
outlets.Use(r.authMiddleware.RequireAdminOrManager())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user