Fix jobs query joins and scan order
This commit is contained in:
parent
c0258e57b7
commit
d36331140e
1 changed files with 4 additions and 4 deletions
|
|
@ -71,9 +71,9 @@ func (s *JobService) GetJobs(filter dto.JobFilterQuery) ([]models.JobWithCompany
|
|||
c.name as company_name, c.logo_url as company_logo_url,
|
||||
r.name as region_name, ci.name as city_name
|
||||
FROM jobs j
|
||||
LEFT JOIN companies c ON j.company_id = c.id
|
||||
LEFT JOIN regions r ON j.region_id = r.id
|
||||
LEFT JOIN cities ci ON j.city_id = ci.id
|
||||
LEFT JOIN companies c ON j.company_id::text = c.id::text
|
||||
LEFT JOIN regions r ON j.region_id::text = r.id::text
|
||||
LEFT JOIN cities ci ON j.city_id::text = ci.id::text
|
||||
WHERE 1=1`
|
||||
countQuery := `SELECT COUNT(*) FROM jobs j WHERE 1=1`
|
||||
|
||||
|
|
@ -156,7 +156,7 @@ func (s *JobService) GetJobs(filter dto.JobFilterQuery) ([]models.JobWithCompany
|
|||
var j models.JobWithCompany
|
||||
if err := rows.Scan(
|
||||
&j.ID, &j.CompanyID, &j.Title, &j.Description, &j.SalaryMin, &j.SalaryMax, &j.SalaryType,
|
||||
&j.EmploymentType, &j.Location, &j.Status, &j.IsFeatured, &j.CreatedAt, &j.UpdatedAt,
|
||||
&j.EmploymentType, &j.WorkMode, &j.Location, &j.Status, &j.IsFeatured, &j.CreatedAt, &j.UpdatedAt,
|
||||
&j.CompanyName, &j.CompanyLogoURL, &j.RegionName, &j.CityName,
|
||||
); err != nil {
|
||||
return nil, 0, err
|
||||
|
|
|
|||
Loading…
Reference in a new issue