diff --git a/generation/service.go b/generation/service.go index 5b40252..a5feca3 100644 --- a/generation/service.go +++ b/generation/service.go @@ -7,17 +7,17 @@ import ( ) func GetServiceBindPath(structName string) string { - path := fmt.Sprintf("../bindings/app/internal/services/%sservice.ts", strings.ToLower(structName)) + path := fmt.Sprintf("../../bindings/app/internal/services/%sservice.ts", strings.ToLower(structName)) return path } func GetServiceStructType(structName string) string { - path := "../bindings/app/internal/services/models.ts" + path := "../../bindings/app/internal/services/models.ts" return path } func GetServiceType() string { - path := "./types/service.type.ts" + path := "../types/service.type.ts" return path } @@ -32,7 +32,7 @@ func GenerateService(structName, mkPath string) { import type { %s } from "%s" import type { Service } from "%s" -export class %sService implements Service { +export class %sService implements Service<%s> { async read(id: number) { return await GetById(id) } @@ -58,7 +58,7 @@ export class %sService implements Service { return await ExportToExcel() } } -`, GetServiceBindPath(structName), structName, GetServiceStructType(structName), GetServiceType(), structName, structName, structName, structName)) +`, GetServiceBindPath(structName), structName, GetServiceStructType(structName), GetServiceType(), structName, structName, structName, structName, structName)) if err != nil { panic(err) } diff --git a/main.go b/main.go index e79a94b..a8b776a 100644 --- a/main.go +++ b/main.go @@ -17,6 +17,5 @@ func main() { structFields := utils.GetStructFields(file, structName) - generation.Generate(structName, structFields) - } - + generation.Generate(structName, structFields) +}