- Add PaginationInfo struct to candidates DTO - Update ListCandidates service to support page/perPage params - Update handler to parse pagination query params - Update frontend candidates page with pagination controls
51 lines
1.9 KiB
Go
51 lines
1.9 KiB
Go
package dto
|
|
|
|
import "time"
|
|
|
|
// CandidateStats represents aggregate stats for candidates.
|
|
type CandidateStats struct {
|
|
TotalCandidates int `json:"totalCandidates"`
|
|
NewCandidates int `json:"newCandidates"`
|
|
ActiveApplications int `json:"activeApplications"`
|
|
HiringRate float64 `json:"hiringRate"`
|
|
}
|
|
|
|
// CandidateApplication represents an application entry for the candidate profile.
|
|
type CandidateApplication struct {
|
|
ID string `json:"id"`
|
|
JobTitle string `json:"jobTitle"`
|
|
Company string `json:"company"`
|
|
Status string `json:"status"`
|
|
AppliedAt time.Time `json:"appliedAt"`
|
|
}
|
|
|
|
// Candidate represents candidate profile data for backoffice.
|
|
type Candidate struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
Email *string `json:"email,omitempty"`
|
|
Phone *string `json:"phone,omitempty"`
|
|
Location *string `json:"location,omitempty"`
|
|
Title *string `json:"title,omitempty"`
|
|
Experience *string `json:"experience,omitempty"`
|
|
AvatarURL *string `json:"avatarUrl,omitempty"`
|
|
Bio *string `json:"bio,omitempty"`
|
|
Skills []string `json:"skills"`
|
|
Applications []CandidateApplication `json:"applications"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
}
|
|
|
|
// PaginationInfo contains pagination metadata.
|
|
type PaginationInfo struct {
|
|
Page int `json:"page"`
|
|
PerPage int `json:"perPage"`
|
|
TotalPages int `json:"totalPages"`
|
|
TotalItems int `json:"totalItems"`
|
|
}
|
|
|
|
// CandidateListResponse wraps candidate listing with summary statistics and pagination.
|
|
type CandidateListResponse struct {
|
|
Stats CandidateStats `json:"stats"`
|
|
Candidates []Candidate `json:"candidates"`
|
|
Pagination PaginationInfo `json:"pagination"`
|
|
}
|