package adminagentservice import ( "context" param "git.gocasts.ir/ebhomengo/niki/param/admin/agent" richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error" ) func (s Service) GetAllAgent(ctx context.Context) (param.GetAllAgentResponse, error) { const op = "adminagentservice.GetAllAgent" agentsInfo := make([]param.Agent, 0) agents, err := s.repo.GetAllAgent(ctx) if err != nil { return param.GetAllAgentResponse{}, richerror.New(op).WithErr(err).WithKind(richerror.KindUnexpected) } for _, agent := range agents { agentsInfo = append(agentsInfo, param.Agent{ ID: agent.ID, FirstName: agent.FirstName, LastName: agent.LastName, PhoneNumber: agent.PhoneNumber, }) } return param.GetAllAgentResponse{Agents: agentsInfo}, nil }