mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
adjust collection; adjust migration
This commit is contained in:
@@ -193,7 +193,7 @@ func randomToken(size int) (string, error) {
|
||||
|
||||
func canonicalPermissions(perms []string) []string {
|
||||
if len(perms) == 0 {
|
||||
return nil
|
||||
return []string{}
|
||||
}
|
||||
|
||||
seen := make(map[string]struct{}, len(perms))
|
||||
@@ -214,7 +214,7 @@ func canonicalPermissions(perms []string) []string {
|
||||
|
||||
func uniqueUint(values []uint) []uint {
|
||||
if len(values) == 0 {
|
||||
return nil
|
||||
return []uint{}
|
||||
}
|
||||
|
||||
seen := make(map[uint]struct{}, len(values))
|
||||
|
||||
+419
-29
@@ -476,10 +476,11 @@ func buildPostmanURL(route normalizedRoute, meta routeMeta) string {
|
||||
|
||||
query := make([]string, 0, len(meta.QueryParams))
|
||||
for _, param := range meta.QueryParams {
|
||||
if !param.IncludePostman {
|
||||
continue
|
||||
value := strings.TrimSpace(param.PostmanValue)
|
||||
if value == "" && param.Example != nil {
|
||||
value = fmt.Sprintf("%v", param.Example)
|
||||
}
|
||||
query = append(query, fmt.Sprintf("%s=%v", param.Name, param.PostmanValue))
|
||||
query = append(query, fmt.Sprintf("%s=%v", param.Name, value))
|
||||
}
|
||||
|
||||
if len(query) == 0 {
|
||||
@@ -552,31 +553,103 @@ func buildPostmanEnvironment(routes []normalizedRoute) map[string]any {
|
||||
}
|
||||
|
||||
func describeRoute(route normalizedRoute) routeMeta {
|
||||
routePath := route.Path
|
||||
if len(routePath) > 1 {
|
||||
routePath = strings.TrimSuffix(routePath, "/")
|
||||
}
|
||||
|
||||
meta := routeMeta{
|
||||
Group: "Dashboard API Key",
|
||||
Tag: inferTag(route.Path),
|
||||
Summary: defaultSummary(route.Path),
|
||||
Description: fmt.Sprintf("Read access to `%s`.", route.Path),
|
||||
Tag: inferTag(routePath),
|
||||
Summary: defaultSummary(routePath),
|
||||
Description: fmt.Sprintf("Read access to `%s`.", routePath),
|
||||
Security: securityAPIOrBearer,
|
||||
ListStyle: !strings.Contains(route.Path, ":"),
|
||||
ListStyle: !strings.Contains(routePath, ":"),
|
||||
}
|
||||
|
||||
switch {
|
||||
case route.Path == "/healthz" || route.Path == "/readyz" || route.Path == "/api/constants":
|
||||
case routePath == "/healthz" || routePath == "/readyz" || routePath == "/api/constants":
|
||||
meta.Group = "Public"
|
||||
meta.Security = securityNone
|
||||
meta.ListStyle = false
|
||||
case strings.HasPrefix(route.Path, "/api/sso/"):
|
||||
case strings.HasPrefix(routePath, "/api/sso/"):
|
||||
meta.Group = "Internal/OAuth Reference"
|
||||
meta.ListStyle = false
|
||||
if route.Path == "/api/sso/userinfo" {
|
||||
if routePath == "/api/sso/userinfo" {
|
||||
meta.Security = securityBearer
|
||||
} else {
|
||||
meta.Security = securityNone
|
||||
}
|
||||
}
|
||||
|
||||
switch route.Path {
|
||||
switch routePath {
|
||||
case "/api/approvals":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "module_name", In: "query", Description: "Approval workflow module name.", Required: true, Example: "EXPENSES", PostmanValue: "EXPENSES"},
|
||||
{Name: "module_id", In: "query", Description: "Optional approvable module id.", Example: 1},
|
||||
{Name: "group_step_number", In: "query", Description: "Group approval records by step number.", Example: false},
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "approval"},
|
||||
{Name: "order_by_date", In: "query", Description: "Sort direction by date.", Example: "DESC"},
|
||||
}
|
||||
case "/api/daily-checklists":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "kebersihan"},
|
||||
{Name: "date_from", In: "query", Description: "Start date filter (YYYY-MM-DD).", Example: "2026-01-01"},
|
||||
{Name: "date_to", In: "query", Description: "End date filter (YYYY-MM-DD).", Example: "2026-01-31"},
|
||||
{Name: "status", In: "query", Description: "Checklist status filter.", Example: "done"},
|
||||
{Name: "kandang_id", In: "query", Description: "Kandang id filter.", Example: 1, PostmanValue: "{{idProjectFlockKandang}}"},
|
||||
}
|
||||
case "/api/daily-checklists/report":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Required: true, Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Required: true, Example: 10},
|
||||
{Name: "bulan", In: "query", Description: "Month number (1-12).", Required: true, Example: 1},
|
||||
{Name: "tahun", In: "query", Description: "Year.", Required: true, Example: 2026},
|
||||
{Name: "area_id", In: "query", Description: "Area id filter.", Example: 1, PostmanValue: "{{area_id}}"},
|
||||
{Name: "location_id", In: "query", Description: "Location id filter.", Example: 1, PostmanValue: "{{location_id}}"},
|
||||
{Name: "kandang_id", In: "query", Description: "Kandang id filter.", Example: 1, PostmanValue: "{{idProjectFlockKandang}}"},
|
||||
{Name: "employee_id", In: "query", Description: "Employee id filter.", Example: 1, PostmanValue: "{{employee_id}}"},
|
||||
{Name: "phase_id", In: "query", Description: "Phase id filter.", Example: 1, PostmanValue: "{{id}}"},
|
||||
}
|
||||
case "/api/daily-checklists/summary":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "date_from", In: "query", Description: "Start date filter (YYYY-MM-DD).", Required: true, Example: "2026-01-01"},
|
||||
{Name: "date_to", In: "query", Description: "End date filter (YYYY-MM-DD).", Required: true, Example: "2026-01-31"},
|
||||
{Name: "category", In: "query", Description: "Checklist category filter.", Example: "cleaning"},
|
||||
{Name: "kandang_id", In: "query", Description: "Kandang id filter.", Example: 1, PostmanValue: "{{idProjectFlockKandang}}"},
|
||||
}
|
||||
case "/api/daily-checklists/tasks":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "checklist_id", In: "query", Description: "Daily checklist id.", Required: true, Example: 1, PostmanValue: "{{idDailyChecklist}}"},
|
||||
}
|
||||
case "/api/closings":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "kandang"},
|
||||
{Name: "project_status", In: "query", Description: "Project status filter (1 or 2).", Example: 1},
|
||||
{Name: "location_id", In: "query", Description: "Location id filter.", Example: 1, PostmanValue: "{{location_id}}"},
|
||||
}
|
||||
case "/api/closings/:projectFlockId":
|
||||
meta.ListStyle = false
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "kandang_id", In: "query", Description: "Optional kandang id filter.", Example: 1, PostmanValue: "{{project_flock_kandang_id}}"},
|
||||
}
|
||||
case "/api/closings/:project_flock_id/perhitungan_sapronak", "/api/closings/:project_flock_id/:project_flock_kandang_id/perhitungan_sapronak":
|
||||
meta.ListStyle = false
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "flag", In: "query", Description: "Product category flag filter (DOC/OVK/PAKAN/PULLET).", Example: "DOC"},
|
||||
}
|
||||
case "/api/expenses":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "operasional"},
|
||||
}
|
||||
case "/api/dashboards":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
@@ -592,22 +665,309 @@ func describeRoute(route normalizedRoute) routeMeta {
|
||||
{Name: "kandang_ids", In: "query", Description: "Comma separated kandang ids.", Example: "1,2"},
|
||||
{Name: "include", In: "query", Description: "Comma separated dashboard sections to include.", Example: "performance,summary"},
|
||||
}
|
||||
case "/api/closings/:projectFlockId/sapronak", "/api/closings/:projectFlockId/sapronak/summary":
|
||||
meta.ListStyle = route.Path == "/api/closings/:projectFlockId/sapronak"
|
||||
case "/api/closings/:projectFlockId/sapronak":
|
||||
meta.ListStyle = true
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "type", In: "query", Description: "Required sapronak direction.", Required: true, Example: "incoming", PostmanValue: "incoming", IncludePostman: true},
|
||||
{Name: "type", In: "query", Description: "Required sapronak direction.", Required: true, Example: "incoming", PostmanValue: "incoming"},
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "pakan"},
|
||||
{Name: "kandang_id", In: "query", Description: "Optional kandang id filter.", Example: 1},
|
||||
{Name: "kandang_id", In: "query", Description: "Optional kandang id filter.", Example: 1, PostmanValue: "{{project_flock_kandang_id}}"},
|
||||
}
|
||||
case "/api/closings/:projectFlockId/sapronak/summary":
|
||||
meta.ListStyle = false
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "type", In: "query", Description: "Required sapronak direction.", Required: true, Example: "incoming", PostmanValue: "incoming"},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "pakan"},
|
||||
{Name: "kandang_id", In: "query", Description: "Optional kandang id filter.", Example: 1, PostmanValue: "{{project_flock_kandang_id}}"},
|
||||
}
|
||||
case "/api/closings/:projectFlockId/production-data", "/api/closings/:projectFlockId/keuangan":
|
||||
meta.ListStyle = false
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "kandang_id", In: "query", Description: "Optional kandang id filter.", Example: 1},
|
||||
{Name: "kandang_id", In: "query", Description: "Optional kandang id filter.", Example: 1, PostmanValue: "{{project_flock_kandang_id}}"},
|
||||
}
|
||||
case "/api/closings/:project_flock_id/expedition-hpp":
|
||||
meta.ListStyle = false
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "project_flock_kandang_id", In: "query", Description: "Optional project flock kandang id filter.", Example: 1},
|
||||
{Name: "project_flock_kandang_id", In: "query", Description: "Optional project flock kandang id filter.", Example: 1, PostmanValue: "{{project_flock_kandang_id}}"},
|
||||
}
|
||||
case "/api/inventory/adjustments":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "product_id", In: "query", Description: "Product id filter.", Example: 1, PostmanValue: "{{product_id}}"},
|
||||
{Name: "warehouse_id", In: "query", Description: "Warehouse id filter.", Example: 1, PostmanValue: "{{warehouse_id}}"},
|
||||
{Name: "transaction_type", In: "query", Description: "Transaction type filter.", Example: "IN"},
|
||||
{Name: "transaction_subtype", In: "query", Description: "Transaction subtype filter.", Example: "ADJUSTMENT"},
|
||||
{Name: "function_code", In: "query", Description: "Function code filter.", Example: "MANUAL_ADJUSTMENT"},
|
||||
}
|
||||
case "/api/inventory/product-stocks":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "pakan"},
|
||||
}
|
||||
case "/api/inventory/product-warehouses":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "gudang"},
|
||||
{Name: "product_id", In: "query", Description: "Product id filter.", Example: 1, PostmanValue: "{{product_id}}"},
|
||||
{Name: "warehouse_id", In: "query", Description: "Warehouse id filter.", Example: 1, PostmanValue: "{{warehouse_id}}"},
|
||||
{Name: "location_id", In: "query", Description: "Location id filter.", Example: 1, PostmanValue: "{{location_id}}"},
|
||||
{Name: "flags", In: "query", Description: "Stock flags filter.", Example: "DOC"},
|
||||
{Name: "kandang_id", In: "query", Description: "Kandang id filter.", Example: 1, PostmanValue: "{{project_flock_kandang_id}}"},
|
||||
{Name: "available_only", In: "query", Description: "Show available stock only.", Example: true},
|
||||
{Name: "transfer_context", In: "query", Description: "Transfer context filter.", Example: "inventory_transfer"},
|
||||
{Name: "stock_mode", In: "query", Description: "Stock mode filter.", Example: "exclude_chickin"},
|
||||
{Name: "type", In: "query", Description: "Warehouse stock type filter.", Example: "incoming"},
|
||||
}
|
||||
case "/api/inventory/transfers":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "TRF"},
|
||||
}
|
||||
case "/api/marketing":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "delivery"},
|
||||
{Name: "product_ids", In: "query", Description: "Comma separated product ids.", Example: "1,2"},
|
||||
{Name: "status", In: "query", Description: "Delivery status filter.", Example: "DRAFT"},
|
||||
{Name: "customer_id", In: "query", Description: "Customer id filter.", Example: 1, PostmanValue: "{{customer_id}}"},
|
||||
{Name: "marketing_id", In: "query", Description: "Marketing id filter.", Example: 1},
|
||||
}
|
||||
case "/api/master-data/areas":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "bandung"},
|
||||
}
|
||||
case "/api/master-data/banks":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "bca"},
|
||||
}
|
||||
case "/api/master-data/config-checklists":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "harian"},
|
||||
}
|
||||
case "/api/master-data/customers":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "pt"},
|
||||
{Name: "has_marketing", In: "query", Description: "Filter customer by marketing relation.", Example: true},
|
||||
}
|
||||
case "/api/master-data/employees":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "andi"},
|
||||
{Name: "kandang_id", In: "query", Description: "Kandang id filter.", Example: 1, PostmanValue: "{{project_flock_kandang_id}}"},
|
||||
{Name: "is_active", In: "query", Description: "Active status filter.", Example: true},
|
||||
}
|
||||
case "/api/master-data/fcrs":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "fcr"},
|
||||
}
|
||||
case "/api/master-data/flocks":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "layer"},
|
||||
}
|
||||
case "/api/master-data/kandang-groups":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "blok"},
|
||||
{Name: "location_id", In: "query", Description: "Location id filter.", Example: 1, PostmanValue: "{{location_id}}"},
|
||||
{Name: "pic_id", In: "query", Description: "Person in charge id filter.", Example: 1, PostmanValue: "{{employee_id}}"},
|
||||
}
|
||||
case "/api/master-data/kandangs":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "kandang"},
|
||||
{Name: "location_id", In: "query", Description: "Location id filter.", Example: 1, PostmanValue: "{{location_id}}"},
|
||||
{Name: "pic_id", In: "query", Description: "Person in charge id filter.", Example: 1, PostmanValue: "{{employee_id}}"},
|
||||
}
|
||||
case "/api/master-data/locations":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "farm"},
|
||||
{Name: "area_id", In: "query", Description: "Area id filter.", Example: 1, PostmanValue: "{{area_id}}"},
|
||||
{Name: "has_laying", In: "query", Description: "Filter laying locations only.", Example: false},
|
||||
}
|
||||
case "/api/master-data/nonstocks":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "vitamin"},
|
||||
{Name: "supplier_id", In: "query", Description: "Supplier id filter.", Example: 1, PostmanValue: "{{supplier_id}}"},
|
||||
}
|
||||
case "/api/master-data/phase-activities":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "cek pakan"},
|
||||
{Name: "phase_ids", In: "query", Description: "Comma separated phase ids.", Example: "1,2"},
|
||||
}
|
||||
case "/api/master-data/phases":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "starter"},
|
||||
{Name: "category", In: "query", Description: "Phase category filter.", Example: "Growing"},
|
||||
}
|
||||
case "/api/master-data/product-categories":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "pakan"},
|
||||
}
|
||||
case "/api/master-data/production-standards":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "standar"},
|
||||
{Name: "project_category", In: "query", Description: "Project category filter.", Example: "GROWING"},
|
||||
}
|
||||
case "/api/master-data/products":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "jagung"},
|
||||
{Name: "product_category_id", In: "query", Description: "Product category id filter.", Example: 1, PostmanValue: "{{product_category_id}}"},
|
||||
{Name: "is_depletion", In: "query", Description: "Filter depletion products.", Example: false},
|
||||
{Name: "include_all", In: "query", Description: "Include all products regardless of status.", Example: false},
|
||||
}
|
||||
case "/api/master-data/suppliers":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "supplier"},
|
||||
{Name: "flag", In: "query", Description: "Supplier type flag filter.", Example: "ACTIVE"},
|
||||
{Name: "category", In: "query", Description: "Supplier category filter.", Example: "PAKAN"},
|
||||
}
|
||||
case "/api/master-data/uoms":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "kg"},
|
||||
}
|
||||
case "/api/master-data/warehouses":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "gudang"},
|
||||
{Name: "area_id", In: "query", Description: "Area id filter.", Example: 1, PostmanValue: "{{area_id}}"},
|
||||
{Name: "location_id", In: "query", Description: "Location id filter.", Example: 1, PostmanValue: "{{location_id}}"},
|
||||
{Name: "active_project_flock", In: "query", Description: "Filter only active project flock warehouses.", Example: false},
|
||||
{Name: "transfer_context", In: "query", Description: "Transfer context filter.", Example: "inventory_transfer"},
|
||||
}
|
||||
case "/api/production/project-flock-kandangs":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "kandang"},
|
||||
{Name: "name_with_periode", In: "query", Description: "Return name-with-period projection.", Example: false},
|
||||
{Name: "project_flock_id", In: "query", Description: "Project flock id filter.", Example: 1, PostmanValue: "{{project_flock_id}}"},
|
||||
{Name: "kandang_id", In: "query", Description: "Kandang id filter.", Example: 1, PostmanValue: "{{project_flock_kandang_id}}"},
|
||||
{Name: "category", In: "query", Description: "Project category filter.", Example: "Growing"},
|
||||
{Name: "area_id", In: "query", Description: "Area id filter.", Example: 1, PostmanValue: "{{area_id}}"},
|
||||
{Name: "location_id", In: "query", Description: "Location id filter.", Example: 1, PostmanValue: "{{location_id}}"},
|
||||
{Name: "sort_by", In: "query", Description: "Sort field.", Example: "created_at"},
|
||||
{Name: "sort_order", In: "query", Description: "Sort order.", Example: "ASC"},
|
||||
{Name: "step_name", In: "query", Description: "Approval step name filter.", Example: "Pengajuan"},
|
||||
}
|
||||
case "/api/production/project-flocks":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "flock"},
|
||||
{Name: "sort_by", In: "query", Description: "Sort field.", Example: "created_at"},
|
||||
{Name: "sort_order", In: "query", Description: "Sort order.", Example: "asc"},
|
||||
{Name: "area_id", In: "query", Description: "Area id filter.", Example: 1, PostmanValue: "{{area_id}}"},
|
||||
{Name: "location_id", In: "query", Description: "Location id filter.", Example: 1, PostmanValue: "{{location_id}}"},
|
||||
{Name: "period", In: "query", Description: "Project period filter.", Example: 1},
|
||||
{Name: "category", In: "query", Description: "Project category filter.", Example: "Growing"},
|
||||
{Name: "status", In: "query", Description: "Project status filter.", Example: "Aktif"},
|
||||
{Name: "kandang_id", In: "query", Description: "Comma separated kandang ids.", Example: "1,2"},
|
||||
{Name: "transfer_context", In: "query", Description: "Transfer context filter.", Example: "transfer_to_laying"},
|
||||
}
|
||||
case "/api/production/project-flocks/kandangs/lookup":
|
||||
meta.ListStyle = false
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "project_flock_id", In: "query", Description: "Project flock id.", Required: true, Example: 1, PostmanValue: "{{project_flock_id}}"},
|
||||
{Name: "kandang_id", In: "query", Description: "Kandang id.", Required: true, Example: 1, PostmanValue: "{{project_flock_kandang_id}}"},
|
||||
{Name: "withpopulation", In: "query", Description: "Include population value in response.", Example: false},
|
||||
{Name: "record_date", In: "query", Description: "Reference date (YYYY-MM-DD).", Example: "2026-01-01"},
|
||||
}
|
||||
case "/api/production/recordings":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "project_flock_kandang_id", In: "query", Description: "Project flock kandang id filter.", Example: 1, PostmanValue: "{{project_flock_kandang_id}}"},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "record"},
|
||||
{Name: "export", In: "query", Description: "Export mode.", Example: "excel"},
|
||||
}
|
||||
case "/api/production/recordings/next-day":
|
||||
meta.ListStyle = false
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "project_flock_kandang_id", In: "query", Description: "Project flock kandang id.", Required: true, Example: 1, PostmanValue: "{{project_flock_kandang_id}}"},
|
||||
{Name: "record_date", In: "query", Description: "Recording date (YYYY-MM-DD).", Required: true, Example: "2026-01-01"},
|
||||
}
|
||||
case "/api/production/transfer_layings":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "transfer"},
|
||||
{Name: "start_date", In: "query", Description: "Start date (YYYY-MM-DD).", Example: "2026-01-01"},
|
||||
{Name: "end_date", In: "query", Description: "End date (YYYY-MM-DD).", Example: "2026-01-31"},
|
||||
{Name: "flock_source", In: "query", Description: "Comma separated source flock ids.", Example: "1,2"},
|
||||
{Name: "flock_destination", In: "query", Description: "Comma separated destination flock ids.", Example: "3,4"},
|
||||
{Name: "status", In: "query", Description: "Comma separated status values.", Example: "DRAFT,APPROVED"},
|
||||
}
|
||||
case "/api/production/uniformities":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "project_flock_kandang_id", In: "query", Description: "Project flock kandang id filter.", Example: 1, PostmanValue: "{{project_flock_kandang_id}}"},
|
||||
{Name: "week", In: "query", Description: "Week number filter.", Example: 1},
|
||||
{Name: "start_date", In: "query", Description: "Start date (YYYY-MM-DD).", Example: "2026-01-01"},
|
||||
{Name: "end_date", In: "query", Description: "End date (YYYY-MM-DD).", Example: "2026-01-31"},
|
||||
{Name: "with_chart", In: "query", Description: "Include chart payload.", Example: false},
|
||||
}
|
||||
case "/api/purchases":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "supplier_id", In: "query", Description: "Supplier id filter.", Example: 1, PostmanValue: "{{supplier_id}}"},
|
||||
{Name: "area_id", In: "query", Description: "Area id filter.", Example: 1, PostmanValue: "{{area_id}}"},
|
||||
{Name: "location_id", In: "query", Description: "Location id filter.", Example: 1, PostmanValue: "{{location_id}}"},
|
||||
{Name: "product_category_id", In: "query", Description: "Product category id filter.", Example: "1"},
|
||||
{Name: "approval_status", In: "query", Description: "Approval status filter.", Example: "PENDING"},
|
||||
{Name: "po_date", In: "query", Description: "PO date (YYYY-MM-DD).", Example: "2026-01-01"},
|
||||
{Name: "po_date_from", In: "query", Description: "PO date start (YYYY-MM-DD).", Example: "2026-01-01"},
|
||||
{Name: "po_date_to", In: "query", Description: "PO date end (YYYY-MM-DD).", Example: "2026-01-31"},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "PO-"},
|
||||
{Name: "created_from", In: "query", Description: "Created date start (YYYY-MM-DD).", Example: "2026-01-01"},
|
||||
{Name: "created_to", In: "query", Description: "Created date end (YYYY-MM-DD).", Example: "2026-01-31"},
|
||||
}
|
||||
case "/api/users":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "admin"},
|
||||
}
|
||||
case "/api/reports/expense":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
@@ -616,6 +976,9 @@ func describeRoute(route normalizedRoute) routeMeta {
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "operasional"},
|
||||
{Name: "category", In: "query", Description: "Expense category filter.", Example: "BOP"},
|
||||
{Name: "supplier_id", In: "query", Description: "Supplier id filter.", Example: 1},
|
||||
{Name: "kandang_id", In: "query", Description: "Kandang id filter.", Example: 1},
|
||||
{Name: "project_flock_kandang_id", In: "query", Description: "Project flock kandang id filter.", Example: 1},
|
||||
{Name: "nonstock_id", In: "query", Description: "Nonstock id filter.", Example: 1},
|
||||
{Name: "location_id", In: "query", Description: "Location id filter.", Example: 1},
|
||||
{Name: "area_id", In: "query", Description: "Area id filter.", Example: 1},
|
||||
{Name: "realization_date", In: "query", Description: "Realization date filter (YYYY-MM-DD).", Example: "2026-01-15"},
|
||||
@@ -624,19 +987,32 @@ func describeRoute(route normalizedRoute) routeMeta {
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "SO-"},
|
||||
{Name: "customer_id", In: "query", Description: "Customer id filter.", Example: 1},
|
||||
{Name: "product_id", In: "query", Description: "Product id filter.", Example: 1},
|
||||
{Name: "warehouse_id", In: "query", Description: "Warehouse id filter.", Example: 1},
|
||||
{Name: "sales_person_id", In: "query", Description: "Sales person id filter.", Example: 1},
|
||||
{Name: "area_id", In: "query", Description: "Area id filter.", Example: 1},
|
||||
{Name: "location_id", In: "query", Description: "Location id filter.", Example: 1},
|
||||
{Name: "marketing_type", In: "query", Description: "Marketing type filter.", Example: "ayam"},
|
||||
{Name: "filter_by", In: "query", Description: "Date field filter.", Example: "so_date"},
|
||||
{Name: "start_date", In: "query", Description: "Period start date (YYYY-MM-DD).", Example: "2026-01-01"},
|
||||
{Name: "end_date", In: "query", Description: "Period end date (YYYY-MM-DD).", Example: "2026-01-31"},
|
||||
{Name: "customer_id", In: "query", Description: "Customer id filter.", Example: 1},
|
||||
{Name: "location_id", In: "query", Description: "Location id filter.", Example: 1},
|
||||
{Name: "sort_by", In: "query", Description: "Sort field.", Example: "so_date"},
|
||||
{Name: "sort_order", In: "query", Description: "Sort order.", Example: "asc"},
|
||||
}
|
||||
case "/api/reports/purchase-supplier":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "area_id", In: "query", Description: "Comma separated area ids.", Example: "1,2"},
|
||||
{Name: "supplier_id", In: "query", Description: "Comma separated supplier ids.", Example: "1,2"},
|
||||
{Name: "product_id", In: "query", Description: "Comma separated product ids.", Example: "1,2"},
|
||||
{Name: "product_category_id", In: "query", Description: "Comma separated product category ids.", Example: "1,2"},
|
||||
{Name: "start_date", In: "query", Description: "Period start date (YYYY-MM-DD).", Example: "2026-01-01"},
|
||||
{Name: "end_date", In: "query", Description: "Period end date (YYYY-MM-DD).", Example: "2026-01-31"},
|
||||
{Name: "supplier_id", In: "query", Description: "Comma separated supplier ids.", Example: "1,2"},
|
||||
{Name: "area_id", In: "query", Description: "Comma separated area ids.", Example: "1,2"},
|
||||
{Name: "sort_by", In: "query", Description: "Sort field.", Example: "created_at"},
|
||||
{Name: "filter_by", In: "query", Description: "Filter field.", Example: "received_date"},
|
||||
}
|
||||
case "/api/reports/debt-supplier":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
@@ -644,7 +1020,9 @@ func describeRoute(route normalizedRoute) routeMeta {
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "start_date", In: "query", Description: "Period start date (YYYY-MM-DD).", Example: "2026-01-01"},
|
||||
{Name: "end_date", In: "query", Description: "Period end date (YYYY-MM-DD).", Example: "2026-01-31"},
|
||||
{Name: "supplier_ids", In: "query", Description: "Comma separated supplier ids.", Example: "1,2", PostmanValue: "{{supplier_id}}", IncludePostman: true},
|
||||
{Name: "supplier_ids", In: "query", Description: "Comma separated supplier ids.", Example: "1,2", PostmanValue: "{{supplier_id}}"},
|
||||
{Name: "filter_by", In: "query", Description: "Date field filter.", Example: "received_date"},
|
||||
{Name: "sort_order", In: "query", Description: "Sort order.", Example: "asc"},
|
||||
}
|
||||
case "/api/reports/customer-payment":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
@@ -652,34 +1030,46 @@ func describeRoute(route normalizedRoute) routeMeta {
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "start_date", In: "query", Description: "Period start date (YYYY-MM-DD).", Example: "2026-01-01"},
|
||||
{Name: "end_date", In: "query", Description: "Period end date (YYYY-MM-DD).", Example: "2026-01-31"},
|
||||
{Name: "customer_ids", In: "query", Description: "Comma separated customer ids.", Example: "1,2", PostmanValue: "{{customer_id}}", IncludePostman: true},
|
||||
{Name: "customer_ids", In: "query", Description: "Comma separated customer ids.", Example: "1,2", PostmanValue: "{{customer_id}}"},
|
||||
{Name: "filter_by", In: "query", Description: "Date field filter.", Example: "TRANS_DATE"},
|
||||
}
|
||||
case "/api/reports/hpp-per-kandang":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "period", In: "query", Description: "Daily period filter (YYYY-MM).", Example: "2026-01"},
|
||||
{Name: "location_id", In: "query", Description: "Location id filter.", Example: 1},
|
||||
{Name: "kandang_id", In: "query", Description: "Kandang id filter.", Example: 1},
|
||||
{Name: "period", In: "query", Description: "Daily period filter (YYYY-MM-DD).", Example: "2026-01-01"},
|
||||
{Name: "show_unrecorded", In: "query", Description: "Include unrecorded data.", Example: false},
|
||||
{Name: "area_id", In: "query", Description: "Comma separated area ids.", Example: "1,2"},
|
||||
{Name: "location_id", In: "query", Description: "Comma separated location ids.", Example: "1,2"},
|
||||
{Name: "kandang_id", In: "query", Description: "Comma separated kandang ids.", Example: "1,2"},
|
||||
{Name: "weight_min", In: "query", Description: "Minimum body weight filter.", Example: "1.2"},
|
||||
{Name: "weight_max", In: "query", Description: "Maximum body weight filter.", Example: "1.8"},
|
||||
}
|
||||
case "/api/reports/production-result/:idProjectFlockKandang":
|
||||
meta.ListStyle = false
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
}
|
||||
case "/api/finance/transactions":
|
||||
meta.QueryParams = []parameterMeta{
|
||||
{Name: "page", In: "query", Description: "Page number.", Example: 1},
|
||||
{Name: "limit", In: "query", Description: "Page size.", Example: 10},
|
||||
{Name: "search", In: "query", Description: "Search keyword.", Example: "invoice"},
|
||||
{Name: "bank_ids", In: "query", Description: "Comma separated bank ids.", Example: "1,2", PostmanValue: "{{bank_id}}", IncludePostman: true},
|
||||
{Name: "bank_ids", In: "query", Description: "Comma separated bank ids.", Example: "1,2", PostmanValue: "{{bank_id}}"},
|
||||
{Name: "customer_ids", In: "query", Description: "Comma separated customer ids.", Example: "1,2"},
|
||||
{Name: "supplier_ids", In: "query", Description: "Comma separated supplier ids.", Example: "1,2"},
|
||||
{Name: "transaction_types", In: "query", Description: "Comma separated transaction types.", Example: "payment,initial_balance"},
|
||||
{Name: "sort_date", In: "query", Description: "Sort date basis.", Example: "created_at"},
|
||||
{Name: "start_date", In: "query", Description: "Start date (YYYY-MM-DD).", Example: "2026-01-01"},
|
||||
{Name: "end_date", In: "query", Description: "End date (YYYY-MM-DD).", Example: "2026-01-31"},
|
||||
}
|
||||
}
|
||||
|
||||
if route.Path == "/healthz" {
|
||||
if routePath == "/healthz" {
|
||||
meta.Summary = "Health check"
|
||||
meta.Description = "Simple liveness probe."
|
||||
} else if route.Path == "/readyz" {
|
||||
} else if routePath == "/readyz" {
|
||||
meta.Summary = "Readiness check"
|
||||
meta.Description = "Readiness probe for database and Redis."
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user