refactor(loyalty): remove the dead customer points and tokens code

First part of PC-601 (docs/prd-point-coin.md §10.7): the code that has
had no way in since balances moved to the wallet.

- The /marketing/customer-points and /marketing/customer-tokens routes
  were commented out; their 16 handler methods, the GamificationService
  methods behind them, and the validators, transformers, mappers and
  contract/model types only they used are gone.
- CustomerPointsProcessor loses its "not implemented" stubs; it keeps the
  customer app's balance, wallet and games endpoints.
- CustomerTokensProcessor and the customer points and tokens repositories,
  wired but no longer called by anything, are gone.

What stays until its preconditions are met: the customer_points and
customer_tokens tables and their entities, which cmd/wallet-migrate still
reads, and the /customer/points, /customer/tokens aliases and the
token_used / tokens_remaining fields, until the apps no longer use them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
efrilm
2026-09-30 14:43:15 +07:00
co-authored by Claude Opus 5.5
parent 550122f29c
commit d1e543a79f
16 changed files with 11 additions and 1731 deletions
@@ -5,131 +5,6 @@ import (
"apskel-pos-be/internal/models"
)
// Customer Points Transformers
func CreateCustomerPointsRequestToModel(req *contract.CreateCustomerPointsRequest) *models.CreateCustomerPointsRequest {
return &models.CreateCustomerPointsRequest{
CustomerID: req.CustomerID,
Balance: req.Balance,
}
}
func UpdateCustomerPointsRequestToModel(req *contract.UpdateCustomerPointsRequest) *models.UpdateCustomerPointsRequest {
return &models.UpdateCustomerPointsRequest{
Balance: req.Balance,
}
}
func ListCustomerPointsRequestToModel(req *contract.ListCustomerPointsRequest) *models.ListCustomerPointsQuery {
return &models.ListCustomerPointsQuery{
Page: req.Page,
Limit: req.Limit,
Search: req.Search,
SortBy: req.SortBy,
SortOrder: req.SortOrder,
}
}
func CustomerPointsModelToResponse(model *models.CustomerPointsResponse) *contract.CustomerPointsResponse {
if model == nil {
return nil
}
var customer *contract.CustomerResponse
if model.Customer != nil {
customer = CustomerModelToResponse(model.Customer)
}
return &contract.CustomerPointsResponse{
ID: model.ID,
CustomerID: model.CustomerID,
Balance: model.Balance,
Customer: customer,
CreatedAt: model.CreatedAt,
UpdatedAt: model.UpdatedAt,
}
}
func PaginatedCustomerPointsResponseToContract(model *models.PaginatedCustomerPointsResponse) *contract.PaginatedCustomerPointsResponse {
if model == nil {
return nil
}
responses := make([]contract.CustomerPointsResponse, len(model.Data))
for i, item := range model.Data {
responses[i] = *CustomerPointsModelToResponse(&item)
}
return &contract.PaginatedCustomerPointsResponse{
Data: responses,
TotalCount: model.TotalCount,
Page: model.Page,
Limit: model.Limit,
TotalPages: model.TotalPages,
}
}
// Customer Tokens Transformers
func CreateCustomerTokensRequestToModel(req *contract.CreateCustomerTokensRequest) *models.CreateCustomerTokensRequest {
return &models.CreateCustomerTokensRequest{
CustomerID: req.CustomerID,
TokenType: req.TokenType,
Balance: req.Balance,
}
}
func UpdateCustomerTokensRequestToModel(req *contract.UpdateCustomerTokensRequest) *models.UpdateCustomerTokensRequest {
return &models.UpdateCustomerTokensRequest{
Balance: req.Balance,
}
}
func ListCustomerTokensRequestToModel(req *contract.ListCustomerTokensRequest) *models.ListCustomerTokensQuery {
return &models.ListCustomerTokensQuery{
Page: req.Page,
Limit: req.Limit,
Search: req.Search,
TokenType: req.TokenType,
SortBy: req.SortBy,
SortOrder: req.SortOrder,
}
}
func CustomerTokensModelToResponse(model *models.CustomerTokensResponse) *contract.CustomerTokensResponse {
if model == nil {
return nil
}
var customer *contract.CustomerResponse
if model.Customer != nil {
customer = CustomerModelToResponse(model.Customer)
}
return &contract.CustomerTokensResponse{
ID: model.ID,
CustomerID: model.CustomerID,
TokenType: model.TokenType,
Balance: model.Balance,
Customer: customer,
CreatedAt: model.CreatedAt,
UpdatedAt: model.UpdatedAt,
}
}
func PaginatedCustomerTokensResponseToContract(model *models.PaginatedResponse[models.CustomerTokensResponse]) *contract.PaginatedCustomerTokensResponse {
responses := make([]contract.CustomerTokensResponse, len(model.Data))
for i, item := range model.Data {
responses[i] = *CustomerTokensModelToResponse(&item)
}
return &contract.PaginatedCustomerTokensResponse{
Data: responses,
TotalCount: int(model.Pagination.Total),
Page: model.Pagination.Page,
Limit: model.Pagination.Limit,
TotalPages: model.Pagination.TotalPages,
}
}
// Tier Transformers
func CreateTierRequestToModel(req *contract.CreateTierRequest) *models.CreateTierRequest {
return &models.CreateTierRequest{