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

27 lines
1.1 KiB
Python

import os, requests, pathlib
for line in pathlib.Path(r'C:\Users\SJ\.minimax-agent\projects\Workflow\.env.local').read_text().splitlines():
if line.strip() and '=' in line and not line.startswith('#'):
k, v = line.split('=', 1)
os.environ.setdefault(k.strip(), v.strip())
token = os.environ['PB_TOKEN']
h = {'Authorization': f'Bearer {token}', 'Content-Type': 'application/json'}
# Try creating a new field on a record
r = requests.patch(
'https://pb.agent.apphub.co.za/api/collections/ysterbaard_SARS_EMP201_PAYE/records/zrduajho6xfpb3q',
headers=h, json={'brand_new_field_test': 'hello'}, timeout=15,
)
print(f'new field PATCH: status={r.status_code}')
if r.status_code < 400:
d = r.json()
print(f' brand_new_field_test = {d.get("brand_new_field_test")!r}')
# Read the record
r = requests.get(
'https://pb.agent.apphub.co.za/api/collections/ysterbaard_SARS_EMP201_PAYE/records/zrduajho6xfpb3q',
headers=h, timeout=15,
)
d = r.json()
print(f'\nRecord fields: {sorted(d.keys())}')
print(f'last_updated stored value: {d.get("last_updated")!r}')
print(f'brand_new_field_test stored: {d.get("brand_new_field_test")!r}')