update person models
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func GetPerson(id uuid.UUID, header http.Header) (*model.PersonalInformation, error) {
|
||||
func GetPerson(id uuid.UUID, header http.Header) (*model.PersonalInformationApi, error) {
|
||||
data, err, _ := api.GetRequest(
|
||||
config.Env.MSHosts.PersonsHost+"/persons/"+id.String(),
|
||||
header)
|
||||
@@ -19,7 +19,7 @@ func GetPerson(id uuid.UUID, header http.Header) (*model.PersonalInformation, er
|
||||
return nil, errors.New("error Request to Personal Information Service")
|
||||
}
|
||||
|
||||
pi := new(model.PersonalInformation)
|
||||
pi := new(model.PersonalInformationApi)
|
||||
|
||||
err = json.Unmarshal(data, &pi)
|
||||
|
||||
@@ -30,7 +30,7 @@ func GetPerson(id uuid.UUID, header http.Header) (*model.PersonalInformation, er
|
||||
return pi, nil
|
||||
}
|
||||
|
||||
func CreatePerson(person model.PersonalInformationCreate, header http.Header) (*model.PersonalInformation, error) {
|
||||
func CreatePerson(person model.PersonalInformationApi, header http.Header) (*model.PersonalInformationApi, error) {
|
||||
data, err, _ := api.PostRequest(
|
||||
config.Env.MSHosts.PersonsHost+"/persons/",
|
||||
person,
|
||||
@@ -40,7 +40,7 @@ func CreatePerson(person model.PersonalInformationCreate, header http.Header) (*
|
||||
return nil, errors.New("error Request to Personal Information Service")
|
||||
}
|
||||
|
||||
pi := new(model.PersonalInformation)
|
||||
pi := new(model.PersonalInformationApi)
|
||||
|
||||
err = json.Unmarshal(data, &pi)
|
||||
|
||||
@@ -51,9 +51,9 @@ func CreatePerson(person model.PersonalInformationCreate, header http.Header) (*
|
||||
return pi, nil
|
||||
}
|
||||
|
||||
func GetPersons(ids []uuid.UUID, header http.Header) (map[uuid.UUID]model.PersonalInformation, error) {
|
||||
var persons []model.PersonalInformation
|
||||
personsMap := make(map[uuid.UUID]model.PersonalInformation)
|
||||
func GetPersons(ids []uuid.UUID, header http.Header) (map[uuid.UUID]*model.PersonalInformationApi, error) {
|
||||
var persons []model.PersonalInformationApi
|
||||
personsMap := make(map[uuid.UUID]*model.PersonalInformationApi)
|
||||
|
||||
data, err, req := api.PostRequest(
|
||||
config.Env.MSHosts.PersonsHost+"/persons/batch/",
|
||||
@@ -73,7 +73,7 @@ func GetPersons(ids []uuid.UUID, header http.Header) (map[uuid.UUID]model.Person
|
||||
}
|
||||
|
||||
for _, person := range persons {
|
||||
personsMap[person.ID] = person
|
||||
personsMap[person.ID] = &person
|
||||
}
|
||||
|
||||
return personsMap, nil
|
||||
|
||||
Reference in New Issue
Block a user