diff --git a/internal/tender/form.go b/internal/tender/form.go index 256148d..d1ae145 100644 --- a/internal/tender/form.go +++ b/internal/tender/form.go @@ -70,6 +70,11 @@ type OrganizationResponse struct { // ToTenderResponse converts a Tender entity to TenderResponse func (t *Tender) ToResponse() *TenderResponse { + + org := &OrganizationResponse{} + if t.BuyerOrganization != nil { + org.Name = t.BuyerOrganization.Name + } response := &TenderResponse{ ID: t.ID.Hex(), NoticePublicationID: t.NoticePublicationID, @@ -87,7 +92,7 @@ func (t *Tender) ToResponse() *TenderResponse { ApplicationDeadline: t.ApplicationDeadline, CountryCode: t.CountryCode, SubmissionURL: t.SubmissionURL, - BuyerOrganization: &OrganizationResponse{Name: t.BuyerOrganization.Name}, + BuyerOrganization: org, Status: t.Status, TenderID: t.TenderID, }