From 249081554d15671fa815cb2febc1b63f15f9d735 Mon Sep 17 00:00:00 2001 From: Tiago Yamamoto Date: Fri, 26 Dec 2025 15:48:13 -0300 Subject: [PATCH] feat: add company profile fields Backend: - Created migration 031 for employee_count and founded_year - Updated Company model with EmployeeCount and FoundedYear - Updated core DTO with website, employeeCount, foundedYear, description Frontend: - Added website input field to company form - Added employee count dropdown (1-10, 11-50, etc.) - Added founded year input - Added 'About Company' rich text editor - Updated API payload to send new fields --- backend/internal/core/dto/company.go | 17 +++-- backend/internal/models/company.go | 4 ++ .../031_add_company_profile_fields.sql | 12 ++++ frontend/src/app/post-job/page.tsx | 65 +++++++++++++++++++ 4 files changed, 94 insertions(+), 4 deletions(-) create mode 100644 backend/migrations/031_add_company_profile_fields.sql diff --git a/backend/internal/core/dto/company.go b/backend/internal/core/dto/company.go index e7eae4e..3f48f4a 100644 --- a/backend/internal/core/dto/company.go +++ b/backend/internal/core/dto/company.go @@ -3,15 +3,24 @@ package dto import "time" type CreateCompanyRequest struct { - Name string `json:"name"` - Document string `json:"document"` - Contact string `json:"contact"` - AdminEmail string `json:"admin_email"` + Name string `json:"name"` + CompanyName string `json:"companyName"` // Alternative field name + Document string `json:"document"` + Contact string `json:"contact"` + AdminEmail string `json:"admin_email"` + Email string `json:"email"` // Alternative field name + Password string `json:"password"` + Phone string `json:"phone"` + Website *string `json:"website,omitempty"` + EmployeeCount *string `json:"employeeCount,omitempty"` + FoundedYear *int `json:"foundedYear,omitempty"` + Description *string `json:"description,omitempty"` } type CompanyResponse struct { ID string `json:"id"` Name string `json:"name"` Status string `json:"status"` + Token string `json:"token,omitempty"` // JWT token for auth CreatedAt time.Time `json:"created_at"` } diff --git a/backend/internal/models/company.go b/backend/internal/models/company.go index 55f317f..287297e 100755 --- a/backend/internal/models/company.go +++ b/backend/internal/models/company.go @@ -22,6 +22,10 @@ type Company struct { LogoURL *string `json:"logoUrl,omitempty" db:"logo_url"` Description *string `json:"description,omitempty" db:"description"` + // Profile + EmployeeCount *string `json:"employeeCount,omitempty" db:"employee_count"` // 1-10, 11-50, etc. + FoundedYear *int `json:"foundedYear,omitempty" db:"founded_year"` + // Status Active bool `json:"active" db:"active"` Verified bool `json:"verified" db:"verified"` diff --git a/backend/migrations/031_add_company_profile_fields.sql b/backend/migrations/031_add_company_profile_fields.sql new file mode 100644 index 0000000..c98f62e --- /dev/null +++ b/backend/migrations/031_add_company_profile_fields.sql @@ -0,0 +1,12 @@ +-- Migration: Add employee count and founded year to companies +-- Description: Adds employee_count and founded_year columns for company profile + +-- Add employee_count column (VARCHAR for range like '1-10', '11-50', etc.) +ALTER TABLE companies ADD COLUMN IF NOT EXISTS employee_count VARCHAR(50); + +-- Add founded_year column +ALTER TABLE companies ADD COLUMN IF NOT EXISTS founded_year INT; + +-- Comments +COMMENT ON COLUMN companies.employee_count IS 'Number of employees range: 1-10, 11-50, 51-200, 201-500, 501-1000, 1001+'; +COMMENT ON COLUMN companies.founded_year IS 'Year the company was founded'; diff --git a/frontend/src/app/post-job/page.tsx b/frontend/src/app/post-job/page.tsx index ab588a6..a152c8b 100644 --- a/frontend/src/app/post-job/page.tsx +++ b/frontend/src/app/post-job/page.tsx @@ -69,6 +69,10 @@ export default function PostJobPage() { confirmPassword: "", ddi: "+55", phone: "", + website: "", + employeeCount: "", + foundedYear: "", + description: "", }); const [showPassword, setShowPassword] = useState(false); @@ -141,6 +145,10 @@ export default function PostJobPage() { email: company.email, password: company.password, phone: finalPhone, + website: company.website || null, + employeeCount: company.employeeCount || null, + foundedYear: company.foundedYear ? parseInt(company.foundedYear) : null, + description: company.description || null, }), }); @@ -349,6 +357,63 @@ export default function PostJobPage() {

+ {/* Website */} +
+ +
+ + setCompany({ ...company, website: e.target.value })} + placeholder="https://www.suaempresa.com.br" + className="pl-10" + /> +
+
+ + {/* Employee Count & Founded Year */} +
+
+ + +
+
+ + setCompany({ ...company, foundedYear: e.target.value })} + placeholder="ex: 2010" + min="1800" + max={new Date().getFullYear()} + /> +
+
+ + {/* About Company */} +
+ + setCompany({ ...company, description: val })} + placeholder="Descreva sua empresa, cultura, missão e valores..." + minHeight="120px" + /> +
+