Files
api_antrean/tools/general/services-config.yaml
T
2025-11-02 03:08:38 +00:00

280 lines
8.2 KiB
YAML

global:
module_name: "api-service"
output_dir: "internal/handlers"
enable_swagger: true
enable_logging: true
database:
default_connection: "postgres_satudata"
timeout_seconds: 30
services:
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"
# 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"