1 Commits

Author SHA1 Message Date
opbnq-q
bff39d2c75 fix: template 2025-03-16 11:56:16 +07:00
4 changed files with 19 additions and 13 deletions

View File

@@ -15,6 +15,8 @@ import (
//go:embed templates/scheme.tmpl
var SchemeTemplate string
const GolangServicesPath = "../../bindings/app/internal/services"
type Dependency struct {
ImportName string
ServiceName string
@@ -25,6 +27,7 @@ type Dependency struct {
type TemplateData struct {
StructName string
LowerName string
GolangServicesPath string
Fields []model.Field
Dependencies []Dependency
}
@@ -33,6 +36,7 @@ func GenerateScheme(model *model.Model, mkPath string) {
data := TemplateData{
StructName: model.Name,
LowerName: strings.ToLower(model.Name),
GolangServicesPath: GolangServicesPath,
Fields: model.Fields,
Dependencies: processDependencies(model.Fields),
}

View File

@@ -18,6 +18,7 @@ var ServiceTemplate string
type ServiceTemplateContext struct {
LowerModelName string
ModelName string
ServicesPath string
}
func GenerateService(model *model.Model, mkPath string) {
@@ -37,6 +38,7 @@ func GenerateService(model *model.Model, mkPath string) {
context := ServiceTemplateContext{
LowerModelName: strings.ToLower(model.Name),
ModelName: model.Name,
ServicesPath: GolangServicesPath,
}
serviceTemplate, err := template.New("service").Parse(ServiceTemplate)

View File

@@ -4,7 +4,7 @@ import { onMounted, reactive } from 'vue'
import { getDefaultValues } from '../utils/structs/defaults.util'
import Service from './{{.LowerName}}.service'
import type { Scheme } from '../types/scheme.type'
import { {{.StructName}} } from '../../bindings/github.com/kuzgoga/nto-boilerplate/internal/services'
import { {{.StructName}} } from '{{.GolangServicesPath}}'
import { ref } from 'vue'
import type { Validate } from "../types/validate.type";
import { getDefaultSortOptions } from "../utils/structs/default-sort-options.util";

View File

@@ -1,5 +1,5 @@
import { GetAll, Create, Delete, GetById, Update, Count, SortedByOrder, SearchByAllTextFields } from "../../bindings/github.com/kuzgoga/nto-boilerplate/internal/services/{{.LowerModelName}}service"
import type { {{.ModelName}} } from "../../bindings/github.com/kuzgoga/nto-boilerplate/internal/services"
import { GetAll, Create, Delete, GetById, Update, Count, SortedByOrder, SearchByAllTextFields } from "../../bindings/app/internal/services/{{.LowerModelName}}service"
import type { {{.ModelName}} } from "{{.ServicesPath}}"
import type { IService } from "../types/service.type"
import type { SortOptions } from "../types/sort-options.type";