self-order+notification #5
@ -1,7 +1,8 @@
|
||||
package config
|
||||
|
||||
type Server struct {
|
||||
Port string `mapstructure:"port"`
|
||||
BaseUrl string `mapstructure:"common-url"`
|
||||
LocalUrl string `mapstructure:"local-url"`
|
||||
Port string `mapstructure:"port"`
|
||||
BaseUrl string `mapstructure:"common-url"`
|
||||
LocalUrl string `mapstructure:"local-url"`
|
||||
SelfOrderUrl string `mapstructure:"self-order-url"`
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
server:
|
||||
base-url:
|
||||
local-url:
|
||||
self-order-url: http://localhost:5174
|
||||
port: 4000
|
||||
|
||||
jwt:
|
||||
|
||||
@ -19,14 +19,14 @@ import (
|
||||
type TableHandler struct {
|
||||
tableService TableService
|
||||
tableValidator *validator.TableValidator
|
||||
baseURL string
|
||||
selfOrderURL string
|
||||
}
|
||||
|
||||
func NewTableHandler(tableService TableService, tableValidator *validator.TableValidator, baseURL string) *TableHandler {
|
||||
func NewTableHandler(tableService TableService, tableValidator *validator.TableValidator, selfOrderURL string) *TableHandler {
|
||||
return &TableHandler{
|
||||
tableService: tableService,
|
||||
tableValidator: tableValidator,
|
||||
baseURL: baseURL,
|
||||
selfOrderURL: selfOrderURL,
|
||||
}
|
||||
}
|
||||
|
||||
@ -312,7 +312,7 @@ func (h *TableHandler) GenerateQRCode(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
selfOrderURL := fmt.Sprintf("%s/api/v1/self-order/table/%s", h.baseURL, token)
|
||||
selfOrderURLResult := fmt.Sprintf("%s/menu?token=%s", h.selfOrderURL, token)
|
||||
|
||||
size := 256
|
||||
if sizeStr := c.Query("size"); sizeStr != "" {
|
||||
@ -321,7 +321,7 @@ func (h *TableHandler) GenerateQRCode(c *gin.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
pngBytes, err := qrcode.GeneratePNG(selfOrderURL, size)
|
||||
pngBytes, err := qrcode.GeneratePNG(selfOrderURLResult, size)
|
||||
if err != nil {
|
||||
logger.FromContext(ctx).WithError(err).Error("TableHandler::GenerateQRCode -> QR generation failed")
|
||||
validationResponseError := contract.NewResponseError(constants.InternalServerErrorCode, constants.TableEntity, "Failed to generate QR code")
|
||||
|
||||
@ -72,7 +72,7 @@ func NewRouter(cfg *config.Config, healthHandler *handler.HealthHandler, authSer
|
||||
paymentMethodHandler: handler.NewPaymentMethodHandler(paymentMethodService, paymentMethodValidator),
|
||||
analyticsHandler: handler.NewAnalyticsHandler(analyticsService, transformer.NewTransformer()),
|
||||
reportHandler: handler.NewReportHandler(reportService, userService),
|
||||
tableHandler: handler.NewTableHandler(tableService, tableValidator, cfg.Server.BaseUrl),
|
||||
tableHandler: handler.NewTableHandler(tableService, tableValidator, cfg.Server.SelfOrderUrl),
|
||||
unitHandler: handler.NewUnitHandler(unitService),
|
||||
ingredientHandler: handler.NewIngredientHandler(ingredientService),
|
||||
productRecipeHandler: handler.NewProductRecipeHandler(productRecipeService),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user