fix(integration): correct frontend fallback port to 8521 and handle NULL fields in company entity

This commit is contained in:
Tiago Yamamoto 2025-12-15 10:19:31 -03:00
parent 0ef2ced860
commit c9747d3596
3 changed files with 5 additions and 5 deletions

View file

@ -6,15 +6,15 @@ import "time"
type Company struct { type Company struct {
ID string `json:"id"` ID string `json:"id"`
Name string `json:"name"` Name string `json:"name"`
Document string `json:"document,omitempty"` // CNPJ, EIN, VAT Document *string `json:"document,omitempty"` // CNPJ, EIN, VAT
Contact string `json:"contact"` Contact *string `json:"contact,omitempty"`
Status string `json:"status"` // "ACTIVE", "INACTIVE" Status string `json:"status"` // "ACTIVE", "INACTIVE"
CreatedAt time.Time `json:"created_at"` CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"` UpdatedAt time.Time `json:"updated_at"`
} }
// NewCompany creates a new Company instance with defaults. // 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{ return &Company{
ID: id, ID: id,
Name: name, Name: name,

View file

@ -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. // 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. // 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) savedCompany, err := uc.companyRepo.Save(ctx, company)
if err != nil { if err != nil {

View file

@ -25,7 +25,7 @@ export default function HomePage() {
async function fetchFeaturedJobs() { async function fetchFeaturedJobs() {
try { try {
// Assuming API proxy is set up or env var is available. using relative path for now as per usual Next.js setup // 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') if (!res.ok) throw new Error('Failed to fetch jobs')
const data = await res.json() const data = await res.json()