You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
664 B
Go

package service
import (
"context"
"github.com/fonchain_enterprise/fonchain-approval/api/approval"
"github.com/fonchain_enterprise/fonchain-approval/pkg/model"
)
func (a *ApprovalProvider) GetName(ctx context.Context, in *approval.GetNameRequest) (*approval.GetNameResponse, error) {
settings := make([]*model.FinancialFormSetting, 0)
err := model.DB.Model(&model.FinancialFormSetting{}).Where("setting_type = ?", in.SettingType).Find(&settings).Error
if err != nil {
return nil, err
}
response := new(approval.GetNameResponse)
for i := 0; i < len(settings); i++ {
response.Name = append(response.Name, settings[i].Name)
}
return response, nil
}