Revert "feat(loyalty): EnakPoint & EnakCoin" (#32)

This reverts merge commit 645da30, returning main to f0ff59f.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
efrilm
2026-09-30 15:16:15 +07:00
co-authored by Claude Opus 5.5
parent 645da3048e
commit 4e24f9bbb0
195 changed files with 2179 additions and 20060 deletions
+164 -10
View File
@@ -11,6 +11,26 @@ import (
)
type GamificationService interface {
// Customer Points
CreateCustomerPoints(ctx context.Context, req *contract.CreateCustomerPointsRequest) (*contract.CustomerPointsResponse, error)
GetCustomerPoints(ctx context.Context, id uuid.UUID) (*contract.CustomerPointsResponse, error)
GetCustomerPointsByCustomerID(ctx context.Context, customerID uuid.UUID) (*contract.CustomerPointsResponse, error)
ListCustomerPoints(ctx context.Context, query *contract.ListCustomerPointsRequest) (*contract.PaginatedCustomerPointsResponse, error)
UpdateCustomerPoints(ctx context.Context, id uuid.UUID, req *contract.UpdateCustomerPointsRequest) (*contract.CustomerPointsResponse, error)
DeleteCustomerPoints(ctx context.Context, id uuid.UUID) error
AddCustomerPoints(ctx context.Context, customerID uuid.UUID, req *contract.AddCustomerPointsRequest) (*contract.CustomerPointsResponse, error)
DeductCustomerPoints(ctx context.Context, customerID uuid.UUID, req *contract.DeductCustomerPointsRequest) (*contract.CustomerPointsResponse, error)
// Customer Tokens
CreateCustomerTokens(ctx context.Context, req *contract.CreateCustomerTokensRequest) (*contract.CustomerTokensResponse, error)
GetCustomerTokens(ctx context.Context, id uuid.UUID) (*contract.CustomerTokensResponse, error)
GetCustomerTokensByCustomerIDAndType(ctx context.Context, customerID uuid.UUID, tokenType string) (*contract.CustomerTokensResponse, error)
ListCustomerTokens(ctx context.Context, query *contract.ListCustomerTokensRequest) (*contract.PaginatedCustomerTokensResponse, error)
UpdateCustomerTokens(ctx context.Context, id uuid.UUID, req *contract.UpdateCustomerTokensRequest) (*contract.CustomerTokensResponse, error)
DeleteCustomerTokens(ctx context.Context, id uuid.UUID) error
AddCustomerTokens(ctx context.Context, customerID uuid.UUID, tokenType string, req *contract.AddCustomerTokensRequest) (*contract.CustomerTokensResponse, error)
DeductCustomerTokens(ctx context.Context, customerID uuid.UUID, tokenType string, req *contract.DeductCustomerTokensRequest) (*contract.CustomerTokensResponse, error)
// Tiers
CreateTier(ctx context.Context, req *contract.CreateTierRequest) (*contract.TierResponse, error)
GetTier(ctx context.Context, id uuid.UUID) (*contract.TierResponse, error)
@@ -52,14 +72,18 @@ type GamificationService interface {
}
type GamificationServiceImpl struct {
tierProcessor *processor.TierProcessor
gameProcessor *processor.GameProcessor
gamePrizeProcessor *processor.GamePrizeProcessor
gamePlayProcessor *processor.GamePlayProcessor
omsetTrackerProcessor *processor.OmsetTrackerProcessor
customerPointsProcessor *processor.CustomerPointsProcessor
customerTokensProcessor *processor.CustomerTokensProcessor
tierProcessor *processor.TierProcessor
gameProcessor *processor.GameProcessor
gamePrizeProcessor *processor.GamePrizeProcessor
gamePlayProcessor *processor.GamePlayProcessor
omsetTrackerProcessor *processor.OmsetTrackerProcessor
}
func NewGamificationService(
customerPointsProcessor *processor.CustomerPointsProcessor,
customerTokensProcessor *processor.CustomerTokensProcessor,
tierProcessor *processor.TierProcessor,
gameProcessor *processor.GameProcessor,
gamePrizeProcessor *processor.GamePrizeProcessor,
@@ -67,14 +91,144 @@ func NewGamificationService(
omsetTrackerProcessor *processor.OmsetTrackerProcessor,
) *GamificationServiceImpl {
return &GamificationServiceImpl{
tierProcessor: tierProcessor,
gameProcessor: gameProcessor,
gamePrizeProcessor: gamePrizeProcessor,
gamePlayProcessor: gamePlayProcessor,
omsetTrackerProcessor: omsetTrackerProcessor,
customerPointsProcessor: customerPointsProcessor,
customerTokensProcessor: customerTokensProcessor,
tierProcessor: tierProcessor,
gameProcessor: gameProcessor,
gamePrizeProcessor: gamePrizeProcessor,
gamePlayProcessor: gamePlayProcessor,
omsetTrackerProcessor: omsetTrackerProcessor,
}
}
// Customer Points Service Methods
func (s *GamificationServiceImpl) CreateCustomerPoints(ctx context.Context, req *contract.CreateCustomerPointsRequest) (*contract.CustomerPointsResponse, error) {
modelReq := transformer.CreateCustomerPointsRequestToModel(req)
response, err := s.customerPointsProcessor.CreateCustomerPoints(ctx, modelReq)
if err != nil {
return nil, err
}
return transformer.CustomerPointsModelToResponse(response), nil
}
func (s *GamificationServiceImpl) GetCustomerPoints(ctx context.Context, id uuid.UUID) (*contract.CustomerPointsResponse, error) {
response, err := s.customerPointsProcessor.GetCustomerPoints(ctx, id)
if err != nil {
return nil, err
}
return transformer.CustomerPointsModelToResponse(response), nil
}
func (s *GamificationServiceImpl) GetCustomerPointsByCustomerID(ctx context.Context, customerID uuid.UUID) (*contract.CustomerPointsResponse, error) {
response, err := s.customerPointsProcessor.GetCustomerPointsByCustomerID(ctx, customerID)
if err != nil {
return nil, err
}
return transformer.CustomerPointsModelToResponse(response), nil
}
func (s *GamificationServiceImpl) ListCustomerPoints(ctx context.Context, query *contract.ListCustomerPointsRequest) (*contract.PaginatedCustomerPointsResponse, error) {
modelQuery := transformer.ListCustomerPointsRequestToModel(query)
response, err := s.customerPointsProcessor.ListCustomerPoints(ctx, modelQuery)
if err != nil {
return nil, err
}
return transformer.PaginatedCustomerPointsResponseToContract(response), nil
}
func (s *GamificationServiceImpl) UpdateCustomerPoints(ctx context.Context, id uuid.UUID, req *contract.UpdateCustomerPointsRequest) (*contract.CustomerPointsResponse, error) {
modelReq := transformer.UpdateCustomerPointsRequestToModel(req)
response, err := s.customerPointsProcessor.UpdateCustomerPoints(ctx, id, modelReq)
if err != nil {
return nil, err
}
return transformer.CustomerPointsModelToResponse(response), nil
}
func (s *GamificationServiceImpl) DeleteCustomerPoints(ctx context.Context, id uuid.UUID) error {
return s.customerPointsProcessor.DeleteCustomerPoints(ctx, id)
}
func (s *GamificationServiceImpl) AddCustomerPoints(ctx context.Context, customerID uuid.UUID, req *contract.AddCustomerPointsRequest) (*contract.CustomerPointsResponse, error) {
response, err := s.customerPointsProcessor.AddPoints(ctx, customerID, req.Points)
if err != nil {
return nil, err
}
return transformer.CustomerPointsModelToResponse(response), nil
}
func (s *GamificationServiceImpl) DeductCustomerPoints(ctx context.Context, customerID uuid.UUID, req *contract.DeductCustomerPointsRequest) (*contract.CustomerPointsResponse, error) {
response, err := s.customerPointsProcessor.DeductPoints(ctx, customerID, req.Points)
if err != nil {
return nil, err
}
return transformer.CustomerPointsModelToResponse(response), nil
}
// Customer Tokens Service Methods
func (s *GamificationServiceImpl) CreateCustomerTokens(ctx context.Context, req *contract.CreateCustomerTokensRequest) (*contract.CustomerTokensResponse, error) {
modelReq := transformer.CreateCustomerTokensRequestToModel(req)
response, err := s.customerTokensProcessor.CreateCustomerTokens(ctx, modelReq)
if err != nil {
return nil, err
}
return transformer.CustomerTokensModelToResponse(response), nil
}
func (s *GamificationServiceImpl) GetCustomerTokens(ctx context.Context, id uuid.UUID) (*contract.CustomerTokensResponse, error) {
response, err := s.customerTokensProcessor.GetCustomerTokens(ctx, id)
if err != nil {
return nil, err
}
return transformer.CustomerTokensModelToResponse(response), nil
}
func (s *GamificationServiceImpl) GetCustomerTokensByCustomerIDAndType(ctx context.Context, customerID uuid.UUID, tokenType string) (*contract.CustomerTokensResponse, error) {
response, err := s.customerTokensProcessor.GetCustomerTokensByCustomerIDAndType(ctx, customerID, tokenType)
if err != nil {
return nil, err
}
return transformer.CustomerTokensModelToResponse(response), nil
}
func (s *GamificationServiceImpl) ListCustomerTokens(ctx context.Context, query *contract.ListCustomerTokensRequest) (*contract.PaginatedCustomerTokensResponse, error) {
modelQuery := transformer.ListCustomerTokensRequestToModel(query)
response, err := s.customerTokensProcessor.ListCustomerTokens(ctx, modelQuery)
if err != nil {
return nil, err
}
return transformer.PaginatedCustomerTokensResponseToContract(response), nil
}
func (s *GamificationServiceImpl) UpdateCustomerTokens(ctx context.Context, id uuid.UUID, req *contract.UpdateCustomerTokensRequest) (*contract.CustomerTokensResponse, error) {
modelReq := transformer.UpdateCustomerTokensRequestToModel(req)
response, err := s.customerTokensProcessor.UpdateCustomerTokens(ctx, id, modelReq)
if err != nil {
return nil, err
}
return transformer.CustomerTokensModelToResponse(response), nil
}
func (s *GamificationServiceImpl) DeleteCustomerTokens(ctx context.Context, id uuid.UUID) error {
return s.customerTokensProcessor.DeleteCustomerTokens(ctx, id)
}
func (s *GamificationServiceImpl) AddCustomerTokens(ctx context.Context, customerID uuid.UUID, tokenType string, req *contract.AddCustomerTokensRequest) (*contract.CustomerTokensResponse, error) {
response, err := s.customerTokensProcessor.AddTokens(ctx, customerID, tokenType, req.Tokens)
if err != nil {
return nil, err
}
return transformer.CustomerTokensModelToResponse(response), nil
}
func (s *GamificationServiceImpl) DeductCustomerTokens(ctx context.Context, customerID uuid.UUID, tokenType string, req *contract.DeductCustomerTokensRequest) (*contract.CustomerTokensResponse, error) {
response, err := s.customerTokensProcessor.DeductTokens(ctx, customerID, tokenType, req.Tokens)
if err != nil {
return nil, err
}
return transformer.CustomerTokensModelToResponse(response), nil
}
// Tier Service Methods
func (s *GamificationServiceImpl) CreateTier(ctx context.Context, req *contract.CreateTierRequest) (*contract.TierResponse, error) {
modelReq := transformer.CreateTierRequestToModel(req)