Workflow-App/Workflow/app/api/compliance/groups/route.ts
sjcoetzeesj-coder 11d0178ab1 feat: commit Workflow app source; move CIPC credentials to env
Adds the full Next.js app (app/, components/, lib/, scripts/, assets/,
docs/, Dockerfile, compose, configs) to version control.

Security:
- CIPC BizPortal customer-code logins (Login 1 + Login 3) now read
  CIPC_LOGIN1_CODE / CIPC_LOGIN1_PASSWORD / CIPC_LOGIN3_CODE /
  CIPC_LOGIN3_PASSWORD from .env.local instead of source.
- BizPortal personal login in apply-bizportal route reads
  BIZPORTAL_ID_NO / BIZPORTAL_PASSWORD.
- Added .env.example as the committed template.

.gitignore excludes .env*, node_modules, .next, logs, sqlite, Playwright
storage_state.json (live CIPC cookies), scratch dirs, client PDFs and
debug screenshots.
2026-10-18 15:21:45 +02:00

22 lines
634 B
TypeScript

// app/api/compliance/groups/route.ts
// GET /api/compliance/groups
// Returns groups that have at least one is_client company
import { NextResponse } from "next/server";
import { fetchCollection, type PBRecord } from "@/lib/pb";
export const dynamic = "force-dynamic";
type Group = PBRecord & { name: string; description: string };
export async function GET() {
try {
const groups = await fetchCollection<Group>("groups", {
sort: "name",
perPage: 200,
});
return NextResponse.json({ groups: groups.items });
} catch (err) {
return NextResponse.json({ error: String(err) }, { status: 500 });
}
}