perbaikan

This commit is contained in:
2025-08-24 16:18:15 +07:00
parent 9838c48eab
commit 7681c796e8
24 changed files with 2443 additions and 2057 deletions

View File

@@ -13,8 +13,7 @@ type HandlerData struct {
Name string
NameLower string
NamePlural string
Category string
CategoryPath string
Category string // Untuk backward compatibility (bagian pertama)
ModuleName string
TableName string
HasGet bool
@@ -48,16 +47,18 @@ func main() {
methods = []string{"get", "post", "put", "delete", "dynamic", "search"}
}
// Parse category and entity
// Parse category and entity - support up to 4 levels
var category, entityName string
if strings.Contains(entityPath, "/") {
parts := strings.Split(entityPath, "/")
if len(parts) != 2 {
fmt.Println("❌ Error: Invalid path format. Use 'category/entity' or just 'entity'")
if len(parts) < 2 || len(parts) > 4 {
fmt.Println("❌ Error: Invalid path format. Use up to 4 levels like 'level1/level2/level3/entity'")
os.Exit(1)
}
// Entity name is the last part
entityName = parts[len(parts)-1]
// Category for backward compatibility (first part)
category = parts[0]
entityName = parts[1]
} else {
category = ""
entityName = entityPath
@@ -81,7 +82,6 @@ func main() {
NameLower: entityLower,
NamePlural: entityPlural,
Category: category,
CategoryPath: category,
ModuleName: "api-service",
TableName: tableName,
HasPagination: true,