From c9747d3596df3d3b2c989453bfd6bcc9ca7e6183 Mon Sep 17 00:00:00 2001 From: Tiago Yamamoto Date: Mon, 15 Dec 2025 10:19:31 -0300 Subject: [PATCH] fix(integration): correct frontend fallback port to 8521 and handle NULL fields in company entity --- backend/internal/core/domain/entity/company.go | 6 +++--- backend/internal/core/usecases/tenant/create_company.go | 2 +- frontend/src/app/page.tsx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/internal/core/domain/entity/company.go b/backend/internal/core/domain/entity/company.go index ab54f4e..8a8413b 100644 --- a/backend/internal/core/domain/entity/company.go +++ b/backend/internal/core/domain/entity/company.go @@ -6,15 +6,15 @@ import "time" type Company struct { ID string `json:"id"` Name string `json:"name"` - Document string `json:"document,omitempty"` // CNPJ, EIN, VAT - Contact string `json:"contact"` + Document *string `json:"document,omitempty"` // CNPJ, EIN, VAT + Contact *string `json:"contact,omitempty"` Status string `json:"status"` // "ACTIVE", "INACTIVE" CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } // NewCompany creates a new Company instance with defaults. -func NewCompany(id, name, document, contact string) *Company { +func NewCompany(id, name string, document, contact *string) *Company { return &Company{ ID: id, Name: name, diff --git a/backend/internal/core/usecases/tenant/create_company.go b/backend/internal/core/usecases/tenant/create_company.go index 505826b..a2149df 100644 --- a/backend/internal/core/usecases/tenant/create_company.go +++ b/backend/internal/core/usecases/tenant/create_company.go @@ -37,7 +37,7 @@ func (uc *CreateCompanyUseCase) Execute(ctx context.Context, input dto.CreateCom // I'll generate a random ID here for simulation if I had a uuid lib. // Since I want to be agnostic and dependency-free, I'll assume the Repo 'Save' returns the fully populated entity including ID. - company := entity.NewCompany("", input.Name, input.Document, input.Contact) + company := entity.NewCompany("", input.Name, &input.Document, &input.Contact) savedCompany, err := uc.companyRepo.Save(ctx, company) if err != nil { diff --git a/frontend/src/app/page.tsx b/frontend/src/app/page.tsx index b92f738..23a5a88 100644 --- a/frontend/src/app/page.tsx +++ b/frontend/src/app/page.tsx @@ -25,7 +25,7 @@ export default function HomePage() { async function fetchFeaturedJobs() { try { // Assuming API proxy is set up or env var is available. using relative path for now as per usual Next.js setup - const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8080'}/jobs?featured=true&limit=6`) + const res = await fetch(`${process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8521'}/jobs?featured=true&limit=6`) if (!res.ok) throw new Error('Failed to fetch jobs') const data = await res.json()