forked from ebhomengo/niki
				
			
		
			
				
	
	
		
			31 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Go
		
	
	
	
			
		
		
	
	
			31 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Go
		
	
	
	
| package adminbenefactorservice
 | |
| 
 | |
| import (
 | |
| 	"context"
 | |
| 
 | |
| 	param "git.gocasts.ir/ebhomengo/niki/param/admin/benefactor"
 | |
| 	richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
 | |
| )
 | |
| 
 | |
| func (s Service) GetByID(ctx context.Context, req param.GetBenefactorByIDRequest) (param.GetBenefactorByIDResponse, error) {
 | |
| 	const op = "adminbenefactorservice.GetByID"
 | |
| 
 | |
| 	bnf, gErr := s.repo.GetByID(ctx, req.BenefactorID)
 | |
| 	if gErr != nil {
 | |
| 		return param.GetBenefactorByIDResponse{}, richerror.New(op).WithErr(gErr)
 | |
| 	}
 | |
| 
 | |
| 	return param.GetBenefactorByIDResponse{Benefactor: bnf}, nil
 | |
| }
 | |
| 
 | |
| func (s Service) BenefactorExistByID(ctx context.Context, req param.BenefactorExistByIDRequest) (param.BenefactorExistByIDResponse, error) {
 | |
| 	const op = "adminbenefactorservice.BenefactorExistByID"
 | |
| 
 | |
| 	isExisted, err := s.repo.IsExistBenefactorByID(ctx, req.ID)
 | |
| 	if err != nil {
 | |
| 		return param.BenefactorExistByIDResponse{}, richerror.New(op).WithErr(err).WithKind(richerror.KindUnexpected)
 | |
| 	}
 | |
| 
 | |
| 	return param.BenefactorExistByIDResponse{Existed: isExisted}, nil
 | |
| }
 |