Add Julia+Postgres calculation service with shared golden vectors
- service/: Julia HTTP API (HTTP.jl + LibPQ), formulas.jl as source of truth - service/db/001_init.sql: calculation_runs (append-only), provinces, eto_monthly - tests/golden/vectors.json: single fixture set enforced on both JS and Julia - .gitignore: keep secrets (DB env, contracts, financial records, ransomware note) out - AGENTS.md: document service commands and formula-change rule
This commit is contained in:
1 parent
dd232b1c02
commit
dd65e9061f
14 files changed
+1467
No files matched your search
@@ -28,6 +28,25 @@ node --test tests/*.test.mjs
|
||||
python -m http.server 8090 # แล้วเปิด http://localhost:8090 ตรวจด้วยตา 1 รอบ
|
||||
```
|
||||
|
||||
## บริการ API (Julia + PostgreSQL)
|
||||
|
||||
```bash
|
||||
# ติดตั้ง dependency ครั้งแรก
|
||||
julia --project=service -e 'using Pkg; Pkg.add(["HTTP","JSON3","LibPQ"])'
|
||||
|
||||
# รัน API (ค่า env อยู่ใน service/.env — คัดลอกจาก .env.example แล้วใส่รหัสเอง)
|
||||
julia --project=service service/src/server.jl # http://127.0.0.1:8000
|
||||
|
||||
# ทดสอบสูตรทั้งสองฝั่ง (ต้องได้เลขตรงกันตาม golden vectors)
|
||||
julia --project=service service/test/runtests.jl
|
||||
node --test tests/*.test.mjs
|
||||
```
|
||||
|
||||
- สูตรอยู่ที่ `service/src/formulas.jl` (แหล่งความจริง) — `core/*.js` เป็นตัวสำรองตอนออฟไลน์
|
||||
- แก้สูตร = แก้ 3 ที่พร้อมกัน: `core/*.js`, `service/src/formulas.jl`, `tests/golden/vectors.json`
|
||||
- สคีมา DB: `service/db/001_init.sql` · สัญญา API: `service/openapi.yaml`
|
||||
- ห้าม commit `service/.env` (มีรหัส DB)
|
||||
|
||||
## อัปเดตเวอร์ชัน — ห้ามแก้มือทีละไฟล์
|
||||
|
||||
```bash
|
||||
|
||||
Reference in new issue
Block a user