Skip to content

GET /v1/profiles/employers/{slug} queries core.employers, which does not exist #618

Closed

Description

@thinkclay

What happens

GET /v1/profiles/employers/unicorn
{"error":"Internal Server Error","message":"Could not find the table 'core.employers' in the schema cache"}

Verified against a live local stack. The route has never returned a response.

Why it cannot be a one-line fix

There is no employers table in any schema:

select table_schema||'.'||table_name
from information_schema.tables where table_name ilike '%employer%';
-- (0 rows)

select count(*) from information_schema.columns
where table_schema='core' and column_name='employer_id';
-- 0

The handler also counts jobs with .eq("employer_id", employer.id) — a column that exists nowhere in core. The whole route was written against a schema that does not exist, not against one that drifted.

employer in this product is an organization: core.organizations carries owner_user_id, and core.jobs.organization_id is the real FK. GET /v1/profiles/organizations/{slug} already does what this route appears to want, and was repaired in #617 (its select had the same class of problem — five nonexistent columns).

No consumer

client.profiles.getEmployer(slug) is called once, from inside packages/scf-core/utils/profiles-sdk-hooks.ts. The hook it backs — useEmployerProfile — is imported by nothing outside that file (excluding dist/, tests and barrel re-exports).

The decision this needs

Not "make it work" — which behaviour is wanted:

  1. Delete the route, the SDK method and the hook. GET /v1/profiles/organizations/{slug} already covers it and now works. This is the recommendation: there is no product behind the endpoint.
  2. Make it an alias of the organizations route, if employers/{slug} is a URL someone external depends on.

Either way KNOWN_GAPS and the SDK surface should end up consistent with the choice.

Acceptance

  • GET /v1/profiles/employers/{slug} either returns 200 with a real body or is gone from the API, the SDK and the hooks
  • No route in profiles.ts references core.employers or employer_id
  • If deleted: useEmployerProfile, profiles.getEmployer and the EmployerProfile type go with it
  • The profiles.test.ts cases for /v1/profiles/employers/:slug are updated or removed to match

Found while working the /v1/organizations cluster of #447.

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-ready

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions