feat: crud generation was added in pipeline

This commit is contained in:
2025-03-13 17:07:50 +07:00
parent 90dee12950
commit 490b02e007
3 changed files with 24 additions and 4 deletions

View File

@@ -1,6 +1,27 @@
version: '3'
tasks:
go:gen:dal:
summary: Runs GORM Gen for crud generating
dir: internal/gen
sources:
- ../models/*.go
generates:
- ../dal/*.go
cmds:
- go run gen.go
go:gen:crudgen:
summary: Runs crudgen for crud generating
sources:
- internal/models/*.go
generates:
- internal/services/*.go
deps:
- go:gen:dal
cmds:
- crudgen -p internal
go:mod:tidy:
summary: Runs `go mod tidy`
internal: true
@@ -40,6 +61,8 @@ tasks:
generate:bindings:
summary: Generates bindings for the frontend
deps:
- go:gen:crudgen
sources:
- "**/*.go"
- go.mod

View File

@@ -7,8 +7,6 @@ import type { Scheme } from "../types/scheme.type";
import { PostType } from "../../bindings/app/internal/services";
import { ref } from "vue";
import type { Validate } from "../types/validate.type";
import { ImportFromExcel } from "../../bindings/app/internal/services/posttypeservice.ts";
import { ExportToExcel } from "../../bindings/app/internal/services/postservice.ts";
const service = new Service();
@@ -21,7 +19,6 @@ const load = async () => {
onMounted(async () => {
await load();
await ExportToExcel();
});
const scheme: Scheme<PostType> = reactive({

View File

@@ -18,7 +18,7 @@ type Post struct {
Author Author `ui:"label:Автор; field:Name;"`
PostTypeId uint `ui:"hidden; excel:Номер типа поста;"`
PostType PostType `ui:"label:Тип поста; field:Name;" gorm:"constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
Comments []Comment `ui:"label:Комментарии;field:Text;" gorm:"many2many:comments_post;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
Comments []Comment `ui:"label:Комментарии; field:Text;" gorm:"many2many:comments_post;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"`
}
type Author struct {