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
This commit is contained in:
parent
cca951ca23
commit
249081554d
4 changed files with 94 additions and 4 deletions
|
|
@ -3,15 +3,24 @@ package dto
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
type CreateCompanyRequest struct {
|
type CreateCompanyRequest struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Document string `json:"document"`
|
CompanyName string `json:"companyName"` // Alternative field name
|
||||||
Contact string `json:"contact"`
|
Document string `json:"document"`
|
||||||
AdminEmail string `json:"admin_email"`
|
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 {
|
type CompanyResponse struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
|
Token string `json:"token,omitempty"` // JWT token for auth
|
||||||
CreatedAt time.Time `json:"created_at"`
|
CreatedAt time.Time `json:"created_at"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,10 @@ type Company struct {
|
||||||
LogoURL *string `json:"logoUrl,omitempty" db:"logo_url"`
|
LogoURL *string `json:"logoUrl,omitempty" db:"logo_url"`
|
||||||
Description *string `json:"description,omitempty" db:"description"`
|
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
|
// Status
|
||||||
Active bool `json:"active" db:"active"`
|
Active bool `json:"active" db:"active"`
|
||||||
Verified bool `json:"verified" db:"verified"`
|
Verified bool `json:"verified" db:"verified"`
|
||||||
|
|
|
||||||
12
backend/migrations/031_add_company_profile_fields.sql
Normal file
12
backend/migrations/031_add_company_profile_fields.sql
Normal file
|
|
@ -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';
|
||||||
|
|
@ -69,6 +69,10 @@ export default function PostJobPage() {
|
||||||
confirmPassword: "",
|
confirmPassword: "",
|
||||||
ddi: "+55",
|
ddi: "+55",
|
||||||
phone: "",
|
phone: "",
|
||||||
|
website: "",
|
||||||
|
employeeCount: "",
|
||||||
|
foundedYear: "",
|
||||||
|
description: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
const [showPassword, setShowPassword] = useState(false);
|
const [showPassword, setShowPassword] = useState(false);
|
||||||
|
|
@ -141,6 +145,10 @@ export default function PostJobPage() {
|
||||||
email: company.email,
|
email: company.email,
|
||||||
password: company.password,
|
password: company.password,
|
||||||
phone: finalPhone,
|
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() {
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* Website */}
|
||||||
|
<div>
|
||||||
|
<Label>Site da Empresa</Label>
|
||||||
|
<div className="relative">
|
||||||
|
<Globe className="absolute left-3 top-3 h-4 w-4 text-muted-foreground" />
|
||||||
|
<Input
|
||||||
|
type="url"
|
||||||
|
value={company.website}
|
||||||
|
onChange={(e) => setCompany({ ...company, website: e.target.value })}
|
||||||
|
placeholder="https://www.suaempresa.com.br"
|
||||||
|
className="pl-10"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Employee Count & Founded Year */}
|
||||||
|
<div className="grid grid-cols-2 gap-4">
|
||||||
|
<div>
|
||||||
|
<Label>Nº de Funcionários</Label>
|
||||||
|
<select
|
||||||
|
value={company.employeeCount}
|
||||||
|
onChange={(e) => setCompany({ ...company, employeeCount: e.target.value })}
|
||||||
|
className="w-full px-3 py-2 border rounded-lg bg-background"
|
||||||
|
>
|
||||||
|
<option value="">Selecione</option>
|
||||||
|
<option value="1-10">1-10</option>
|
||||||
|
<option value="11-50">11-50</option>
|
||||||
|
<option value="51-200">51-200</option>
|
||||||
|
<option value="201-500">201-500</option>
|
||||||
|
<option value="501-1000">501-1000</option>
|
||||||
|
<option value="1001+">1001+</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<Label>Ano de Fundação</Label>
|
||||||
|
<Input
|
||||||
|
type="number"
|
||||||
|
value={company.foundedYear}
|
||||||
|
onChange={(e) => setCompany({ ...company, foundedYear: e.target.value })}
|
||||||
|
placeholder="ex: 2010"
|
||||||
|
min="1800"
|
||||||
|
max={new Date().getFullYear()}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* About Company */}
|
||||||
|
<div>
|
||||||
|
<Label>Sobre a Empresa</Label>
|
||||||
|
<RichTextEditor
|
||||||
|
value={company.description}
|
||||||
|
onChange={(val) => setCompany({ ...company, description: val })}
|
||||||
|
placeholder="Descreva sua empresa, cultura, missão e valores..."
|
||||||
|
minHeight="120px"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<Button onClick={() => setStep(2)} className="w-full">
|
<Button onClick={() => setStep(2)} className="w-full">
|
||||||
Próximo: Dados da Vaga
|
Próximo: Dados da Vaga
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue