fix: gofmt && little fixes

This commit is contained in:
2025-03-07 22:27:13 +07:00
parent e6f21d1bb2
commit d522bd3841
7 changed files with 25 additions and 22 deletions

View File

@@ -2,6 +2,7 @@ package generation
import (
"fmt"
"log"
"nto_cli/utils"
"os"
"strings"
@@ -20,11 +21,11 @@ import type { IService } from "%s"
export default class %sService implements IService<%s> {
async read(id: number) {
return await GetById(id)
return await GetById(id) as %s
}
async readAll() {
return await GetAll() as %s
return await GetAll() as %s[]
}
async create(item: %s) {
@@ -33,16 +34,18 @@ export default class %sService implements IService<%s> {
async delete(id: number) {
return await Delete(id)
}
}
async update(item: %s) {
await Update(item)
}
async count() {
return await Count()
}
}
`, utils.GetServiceBindPath(structName), structName, utils.GetServiceStructType(structName), utils.GetServiceType(), structName, structName, structName, structName))
`, utils.GetServiceBindPath(structName), structName, utils.GetServiceStructType(structName), utils.GetServiceType(), structName, structName, structName, structName, structName, structName))
if err != nil {
panic(err)
log.Fatalf("Failed to write to file: %s", err)
}
}