From b8d8184bda4fa915c4e1f519f9ed690e52f9aa59 Mon Sep 17 00:00:00 2001 From: mikestefanello <552328+mikestefanello@users.noreply.github.com> Date: Sat, 12 Apr 2025 16:45:33 -0400 Subject: [PATCH] Support nillable fields. --- ent/admin/extension.go | 9 ++------- pkg/ui/pages/entity.go | 2 -- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/ent/admin/extension.go b/ent/admin/extension.go index 556b577..4632b60 100644 --- a/ent/admin/extension.go +++ b/ent/admin/extension.go @@ -65,7 +65,8 @@ func fieldIsPointer(f *gen.Field) bool { case f.Type.Type == field.TypeBool: return false case f.Optional, - f.Default: + f.Default, + f.Nillable: return true } return false @@ -79,9 +80,3 @@ func upperFirst(s string) string { out[0] = unicode.ToUpper(out[0]) return string(out) } - -/* -TODO: -1) How to handle fields like password that need to be transformed or omitted, etc? -2) Should we use the HTML datetime format and string fields rather than time.Time? -*/ diff --git a/pkg/ui/pages/entity.go b/pkg/ui/pages/entity.go index cdbf7fd..a2de8f9 100644 --- a/pkg/ui/pages/entity.go +++ b/pkg/ui/pages/entity.go @@ -67,8 +67,6 @@ func AdminEntityForm(ctx echo.Context, schema *load.Schema, values url.Values) e for _, f := range schema.Fields { // TODO cardinality? - // TODO optional fields? - // TODO password? switch f.Info.Type { case field.TypeString: inputType := "text"