Workflow-App/Workflow/scripts/_probe_res_docs.py
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

41 lines
No EOL
1.6 KiB
Python

import json, urllib.request, urllib.parse
from pathlib import Path
ROOT = Path(r"C:\Users\SJ\.minimax-agent\projects\JEI")
env = {}
for line in (ROOT / ".env.local").read_text(encoding="utf-8").splitlines():
line = line.strip()
if line and not line.startswith("#") and "=" in line:
k, v = line.split("=", 1)
env[k.strip()] = v.strip().strip('"').strip("'")
PB = env.get("NEXT_PUBLIC_PB_URL") or env["PB_URL"]
TOK = env["PB_TOKEN"]
def get(path, **q):
url = f"{PB}{path}"
if q:
url += "?" + urllib.parse.urlencode(q)
req = urllib.request.Request(url, headers={"Authorization": TOK})
with urllib.request.urlopen(req, timeout=60) as r:
return json.loads(r.read().decode())
for cid, name in [("pbc_266170881", "ysterbaard_resolutions"),
("ysterbaard_director_resignations", "ysterbaard_director_resignations")]:
c = get(f"/api/collections/{cid}")
print(f"=== {name} ({cid})")
fields = [f.get("name") for f in c.get("fields", [])]
print(" fields:", fields)
try:
recs = get(f"/api/collections/{cid}/records", perPage=50)
except Exception as e:
print(" list failed:", e)
continue
print(f" records: {recs.get('totalItems')}")
for r in recs.get("items", []):
filefields = {k: v for k, v in r.items() if isinstance(v, str) and v.lower().endswith(".pdf")}
label = r.get("resolution_number") or r.get("reference") or r.get("status") or r.get("company")
print(f" {r['id']} {label}")
if filefields:
for k, v in filefields.items():
print(f" FILE {k} = {v}")
print()