Update template

This commit is contained in:
aditya.siregar
2025-05-06 15:21:12 +07:00
parent 5111fedfa8
commit 4be9c7d73c
7 changed files with 139 additions and 68 deletions
+14
View File
@@ -21,6 +21,10 @@ type Repository interface {
FindByPhone(ctx mycontext.Context, phone string) (*entity.Customer, error)
FindByEmail(ctx mycontext.Context, email string) (*entity.Customer, error)
AddPoints(ctx mycontext.Context, id int64, points int, reference string) error
GetPointsByCustomerID(
ctx mycontext.Context,
customerID int64,
) (*entity.CustomerPoints, error)
FindSequence(ctx mycontext.Context, partnerID int64) (int64, error)
GetAllCustomers(ctx mycontext.Context, req entity.MemberSearch) (entity.MemberList, int, error)
VerifyOTP(ctx mycontext.Context, verificationHash string, otpCode string) (int64, error)
@@ -29,6 +33,7 @@ type Repository interface {
type Service interface {
ResolveCustomer(ctx mycontext.Context, req *entity.CustomerResolutionRequest) (int64, error)
AddPoints(ctx mycontext.Context, customerID int64, points int, reference string) error
GetCustomerPoints(ctx mycontext.Context, customerID int64) (*entity.CustomerPoints, error)
GetCustomer(ctx mycontext.Context, id int64) (*entity.Customer, error)
CustomerCheck(ctx mycontext.Context, req *entity.CustomerResolutionRequest) (*entity.CustomerCheckResponse, error)
GetAllCustomers(ctx mycontext.Context, req *entity.MemberSearch) (*entity.MemberList, int, error)
@@ -188,6 +193,15 @@ func (s *customerSvc) AddPoints(ctx mycontext.Context, customerID int64, points
return nil
}
func (s *customerSvc) GetCustomerPoints(ctx mycontext.Context, customerID int64) (*entity.CustomerPoints, error) {
cp, err := s.repo.GetPointsByCustomerID(ctx, customerID)
if err != nil {
return nil, errors.Wrap(err, "failed to add points to customer")
}
return cp, nil
}
func (s *customerSvc) GetCustomer(ctx mycontext.Context, id int64) (*entity.Customer, error) {
customer, err := s.repo.FindByID(ctx, id)
if err != nil {