Skip to content

feat(api,web): target_companies table, CRUD, and settings watchlist (#260) - #312

Merged
Taleef7 merged 3 commits into
mainfrom
feat/issue-260-target-companies
Aug 30, 2026
Merged

feat(api,web): target_companies table, CRUD, and settings watchlist (#260)#312
Taleef7 merged 3 commits into
mainfrom
feat/issue-260-target-companies

Conversation

@Taleef7

@Taleef7 Taleef7 commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Closes #260 (Epic #245 — Feed Engine).

Summary of Changes

  1. Database Migration (014_target_companies.sql):

    • Creates target_companies table with UUID primary key, user_id, company, board_type (CHECK 'greenhouse', 'lever', 'ashby'), board_token, enabled (default true), created_at, and updated_at.
    • Adds indexes on user_id and unique index on (user_id, board_type, board_token).
    • Triggers set_updated_at() before update.
  2. Backend Stores & Routing:

    • apps/api/src/data/target-company-store.postgres.ts: PostgreSQL store with strict tenant scoping (user_id = $1), listTargetCompanies, listEnabledTargetCompanies, createTargetCompany, setTargetCompanyEnabled, and deleteTargetCompany.
    • apps/api/src/data/target-company-store.ts: JSON-file store fallback facade with queued mutation concurrency safety and duplicate detection.
    • apps/api/src/routes/target-companies.ts: Endpoints GET /, POST /, PATCH /:id, DELETE /:id behind requireUser. Strict token validation /^[A-Za-z0-9._-]+$/ prevents path traversal and URL injection. Maps PG 23505 and duplicate errors to 409 Conflict.
    • Mounted at /api/target-companies in apps/api/src/app.ts.
  3. Web UI & API Client:

    • apps/web/src/lib/api.ts: Exports fetchTargetCompanies, createTargetCompany, setTargetCompanyEnabled, deleteTargetCompany.
    • apps/web/src/components/target-companies.tsx: Responsive client component with 3-field add form, board type dropdown, token helper text, toggle enable button, and delete action.
    • apps/web/src/app/(app)/settings/page.tsx: Displays Target Companies watchlist section inside SectionCard.
  4. Testing & Verification:

    • 16 route tests in apps/api/src/routes/target-companies.test.ts (CRUD, validation, path traversal guard foo/../bar, 409 conflict, 404, auth).
    • Store tests in apps/api/src/data/target-company-store.test.ts.
    • All 299 API tests pass. Full npm run check (lint + typecheck + Next.js build + API build) clean.

@Taleef7

Taleef7 commented Aug 30, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fe2da73a2f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/api/src/data/target-company-store.ts
Comment thread apps/api/src/data/target-company-store.postgres.ts Outdated
Comment thread apps/api/src/routes/target-companies.ts Outdated
@Taleef7
Taleef7 merged commit 9460add into main Aug 30, 2026
7 checks passed
@Taleef7
Taleef7 deleted the feat/issue-260-target-companies branch August 30, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(api,web): target_companies table + CRUD + settings section to manage the ATS-board watchlist

1 participant