mirror of
https://github.com/opbnq-q/nto-cli.git
synced 2025-12-06 17:10:34 +07:00
feat: field gen
This commit is contained in:
@@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
func Generate(structName string, fields []entities.Field) {
|
||||
mkPath := strings.ToLower(fmt.Sprintf("%s/frontend/src/%s", utils.FindFrontendPath() , structName))
|
||||
mkPath := fmt.Sprintf("%s/frontend/src/%s", utils.FindFrontendPath() , strings.ToLower(structName))
|
||||
if err := os.Mkdir(mkPath, 0755); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
@@ -27,12 +27,12 @@ func GenerateService(structName, mkPath string) {
|
||||
panic(err)
|
||||
}
|
||||
defer serviceFile.Close()
|
||||
_, err = serviceFile.WriteString(
|
||||
fmt.Sprintf(`import { GetAll, Create, Delete, ExportToExcel, GetById, Update, Count } from "%s"
|
||||
_, err = serviceFile.WriteString(fmt.Sprintf(
|
||||
`import { GetAll, Create, Delete, ExportToExcel, GetById, Update, Count } from "%s"
|
||||
import type { %s } from "%s"
|
||||
import type { Service } from "%s"
|
||||
import type { IService } from "%s"
|
||||
|
||||
export class %sService implements Service<%s> {
|
||||
export class %sService implements IService<%s> {
|
||||
async read(id: number) {
|
||||
return await GetById(id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user