28 lines
695 B
Go
28 lines
695 B
Go
package profileService
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"time"
|
|
|
|
pbVC "gitea.cybertalant.ru/VisionCareerMiniapp/DataManagemet/pb/golang"
|
|
"gitea.cybertalant.ru/VisionCareerMiniapp/MiniappGoService/internal/application/constants"
|
|
)
|
|
|
|
func (t *service) GetVacancies(id int64) ([]string, error) {
|
|
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
|
defer cancel()
|
|
|
|
resp, err := t.supportAPI.GetUserVacancies(ctx, &pbVC.GetUserVacanciesRequest{
|
|
UserID: id,
|
|
})
|
|
|
|
if err != nil || resp.Status == string(constants.ErrorStatus) {
|
|
return nil, err
|
|
} else if resp.Status == string(constants.ErrorStatus) {
|
|
return nil, errors.New("unknown error")
|
|
}
|
|
return resp.Items, nil
|
|
|
|
}
|