40 lines
1.0 KiB
Go
40 lines
1.0 KiB
Go
package profileService
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"time"
|
|
|
|
pbVC "gitea.cybertalant.ru/VisionCareerMiniapp/DataManagemet/pb/golang"
|
|
"gitea.cybertalant.ru/VisionCareerMiniapp/MiniappGoService/internal/application/constants"
|
|
"gitea.cybertalant.ru/VisionCareerMiniapp/MiniappGoService/internal/application/types"
|
|
)
|
|
|
|
func (t *service) sendUserData(data *types.User) error {
|
|
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
|
defer cancel()
|
|
|
|
userData := &pbVC.User{
|
|
Id: data.ID,
|
|
TargetRole: *data.TargetRole,
|
|
WorkExperience: *data.WorkExperience,
|
|
WorkFormat: data.WorkFormat.String(),
|
|
SalaryRange: data.SalaryRange.String(),
|
|
}
|
|
|
|
if data.ResumePath != nil {
|
|
userData.ResumePath = *data.ResumePath
|
|
}
|
|
|
|
resp, err := t.supportAPI.UpsertUserData(ctx, &pbVC.UpsertUserDataRequest{
|
|
Data: userData,
|
|
})
|
|
|
|
if err != nil || resp.Status == string(constants.ErrorStatus) {
|
|
return err
|
|
} else if resp.Status == string(constants.ErrorStatus) {
|
|
return errors.New("unknown error")
|
|
}
|
|
return nil
|
|
}
|