refactor(vouchers): move voucher routes out of /enakgame

Vouchers are what EnakPoint is redeemed for, wherever it came from, so they are
not part of EnakGame. Their only link to it is the budget attribution, which
does not change.

- Admin: /marketing/enakgame/vouchers... -> /marketing/vouchers...
- Customer: /customer/enakgame/vouchers -> /customer/vouchers,
  /customer/enakgame/vouchers/:id/redeem -> /customer/vouchers/:id/redeem,
  /customer/enakgame/redemptions -> /customer/vouchers/redemptions

Roles, handlers and logic stay the same. No client calls these endpoints yet.
RFC §7.4 and §11 updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
efrilm
2026-10-08 11:09:57 +07:00
co-authored by Claude Opus 5.5
parent 18e87398bb
commit 1bb071aec6
11 changed files with 56 additions and 1933 deletions
+7 -7
View File
@@ -285,7 +285,7 @@ func (h *EnakGameAdminHandler) EconomyAnalytics(c *gin.Context) {
util.HandleResponse(c.Writer, c.Request, h.service.EconomyAnalytics(ctx, appcontext.FromGinContext(ctx), q), method)
}
// CreateVoucher is POST /marketing/enakgame/vouchers.
// CreateVoucher is POST /marketing/vouchers.
func (h *EnakGameAdminHandler) CreateVoucher(c *gin.Context) {
const method = "EnakGameAdminHandler::CreateVoucher"
body, ok := rawBody(c, method)
@@ -296,7 +296,7 @@ func (h *EnakGameAdminHandler) CreateVoucher(c *gin.Context) {
util.HandleResponse(c.Writer, c.Request, h.service.CreateVoucher(ctx, appcontext.FromGinContext(ctx), body), method)
}
// ListVouchers is GET /marketing/enakgame/vouchers?status=&search=&page=&limit=.
// ListVouchers is GET /marketing/vouchers?status=&search=&page=&limit=.
func (h *EnakGameAdminHandler) ListVouchers(c *gin.Context) {
const method = "EnakGameAdminHandler::ListVouchers"
var q models.VoucherListQuery
@@ -307,7 +307,7 @@ func (h *EnakGameAdminHandler) ListVouchers(c *gin.Context) {
util.HandleResponse(c.Writer, c.Request, h.service.ListVouchers(ctx, appcontext.FromGinContext(ctx), q), method)
}
// GetVoucher is GET /marketing/enakgame/vouchers/:id.
// GetVoucher is GET /marketing/vouchers/:id.
func (h *EnakGameAdminHandler) GetVoucher(c *gin.Context) {
const method = "EnakGameAdminHandler::GetVoucher"
id, ok := pathID(c, "id", method)
@@ -318,7 +318,7 @@ func (h *EnakGameAdminHandler) GetVoucher(c *gin.Context) {
util.HandleResponse(c.Writer, c.Request, h.service.GetVoucher(ctx, appcontext.FromGinContext(ctx), id), method)
}
// UpdateVoucher is PUT /marketing/enakgame/vouchers/:id.
// UpdateVoucher is PUT /marketing/vouchers/:id.
func (h *EnakGameAdminHandler) UpdateVoucher(c *gin.Context) {
const method = "EnakGameAdminHandler::UpdateVoucher"
id, ok := pathID(c, "id", method)
@@ -333,7 +333,7 @@ func (h *EnakGameAdminHandler) UpdateVoucher(c *gin.Context) {
util.HandleResponse(c.Writer, c.Request, h.service.UpdateVoucher(ctx, appcontext.FromGinContext(ctx), id, body), method)
}
// SetVoucherStatus is PUT /marketing/enakgame/vouchers/:id/status.
// SetVoucherStatus is PUT /marketing/vouchers/:id/status.
func (h *EnakGameAdminHandler) SetVoucherStatus(c *gin.Context) {
const method = "EnakGameAdminHandler::SetVoucherStatus"
id, ok := pathID(c, "id", method)
@@ -348,7 +348,7 @@ func (h *EnakGameAdminHandler) SetVoucherStatus(c *gin.Context) {
util.HandleResponse(c.Writer, c.Request, h.service.SetVoucherStatus(ctx, appcontext.FromGinContext(ctx), id, body), method)
}
// ImportVoucherCodes is POST /marketing/enakgame/vouchers/:id/codes, with the CSV as
// ImportVoucherCodes is POST /marketing/vouchers/:id/codes, with the CSV as
// a multipart file named "file" or as the request body.
func (h *EnakGameAdminHandler) ImportVoucherCodes(c *gin.Context) {
const method = "EnakGameAdminHandler::ImportVoucherCodes"
@@ -379,7 +379,7 @@ func (h *EnakGameAdminHandler) ImportVoucherCodes(c *gin.Context) {
util.HandleResponse(c.Writer, c.Request, h.service.ImportVoucherCodes(ctx, appcontext.FromGinContext(ctx), id, data), method)
}
// ListVoucherCodes is GET /marketing/enakgame/vouchers/:id/codes?status=&page=&limit=.
// ListVoucherCodes is GET /marketing/vouchers/:id/codes?status=&page=&limit=.
func (h *EnakGameAdminHandler) ListVoucherCodes(c *gin.Context) {
const method = "EnakGameAdminHandler::ListVoucherCodes"
id, ok := pathID(c, "id", method)