From 48d7206356eef8545340fa04f2ac0833d2dbd117 Mon Sep 17 00:00:00 2001 From: kandrusyak Date: Mon, 25 Sep 2023 22:53:26 +0300 Subject: [PATCH] logs fix --- handler/event.go | 2 +- model/event.go | 20 ++++++++++---------- services/personal-information.go | 6 +++--- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/handler/event.go b/handler/event.go index 34f41ec..45e75ce 100644 --- a/handler/event.go +++ b/handler/event.go @@ -73,7 +73,7 @@ func (h *Handler) CreateEvent(c echo.Context) (err error) { newEvent.MedicId = event.MedicId newEvent.AuthorId = authorId newEvent.PersonId = person.ID - newEvent.Person = person + newEvent.Person = *person tx := h.DB.Create(&newEvent) diff --git a/model/event.go b/model/event.go index cfb31ec..4022f59 100644 --- a/model/event.go +++ b/model/event.go @@ -9,16 +9,16 @@ import ( // swagger:model Event type Event struct { gorm.Model `json:"meta"` - ID uuid.UUID `json:"id" gorm:"type:uuid;default:gen_random_uuid();primarykey"` - Start time.Time `json:"start"` - End time.Time `json:"end"` - Author User `json:"author" gorm:"-"` - AuthorId uuid.UUID `json:"-"` - Medic User `json:"medic" gorm:"-"` - MedicId uuid.UUID `json:"-"` - Person *PersonalInformationApi `json:"person" gorm:"-"` - PersonId uuid.UUID `json:"-"` - OrgId uuid.UUID `json:"-"` + ID uuid.UUID `json:"id" gorm:"type:uuid;default:gen_random_uuid();primarykey"` + Start time.Time `json:"start"` + End time.Time `json:"end"` + Author User `json:"author" gorm:"-"` + AuthorId uuid.UUID `json:"-"` + Medic User `json:"medic" gorm:"-"` + MedicId uuid.UUID `json:"-"` + Person PersonalInformationApi `json:"person" gorm:"-"` + PersonId uuid.UUID `json:"-"` + OrgId uuid.UUID `json:"-"` } // swagger:model CreateEvent diff --git a/services/personal-information.go b/services/personal-information.go index c3eeee9..a11ed48 100644 --- a/services/personal-information.go +++ b/services/personal-information.go @@ -53,9 +53,9 @@ func CreatePerson(person model.PersonalInformationApi, header http.Header, c ech return pi, nil } -func GetPersons(ids []uuid.UUID, header http.Header, c echo.Context) (map[uuid.UUID]*model.PersonalInformationApi, error) { +func GetPersons(ids []uuid.UUID, header http.Header, c echo.Context) (map[uuid.UUID]model.PersonalInformationApi, error) { var persons []model.PersonalInformationApi - personsMap := make(map[uuid.UUID]*model.PersonalInformationApi) + personsMap := make(map[uuid.UUID]model.PersonalInformationApi) data, err, req := api.PostRequest( config.Env.MSHosts.PersonsHost+"/persons/batch/", @@ -75,7 +75,7 @@ func GetPersons(ids []uuid.UUID, header http.Header, c echo.Context) (map[uuid.U } for _, person := range persons { - personsMap[person.ID] = &person + personsMap[person.ID] = person } return personsMap, nil