fix: service imports

This commit is contained in:
2025-02-14 20:10:08 +07:00
parent 8290462d92
commit 011249d3e3
2 changed files with 7 additions and 8 deletions

View File

@@ -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)
}

View File

@@ -17,6 +17,5 @@ func main() {
structFields := utils.GetStructFields(file, structName)
generation.Generate(structName, structFields)
}
generation.Generate(structName, structFields)
}