Updat erubhan besar query builder

This commit is contained in:
meninjar
2025-11-02 03:08:38 +00:00
parent 0002cf26be
commit 19324041b8
13 changed files with 2916 additions and 842 deletions
+272 -159
View File
@@ -3,165 +3,278 @@ global:
output_dir: "internal/handlers"
enable_swagger: true
enable_logging: true
database:
default_connection: "postgres_satudata"
timeout_seconds: 30
services:
schedule:
name: "Jadwal Dokter"
category: "schedule"
package: "schedule"
description: "Jadwal Dokter management"
base_url: ""
timeout: 30
retry_count: 3
endpoints:
schedule:
description: "Jadwal dokter management"
handler_folder: "master"
handler_file: "schedule.go"
handler_name: "schedule"
table_name: "daftar_jadwal_dokter"
# Definisikan skema tabel di sini
# =
schema:
columns:
- name: "id"
type: "serial4"
primary_key: true
go_type: "string" # Override tipe Go, UUID biasanya string
- name: "Hari"
type: "int4"
nullable: true
- name: "Nama_hari"
type: "varchar"
nullable: true
- name: "Waktu"
type: "varchar"
nullable: true
- name: "Dokter"
type: "uuid"
nullable: true
go_type: "string" # Override tipe Go
- name: "Spesialis"
type: "int4"
nullable: true
- name: "Sub_spesialis"
type: "int4"
nullable: true
- name: "Status"
type: "int4"
nullable: true
# ======================================================================
functions:
list:
methods: ["GET"]
path: "/"
get_routes: "/"
get_path: "/"
model: "Schedule"
response_model: "ScheduleGetResponse"
description: "Get schedule list with pagination and filters"
summary: "Get Schedule List"
tags: ["Schedule"]
require_auth: true
cache_enabled: true
enable_database: true
cache_ttl: 300
has_pagination: true
has_filter: true
has_search: true
has_stats: true
get:
methods: ["GET"]
path: "/:id"
get_routes: "/:id"
get_path: "/:id"
model: "Schedule"
response_model: "ScheduleGetByIDResponse"
description: "Get schedule by ID"
summary: "Get schedule by ID"
tags: ["Schedule"]
require_auth: true
cache_enabled: true
enable_database: true
cache_ttl: 300
pasien:
name: "Manajemen Data Pasien"
category: "pasien"
package: "pasien"
description: "API untuk mengelola data pasien dengan informasi lokasi lengkap"
base_url: ""
timeout: 30
retry_count: 3
table_name: "m_pasien"
search:
methods: ["GET"]
path: "/search"
get_routes: "/search"
get_path: "/search"
model: "Schedule"
response_model: "ScheduleGetResponse"
description: "Search schedule"
summary: "Search Schedule"
tags: ["Schedule"]
require_auth: true
cache_enabled: true
enable_database: true
cache_ttl: 300
has_search: true
create:
methods: ["POST"]
path: "/"
post_routes: "/"
post_path: "/"
model: "Schedule"
response_model: "ScheduleCreateResponse"
request_model: "ScheduleCreateRequest"
description: "Create new schedule"
summary: "Create Schedule"
tags: ["Schedule"]
require_auth: true
cache_enabled: false
enable_database: true
cache_ttl: 0
update:
methods: ["PUT"]
path: "/:id"
put_routes: "/:id"
put_path: "/:id"
model: "Schedule"
response_model: "ScheduleUpdateResponse"
request_model: "ScheduleUpdateRequest"
description: "Update schedule"
summary: "Update Schedule"
tags: ["Schedule"]
require_auth: true
cache_enabled: false
enable_database: true
cache_ttl: 0
delete:
methods: ["DELETE"]
path: "/:id"
delete_routes: "/:id"
delete_path: "/:id"
model: "Schedule"
response_model: "ScheduleDeleteResponse"
description: "Delete schedule"
summary: "Delete Schedule"
tags: ["Schedule"]
require_auth: true
cache_enabled: false
enable_database: true
cache_ttl: 0
stats:
methods: ["GET"]
path: "/stats"
get_routes: "/stats"
get_path: "/stats"
model: "AggregateData"
response_model: "AggregateData"
description: "Get retribusi statistics"
summary: "Get Retribusi Stats"
tags: ["Retribusi"]
require_auth: true
cache_enabled: true
enable_database: true
cache_ttl: 180
has_stats: true
# Define all columns once for reuse
columns:
- name: "nomr"
type: "varchar"
nullable: true
go_type: "string"
description: "Nomor Rekam Medis"
- name: "title"
type: "varchar"
nullable: true
go_type: "string"
description: "Gelar pasien (Tn, Ny, Sdr, dll)"
- name: "nama"
type: "varchar"
nullable: true
go_type: "string"
validation: "required,min=1,max=100"
description: "Nama lengkap pasien"
- name: "tempat"
type: "varchar"
nullable: true
go_type: "string"
description: "Tempat lahir pasien"
- name: "tgllahir"
type: "date"
nullable: true
go_type: "time.Time"
description: "Tanggal lahir pasien"
- name: "jeniskelamin"
type: "varchar"
nullable: true
go_type: "string"
validation: "oneof=L P"
description: "Jenis kelamin (L/P)"
- name: "alamat"
type: "varchar"
nullable: true
go_type: "string"
description: "Alamat lengkap pasien"
- name: "kelurahan"
type: "int8"
nullable: true
go_type: "int64"
description: "ID Kelurahan"
- name: "kdkecamatan"
type: "int4"
nullable: true
go_type: "int32"
description: "ID Kecamatan"
- name: "kota"
type: "int4"
nullable: true
go_type: "int32"
description: "ID Kota"
- name: "kdprovinsi"
type: "int4"
nullable: true
go_type: "int32"
description: "ID Provinsi"
- name: "agama"
type: "int4"
nullable: true
go_type: "int32"
description: "ID Agama"
- name: "no_kartu"
type: "varchar"
nullable: true
go_type: "string"
description: "Nomor kartu identitas"
- name: "noktp_baru"
type: "varchar"
nullable: true
go_type: "string"
description: "Nomor KTP baru"
# Define relationships with other tables
relationships:
- name: "provinsi"
table: "m_provinsi"
foreign_key: "kdprovinsi"
local_key: "idprovinsi"
columns:
- name: "idprovinsi"
type: "int4"
nullable: false
go_type: "int32"
primary_key: true
- name: "namaprovinsi"
type: "varchar"
nullable: true
go_type: "string"
description: "Nama provinsi"
- name: "kota"
table: "m_kota"
foreign_key: "kota"
local_key: "idkota"
columns:
- name: "idkota"
type: "int4"
nullable: false
go_type: "int32"
primary_key: true
- name: "namakota"
type: "varchar"
nullable: true
go_type: "string"
description: "Nama kota"
- name: "kecamatan"
table: "m_kecamatan"
foreign_key: "kdkecamatan"
local_key: "idkecamatan"
columns:
- name: "idkecamatan"
type: "int8"
nullable: false
go_type: "int64"
primary_key: true
- name: "namakecamatan"
type: "varchar"
nullable: true
go_type: "string"
description: "Nama kecamatan"
- name: "kelurahan"
table: "m_kelurahan"
foreign_key: "kelurahan"
local_key: "idkelurahan"
columns:
- name: "idkelurahan"
type: "int8"
nullable: false
go_type: "int64"
primary_key: true
- name: "namakelurahan"
type: "varchar"
nullable: true
go_type: "string"
description: "Nama kelurahan"
# Define reusable field groups
field_groups:
base_fields: ["nomr", "title", "nama", "tempat", "tgllahir", "jeniskelamin"]
location_fields: ["alamat", "kelurahan", "kdkecamatan", "kota", "kdprovinsi"]
identity_fields: ["agama", "no_kartu", "noktp_baru"]
all_fields: ["nomr", "title", "nama", "tempat", "tgllahir", "jeniskelamin", "alamat", "kelurahan", "kdkecamatan", "kota", "kdprovinsi", "agama", "no_kartu", "noktp_baru"]
with_location_names: ["nomr", "title", "nama", "tempat", "tgllahir", "jeniskelamin", "alamat", "kelurahan", "namakelurahan", "kdkecamatan", "namakecamatan", "kota", "namakota", "kdprovinsi", "namaprovinsi", "agama", "no_kartu", "noktp_baru"]
# Define endpoints with reusable configurations
endpoints:
list:
methods: ["GET"]
path: "/"
description: "Get list of pasien with pagination and filters"
summary: "Get Pasien List"
tags: ["Pasien"]
require_auth: true
cache_enabled: true
cache_ttl: 300
has_pagination: true
has_filter: true
has_search: true
has_stats: true
fields: "with_location_names"
response_model: "PasienGetResponse"
get_by_nomr:
methods: ["GET"]
path: "/:nomr"
description: "Get pasien by NOMR"
summary: "Get Pasien by NOMR"
tags: ["Pasien"]
require_auth: true
cache_enabled: true
cache_ttl: 300
fields: "with_location_names"
response_model: "PasienGetByNOMRResponse"
create:
methods: ["POST"]
path: "/"
description: "Create a new pasien"
summary: "Create Pasien"
tags: ["Pasien"]
require_auth: true
fields: "all_fields"
request_model: "PasienCreateRequest"
response_model: "PasienCreateResponse"
update:
methods: ["PUT"]
path: "/:nomr"
description: "Update an existing pasien"
summary: "Update Pasien"
tags: ["Pasien"]
require_auth: true
fields: "all_fields"
request_model: "PasienUpdateRequest"
response_model: "PasienUpdateResponse"
delete:
methods: ["DELETE"]
path: "/:nomr"
description: "Delete a pasien"
summary: "Delete Pasien"
tags: ["Pasien"]
require_auth: true
soft_delete: false
response_model: "PasienDeleteResponse"
dynamic:
methods: ["GET"]
path: "/dynamic"
description: "Get pasien with dynamic filtering"
summary: "Get Pasien Dynamic"
tags: ["Pasien"]
require_auth: true
has_dynamic: true
fields: "with_location_names"
response_model: "PasienGetResponse"
search:
methods: ["GET"]
path: "/search"
description: "Search pasien by name or NOMR"
summary: "Search Pasien"
tags: ["Pasien"]
require_auth: true
has_search: true
fields: "with_location_names"
response_model: "PasienGetResponse"
stats:
methods: ["GET"]
path: "/stats"
description: "Get pasien statistics"
summary: "Get Pasien Stats"
tags: ["Pasien"]
require_auth: true
has_stats: true
response_model: "AggregateData"
by_location:
methods: ["GET"]
path: "/by-location"
description: "Get pasien by location (provinsi, kota, kecamatan, kelurahan)"
summary: "Get Pasien by Location"
tags: ["Pasien"]
require_auth: true
has_filter: true
fields: "with_location_names"
response_model: "PasienGetResponse"
by_age:
methods: ["GET"]
path: "/by-age"
description: "Get pasien statistics by age group"
summary: "Get Pasien by Age Group"
tags: ["Pasien"]
require_auth: true
has_stats: true
response_model: "PasienAgeStatsResponse"