feat(14-05): harden companies-list route with requireAuth
- companies-list now feeds the manual-search fallback for authenticated
UI (Needs Review tab), closes previously-unauthenticated gap
- response shape unchanged: [{ id, company_name }]
This commit is contained in:
parent
e9d5846cc8
commit
564be52b97
1 changed files with 4 additions and 0 deletions
|
|
@ -1,7 +1,11 @@
|
||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
|
import { requireAuth } from '@/lib/auth-utils';
|
||||||
import { postgresClient } from '@/lib/services/postgres-client';
|
import { postgresClient } from '@/lib/services/postgres-client';
|
||||||
|
|
||||||
export async function GET() {
|
export async function GET() {
|
||||||
|
const { error } = await requireAuth();
|
||||||
|
if (error) return error;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await postgresClient.query(
|
const result = await postgresClient.query(
|
||||||
`SELECT id, company_name FROM companies WHERE is_active = true AND is_deleted = false ORDER BY company_name ASC`
|
`SELECT id, company_name FROM companies WHERE is_active = true AND is_deleted = false ORDER BY company_name ASC`
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue