mirror of
https://github.com/hay-kot/homebox.git
synced 2024-12-18 13:06:32 +00:00
34 lines
786 B
YAML
34 lines
786 B
YAML
|
---
|
||
|
# yaml-language-server: $schema=https://hay-kot.github.io/scaffold/schema.json
|
||
|
messages:
|
||
|
pre: |
|
||
|
# Ent Model Generation
|
||
|
|
||
|
With Boilerplate!
|
||
|
post: |
|
||
|
Complete!
|
||
|
|
||
|
questions:
|
||
|
- name: "model"
|
||
|
prompt:
|
||
|
message: "What is the name of the model? (PascalCase)"
|
||
|
required: true
|
||
|
|
||
|
- name: "by_group"
|
||
|
prompt:
|
||
|
confirm: "Include a Group Edge? (group_id -> id)"
|
||
|
required: true
|
||
|
|
||
|
rewrites:
|
||
|
- from: 'templates/model.go'
|
||
|
to: 'backend/internal/data/ent/schema/{{ lower .Scaffold.model }}.go'
|
||
|
|
||
|
inject:
|
||
|
- name: "Insert Groups Edge"
|
||
|
path: 'backend/internal/data/ent/schema/group.go'
|
||
|
at: // $scaffold_edge
|
||
|
template: |
|
||
|
{{- if .Scaffold.by_group -}}
|
||
|
owned("{{ lower .Scaffold.model }}s", {{ .Scaffold.model }}.Type),
|
||
|
{{- end -}}
|