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 { 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 return path
} }
func GetServiceStructType(structName string) string { func GetServiceStructType(structName string) string {
path := "../bindings/app/internal/services/models.ts" path := "../../bindings/app/internal/services/models.ts"
return path return path
} }
func GetServiceType() string { func GetServiceType() string {
path := "./types/service.type.ts" path := "../types/service.type.ts"
return path return path
} }
@@ -32,7 +32,7 @@ func GenerateService(structName, mkPath string) {
import type { %s } from "%s" import type { %s } from "%s"
import type { Service } from "%s" import type { Service } from "%s"
export class %sService implements Service { export class %sService implements Service<%s> {
async read(id: number) { async read(id: number) {
return await GetById(id) return await GetById(id)
} }
@@ -58,7 +58,7 @@ export class %sService implements Service {
return await ExportToExcel() 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 { if err != nil {
panic(err) panic(err)
} }

View File

@@ -19,4 +19,3 @@ func main() {
generation.Generate(structName, structFields) generation.Generate(structName, structFields)
} }