Initial CPONE middleware implementation
This commit is contained in:
39
README.md
Normal file
39
README.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# CPONE Middleware Go
|
||||
|
||||
Service Go untuk endpoint:
|
||||
|
||||
```text
|
||||
GET /api/cpone/layanan-mapping-harga?periodeTarifID=10&layananID=6413,6414,1309
|
||||
Authorization: Bearer <your-secure-token>
|
||||
```
|
||||
|
||||
Format response dibuat mengikuti controller PHP `LayananDepartemenController::mappingHarga`.
|
||||
|
||||
## Config
|
||||
|
||||
Copy `.env.example` menjadi `.env`, lalu isi koneksi MySQL:
|
||||
|
||||
```text
|
||||
APP_HOST=0.0.0.0
|
||||
APP_PORT=8080
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=primaya
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
CPONE_BEARER_TOKEN=replace-with-a-secure-token
|
||||
```
|
||||
|
||||
## Run
|
||||
|
||||
```bash
|
||||
cd cpone-middleware
|
||||
go mod tidy
|
||||
go run ./cmd/server
|
||||
```
|
||||
|
||||
## SQLC
|
||||
|
||||
File `sqlc.yaml`, `sqlc/schema.sql`, dan `sqlc/query.sql` sudah disiapkan.
|
||||
|
||||
Catatan penting: sqlc tidak bisa menerima nama tabel dinamis seperti `harga_layanan_{periodeTarifID}`. Implementasi runtime saat ini tetap memakai `database/sql` untuk menyusun nama tabel setelah `periodeTarifID` divalidasi angka, sama seperti PHP memakai `HargaLayanan::makeTableName()`. Kalau semua periode ingin digenerate oleh sqlc, buat query konkret per tabel periode, misalnya `harga_layanan_10`, `harga_layanan_11`, dan seterusnya.
|
||||
Reference in New Issue
Block a user