fix(integration): correct frontend fallback port to 8521 and handle NULL fields in company entity
This commit is contained in:
parent
0ef2ced860
commit
c9747d3596
3 changed files with 5 additions and 5 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue