A continuation of HomeBox the inventory and organization system built for the Home User
feat: add new field types to template_fields schema (#1315)
Matt79559255e2e3
diff --git a/Taskfile.yml b/Taskfile.ymlindex ad3a073f..f7db405f 100644--- a/Taskfile.yml+++ b/Taskfile.yml@@ -55,8 +55,6 @@ tasks:cmds:- task: swag- task: typescript-types- - cp ./backend/app/api/static/docs/swagger.json docs/en/api/openapi-2.0.json- - cp ./backend/app/api/static/docs/swagger.yaml docs/en/api/openapi-2.0.yamlgo:run:env:diff --git a/backend/app/api/static/docs/docs.go b/backend/app/api/static/docs/docs.goindex ea89e3fb..8d6789db 100644--- a/backend/app/api/static/docs/docs.go+++ b/backend/app/api/static/docs/docs.go@@ -3715,6 +3715,10 @@ const docTemplate = `{"ent.TemplateField": {"type": "object","properties": {+ "boolean_value": {+ "description": "BooleanValue holds the value of the \"boolean_value\" field.",+ "type": "boolean"+ },"created_at": {"description": "CreatedAt holds the value of the \"created_at\" field.","type": "string"@@ -3739,10 +3743,18 @@ const docTemplate = `{"description": "Name holds the value of the \"name\" field.","type": "string"},+ "number_value": {+ "description": "NumberValue holds the value of the \"number_value\" field.",+ "type": "integer"+ },"text_value": {"description": "TextValue holds the value of the \"text_value\" field.","type": "string"},+ "time_value": {+ "description": "TimeValue holds the value of the \"time_value\" field.",+ "type": "string"+ },"type": {"description": "Type holds the value of the \"type\" field.","allOf": [@@ -5306,10 +5318,16 @@ const docTemplate = `{"templatefield.Type": {"type": "string","enum": [- "text"+ "text",+ "number",+ "boolean",+ "time"],"x-enum-varnames": [- "TypeText"+ "TypeText",+ "TypeNumber",+ "TypeBoolean",+ "TypeTime"]},"user.Role": {diff --git a/backend/app/api/static/docs/openapi-3.json b/backend/app/api/static/docs/openapi-3.jsonindex 2f694ac7..6cdb869e 100644--- a/backend/app/api/static/docs/openapi-3.json+++ b/backend/app/api/static/docs/openapi-3.json@@ -3912,6 +3912,10 @@"ent.TemplateField": {"type": "object","properties": {+ "boolean_value": {+ "description": "BooleanValue holds the value of the \"boolean_value\" field.",+ "type": "boolean"+ },"created_at": {"description": "CreatedAt holds the value of the \"created_at\" field.","type": "string"@@ -3936,10 +3940,18 @@"description": "Name holds the value of the \"name\" field.","type": "string"},+ "number_value": {+ "description": "NumberValue holds the value of the \"number_value\" field.",+ "type": "integer"+ },"text_value": {"description": "TextValue holds the value of the \"text_value\" field.","type": "string"},+ "time_value": {+ "description": "TimeValue holds the value of the \"time_value\" field.",+ "type": "string"+ },"type": {"description": "Type holds the value of the \"type\" field.","allOf": [@@ -5503,10 +5515,16 @@"templatefield.Type": {"type": "string","enum": [- "text"+ "text",+ "number",+ "boolean",+ "time"],"x-enum-varnames": [- "TypeText"+ "TypeText",+ "TypeNumber",+ "TypeBoolean",+ "TypeTime"]},"user.Role": {diff --git a/backend/app/api/static/docs/openapi-3.yaml b/backend/app/api/static/docs/openapi-3.yamlindex ff303844..079cac0d 100644--- a/backend/app/api/static/docs/openapi-3.yaml+++ b/backend/app/api/static/docs/openapi-3.yaml@@ -2423,6 +2423,9 @@ components:ent.TemplateField:type: objectproperties:+ boolean_value:+ description: BooleanValue holds the value of the "boolean_value" field.+ type: booleancreated_at:description: CreatedAt holds the value of the "created_at" field.type: string@@ -2442,9 +2445,15 @@ components:name:description: Name holds the value of the "name" field.type: string+ number_value:+ description: NumberValue holds the value of the "number_value" field.+ type: integertext_value:description: TextValue holds the value of the "text_value" field.type: string+ time_value:+ description: TimeValue holds the value of the "time_value" field.+ type: stringtype:description: Type holds the value of the "type" field.allOf:@@ -3509,8 +3518,14 @@ components:type: stringenum:- text+ - number+ - boolean+ - timex-enum-varnames:- TypeText+ - TypeNumber+ - TypeBoolean+ - TypeTimeuser.Role:type: stringenum:diff --git a/backend/app/api/static/docs/swagger.json b/backend/app/api/static/docs/swagger.jsonindex 8662b78e..2b64e355 100644--- a/backend/app/api/static/docs/swagger.json+++ b/backend/app/api/static/docs/swagger.json@@ -3713,6 +3713,10 @@"ent.TemplateField": {"type": "object","properties": {+ "boolean_value": {+ "description": "BooleanValue holds the value of the \"boolean_value\" field.",+ "type": "boolean"+ },"created_at": {"description": "CreatedAt holds the value of the \"created_at\" field.","type": "string"@@ -3737,10 +3741,18 @@"description": "Name holds the value of the \"name\" field.","type": "string"},+ "number_value": {+ "description": "NumberValue holds the value of the \"number_value\" field.",+ "type": "integer"+ },"text_value": {"description": "TextValue holds the value of the \"text_value\" field.","type": "string"},+ "time_value": {+ "description": "TimeValue holds the value of the \"time_value\" field.",+ "type": "string"+ },"type": {"description": "Type holds the value of the \"type\" field.","allOf": [@@ -5304,10 +5316,16 @@"templatefield.Type": {"type": "string","enum": [- "text"+ "text",+ "number",+ "boolean",+ "time"],"x-enum-varnames": [- "TypeText"+ "TypeText",+ "TypeNumber",+ "TypeBoolean",+ "TypeTime"]},"user.Role": {diff --git a/backend/app/api/static/docs/swagger.yaml b/backend/app/api/static/docs/swagger.yamlindex a340de23..e113de4f 100644--- a/backend/app/api/static/docs/swagger.yaml+++ b/backend/app/api/static/docs/swagger.yaml@@ -675,6 +675,9 @@ definitions:type: objectent.TemplateField:properties:+ boolean_value:+ description: BooleanValue holds the value of the "boolean_value" field.+ type: booleancreated_at:description: CreatedAt holds the value of the "created_at" field.type: string@@ -693,9 +696,15 @@ definitions:name:description: Name holds the value of the "name" field.type: string+ number_value:+ description: NumberValue holds the value of the "number_value" field.+ type: integertext_value:description: TextValue holds the value of the "text_value" field.type: string+ time_value:+ description: TimeValue holds the value of the "time_value" field.+ type: stringtype:allOf:- $ref: '#/definitions/templatefield.Type'@@ -1759,9 +1768,15 @@ definitions:templatefield.Type:enum:- text+ - number+ - boolean+ - timetype: stringx-enum-varnames:- TypeText+ - TypeNumber+ - TypeBoolean+ - TypeTimeuser.Role:enum:- userdiff --git a/backend/go.sum b/backend/go.sumindex 694e780a..8c5788c8 100644--- a/backend/go.sum+++ b/backend/go.sum@@ -325,6 +325,8 @@ github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=+github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=+github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=github.com/mattn/go-sqlite3 v1.14.33 h1:A5blZ5ulQo2AtayQ9/limgHEkFreKj1Dv226a1K73s0=github.com/mattn/go-sqlite3 v1.14.33/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=github.com/mfridman/interpolate v0.0.2 h1:pnuTK7MQIxxFz1Gr+rjSIx9u7qVjf5VOoM/u6BbAxPY=@@ -347,6 +349,8 @@ github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOFgithub.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=github.com/olahol/melody v1.4.0 h1:Pa5SdeZL/zXPi1tJuMAPDbl4n3gQOThSL6G1p4qZ4SI=github.com/olahol/melody v1.4.0/go.mod h1:GgkTl6Y7yWj/HtfD48Q5vLKPVoZOH+Qqgfa7CvJgJM4=+github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=+github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=github.com/onsi/ginkgo/v2 v2.9.2 h1:BA2GMJOtfGAfagzYtrAlufIP0lq6QERkFmHLMLPwFSU=github.com/onsi/ginkgo/v2 v2.9.2/go.mod h1:WHcJJG2dIlcCqVfBAwUCrJxSPFb6v4azBwgxeMeDuts=github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE=@@ -391,6 +395,10 @@ github.com/shirou/gopsutil/v4 v4.25.12 h1:e7PvW/0RmJ8p8vPGJH4jvNkOyLmbkXgXW4m6ZPgithub.com/shirou/gopsutil/v4 v4.25.12/go.mod h1:EivAfP5x2EhLp2ovdpKSozecVXn1TmuG7SMzs/Wh4PU=github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0=github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M=+github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=+github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=+github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=+github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=github.com/spiffe/go-spiffe/v2 v2.6.0 h1:l+DolpxNWYgruGQVV0xsfeya3CsC7m8iBzDnMpsbLuo=github.com/spiffe/go-spiffe/v2 v2.6.0/go.mod h1:gm2SeUoMZEtpnzPNs2Csc0D/gX33k1xIx7lEzqblHEs=github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=diff --git a/backend/internal/data/ent/migrate/schema.go b/backend/internal/data/ent/migrate/schema.goindex 9091729a..06231edf 100644--- a/backend/internal/data/ent/migrate/schema.go+++ b/backend/internal/data/ent/migrate/schema.go@@ -436,8 +436,11 @@ var ({Name: "updated_at", Type: field.TypeTime},{Name: "name", Type: field.TypeString, Size: 255},{Name: "description", Type: field.TypeString, Nullable: true, Size: 1000},- {Name: "type", Type: field.TypeEnum, Enums: []string{"text"}},+ {Name: "type", Type: field.TypeEnum, Enums: []string{"text", "number", "boolean", "time"}},{Name: "text_value", Type: field.TypeString, Nullable: true, Size: 500},+ {Name: "number_value", Type: field.TypeInt, Nullable: true},+ {Name: "boolean_value", Type: field.TypeBool, Default: false},+ {Name: "time_value", Type: field.TypeTime},{Name: "item_template_fields", Type: field.TypeUUID, Nullable: true},}// TemplateFieldsTable holds the schema information for the "template_fields" table.@@ -448,7 +451,7 @@ var (ForeignKeys: []*schema.ForeignKey{{Symbol: "template_fields_item_templates_fields",- Columns: []*schema.Column{TemplateFieldsColumns[7]},+ Columns: []*schema.Column{TemplateFieldsColumns[10]},RefColumns: []*schema.Column{ItemTemplatesColumns[0]},OnDelete: schema.Cascade,},diff --git a/backend/internal/data/ent/mutation.go b/backend/internal/data/ent/mutation.goindex d8949de4..1d5d3768 100644--- a/backend/internal/data/ent/mutation.go+++ b/backend/internal/data/ent/mutation.go@@ -11868,6 +11868,10 @@ type TemplateFieldMutation struct {description *string_type *templatefield.Typetext_value *string+ number_value *int+ addnumber_value *int+ boolean_value *bool+ time_value *time.TimeclearedFields map[string]struct{}item_template *uuid.UUIDcleareditem_template bool@@ -12222,6 +12226,148 @@ func (m *TemplateFieldMutation) ResetTextValue() {delete(m.clearedFields, templatefield.FieldTextValue)}+// SetNumberValue sets the "number_value" field.+func (m *TemplateFieldMutation) SetNumberValue(i int) {+ m.number_value = &i+ m.addnumber_value = nil+}++// NumberValue returns the value of the "number_value" field in the mutation.+func (m *TemplateFieldMutation) NumberValue() (r int, exists bool) {+ v := m.number_value+ if v == nil {+ return+ }+ return *v, true+}++// OldNumberValue returns the old "number_value" field's value of the TemplateField entity.+// If the TemplateField object wasn't provided to the builder, the object is fetched from the database.+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.+func (m *TemplateFieldMutation) OldNumberValue(ctx context.Context) (v int, err error) {+ if !m.op.Is(OpUpdateOne) {+ return v, errors.New("OldNumberValue is only allowed on UpdateOne operations")+ }+ if m.id == nil || m.oldValue == nil {+ return v, errors.New("OldNumberValue requires an ID field in the mutation")+ }+ oldValue, err := m.oldValue(ctx)+ if err != nil {+ return v, fmt.Errorf("querying old value for OldNumberValue: %w", err)+ }+ return oldValue.NumberValue, nil+}++// AddNumberValue adds i to the "number_value" field.+func (m *TemplateFieldMutation) AddNumberValue(i int) {+ if m.addnumber_value != nil {+ *m.addnumber_value += i+ } else {+ m.addnumber_value = &i+ }+}++// AddedNumberValue returns the value that was added to the "number_value" field in this mutation.+func (m *TemplateFieldMutation) AddedNumberValue() (r int, exists bool) {+ v := m.addnumber_value+ if v == nil {+ return+ }+ return *v, true+}++// ClearNumberValue clears the value of the "number_value" field.+func (m *TemplateFieldMutation) ClearNumberValue() {+ m.number_value = nil+ m.addnumber_value = nil+ m.clearedFields[templatefield.FieldNumberValue] = struct{}{}+}++// NumberValueCleared returns if the "number_value" field was cleared in this mutation.+func (m *TemplateFieldMutation) NumberValueCleared() bool {+ _, ok := m.clearedFields[templatefield.FieldNumberValue]+ return ok+}++// ResetNumberValue resets all changes to the "number_value" field.+func (m *TemplateFieldMutation) ResetNumberValue() {+ m.number_value = nil+ m.addnumber_value = nil+ delete(m.clearedFields, templatefield.FieldNumberValue)+}++// SetBooleanValue sets the "boolean_value" field.+func (m *TemplateFieldMutation) SetBooleanValue(b bool) {+ m.boolean_value = &b+}++// BooleanValue returns the value of the "boolean_value" field in the mutation.+func (m *TemplateFieldMutation) BooleanValue() (r bool, exists bool) {+ v := m.boolean_value+ if v == nil {+ return+ }+ return *v, true+}++// OldBooleanValue returns the old "boolean_value" field's value of the TemplateField entity.+// If the TemplateField object wasn't provided to the builder, the object is fetched from the database.+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.+func (m *TemplateFieldMutation) OldBooleanValue(ctx context.Context) (v bool, err error) {+ if !m.op.Is(OpUpdateOne) {+ return v, errors.New("OldBooleanValue is only allowed on UpdateOne operations")+ }+ if m.id == nil || m.oldValue == nil {+ return v, errors.New("OldBooleanValue requires an ID field in the mutation")+ }+ oldValue, err := m.oldValue(ctx)+ if err != nil {+ return v, fmt.Errorf("querying old value for OldBooleanValue: %w", err)+ }+ return oldValue.BooleanValue, nil+}++// ResetBooleanValue resets all changes to the "boolean_value" field.+func (m *TemplateFieldMutation) ResetBooleanValue() {+ m.boolean_value = nil+}++// SetTimeValue sets the "time_value" field.+func (m *TemplateFieldMutation) SetTimeValue(t time.Time) {+ m.time_value = &t+}++// TimeValue returns the value of the "time_value" field in the mutation.+func (m *TemplateFieldMutation) TimeValue() (r time.Time, exists bool) {+ v := m.time_value+ if v == nil {+ return+ }+ return *v, true+}++// OldTimeValue returns the old "time_value" field's value of the TemplateField entity.+// If the TemplateField object wasn't provided to the builder, the object is fetched from the database.+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.+func (m *TemplateFieldMutation) OldTimeValue(ctx context.Context) (v time.Time, err error) {+ if !m.op.Is(OpUpdateOne) {+ return v, errors.New("OldTimeValue is only allowed on UpdateOne operations")+ }+ if m.id == nil || m.oldValue == nil {+ return v, errors.New("OldTimeValue requires an ID field in the mutation")+ }+ oldValue, err := m.oldValue(ctx)+ if err != nil {+ return v, fmt.Errorf("querying old value for OldTimeValue: %w", err)+ }+ return oldValue.TimeValue, nil+}++// ResetTimeValue resets all changes to the "time_value" field.+func (m *TemplateFieldMutation) ResetTimeValue() {+ m.time_value = nil+}+// SetItemTemplateID sets the "item_template" edge to the ItemTemplate entity by id.func (m *TemplateFieldMutation) SetItemTemplateID(id uuid.UUID) {m.item_template = &id@@ -12295,7 +12441,7 @@ func (m *TemplateFieldMutation) Type() string {// order to get all numeric fields that were incremented/decremented, call// AddedFields().func (m *TemplateFieldMutation) Fields() []string {- fields := make([]string, 0, 6)+ fields := make([]string, 0, 9)if m.created_at != nil {fields = append(fields, templatefield.FieldCreatedAt)}@@ -12314,6 +12460,15 @@ func (m *TemplateFieldMutation) Fields() []string {if m.text_value != nil {fields = append(fields, templatefield.FieldTextValue)}+ if m.number_value != nil {+ fields = append(fields, templatefield.FieldNumberValue)+ }+ if m.boolean_value != nil {+ fields = append(fields, templatefield.FieldBooleanValue)+ }+ if m.time_value != nil {+ fields = append(fields, templatefield.FieldTimeValue)+ }return fields}@@ -12334,6 +12489,12 @@ func (m *TemplateFieldMutation) Field(name string) (ent.Value, bool) {return m.GetType()case templatefield.FieldTextValue:return m.TextValue()+ case templatefield.FieldNumberValue:+ return m.NumberValue()+ case templatefield.FieldBooleanValue:+ return m.BooleanValue()+ case templatefield.FieldTimeValue:+ return m.TimeValue()}return nil, false}@@ -12355,6 +12516,12 @@ func (m *TemplateFieldMutation) OldField(ctx context.Context, name string) (ent.return m.OldType(ctx)case templatefield.FieldTextValue:return m.OldTextValue(ctx)+ case templatefield.FieldNumberValue:+ return m.OldNumberValue(ctx)+ case templatefield.FieldBooleanValue:+ return m.OldBooleanValue(ctx)+ case templatefield.FieldTimeValue:+ return m.OldTimeValue(ctx)}return nil, fmt.Errorf("unknown TemplateField field %s", name)}@@ -12406,6 +12573,27 @@ func (m *TemplateFieldMutation) SetField(name string, value ent.Value) error {}m.SetTextValue(v)return nil+ case templatefield.FieldNumberValue:+ v, ok := value.(int)+ if !ok {+ return fmt.Errorf("unexpected type %T for field %s", value, name)+ }+ m.SetNumberValue(v)+ return nil+ case templatefield.FieldBooleanValue:+ v, ok := value.(bool)+ if !ok {+ return fmt.Errorf("unexpected type %T for field %s", value, name)+ }+ m.SetBooleanValue(v)+ return nil+ case templatefield.FieldTimeValue:+ v, ok := value.(time.Time)+ if !ok {+ return fmt.Errorf("unexpected type %T for field %s", value, name)+ }+ m.SetTimeValue(v)+ return nil}return fmt.Errorf("unknown TemplateField field %s", name)}@@ -12413,13 +12601,21 @@ func (m *TemplateFieldMutation) SetField(name string, value ent.Value) error {// AddedFields returns all numeric fields that were incremented/decremented during// this mutation.func (m *TemplateFieldMutation) AddedFields() []string {- return nil+ var fields []string+ if m.addnumber_value != nil {+ fields = append(fields, templatefield.FieldNumberValue)+ }+ return fields}// AddedField returns the numeric value that was incremented/decremented on a field// with the given name. The second boolean return value indicates that this field// was not set, or was not defined in the schema.func (m *TemplateFieldMutation) AddedField(name string) (ent.Value, bool) {+ switch name {+ case templatefield.FieldNumberValue:+ return m.AddedNumberValue()+ }return nil, false}@@ -12428,6 +12624,13 @@ func (m *TemplateFieldMutation) AddedField(name string) (ent.Value, bool) {// type.func (m *TemplateFieldMutation) AddField(name string, value ent.Value) error {switch name {+ case templatefield.FieldNumberValue:+ v, ok := value.(int)+ if !ok {+ return fmt.Errorf("unexpected type %T for field %s", value, name)+ }+ m.AddNumberValue(v)+ return nil}return fmt.Errorf("unknown TemplateField numeric field %s", name)}@@ -12442,6 +12645,9 @@ func (m *TemplateFieldMutation) ClearedFields() []string {if m.FieldCleared(templatefield.FieldTextValue) {fields = append(fields, templatefield.FieldTextValue)}+ if m.FieldCleared(templatefield.FieldNumberValue) {+ fields = append(fields, templatefield.FieldNumberValue)+ }return fields}@@ -12462,6 +12668,9 @@ func (m *TemplateFieldMutation) ClearField(name string) error {case templatefield.FieldTextValue:m.ClearTextValue()return nil+ case templatefield.FieldNumberValue:+ m.ClearNumberValue()+ return nil}return fmt.Errorf("unknown TemplateField nullable field %s", name)}@@ -12488,6 +12697,15 @@ func (m *TemplateFieldMutation) ResetField(name string) error {case templatefield.FieldTextValue:m.ResetTextValue()return nil+ case templatefield.FieldNumberValue:+ m.ResetNumberValue()+ return nil+ case templatefield.FieldBooleanValue:+ m.ResetBooleanValue()+ return nil+ case templatefield.FieldTimeValue:+ m.ResetTimeValue()+ return nil}return fmt.Errorf("unknown TemplateField field %s", name)}diff --git a/backend/internal/data/ent/runtime.go b/backend/internal/data/ent/runtime.goindex 53f76972..eac7edc5 100644--- a/backend/internal/data/ent/runtime.go+++ b/backend/internal/data/ent/runtime.go@@ -640,6 +640,14 @@ func init() {templatefieldDescTextValue := templatefieldFields[1].Descriptor()// templatefield.TextValueValidator is a validator for the "text_value" field. It is called by the builders before save.templatefield.TextValueValidator = templatefieldDescTextValue.Validators[0].(func(string) error)+ // templatefieldDescBooleanValue is the schema descriptor for boolean_value field.+ templatefieldDescBooleanValue := templatefieldFields[3].Descriptor()+ // templatefield.DefaultBooleanValue holds the default value on creation for the boolean_value field.+ templatefield.DefaultBooleanValue = templatefieldDescBooleanValue.Default.(bool)+ // templatefieldDescTimeValue is the schema descriptor for time_value field.+ templatefieldDescTimeValue := templatefieldFields[4].Descriptor()+ // templatefield.DefaultTimeValue holds the default value on creation for the time_value field.+ templatefield.DefaultTimeValue = templatefieldDescTimeValue.Default.(func() time.Time)// templatefieldDescID is the schema descriptor for id field.templatefieldDescID := templatefieldMixinFields0[0].Descriptor()// templatefield.DefaultID holds the default value on creation for the id field.diff --git a/backend/internal/data/ent/schema/template_field.go b/backend/internal/data/ent/schema/template_field.goindex 8c82d43b..7772bd15 100644--- a/backend/internal/data/ent/schema/template_field.go+++ b/backend/internal/data/ent/schema/template_field.go@@ -1,6 +1,8 @@package schemaimport (+ "time"+"entgo.io/ent""entgo.io/ent/schema/edge""entgo.io/ent/schema/field"@@ -24,10 +26,16 @@ func (TemplateField) Mixin() []ent.Mixin {func (TemplateField) Fields() []ent.Field {return []ent.Field{field.Enum("type").- Values("text"),+ Values("text", "number", "boolean", "time"),field.String("text_value").MaxLen(500).Optional(),+ field.Int("number_value").+ Optional(),+ field.Bool("boolean_value").+ Default(false),+ field.Time("time_value").+ Default(time.Now),}}diff --git a/backend/internal/data/ent/templatefield.go b/backend/internal/data/ent/templatefield.goindex 3ba3a489..5516bba5 100644--- a/backend/internal/data/ent/templatefield.go+++ b/backend/internal/data/ent/templatefield.go@@ -31,6 +31,12 @@ type TemplateField struct {Type templatefield.Type `json:"type,omitempty"`// TextValue holds the value of the "text_value" field.TextValue string `json:"text_value,omitempty"`+ // NumberValue holds the value of the "number_value" field.+ NumberValue int `json:"number_value,omitempty"`+ // BooleanValue holds the value of the "boolean_value" field.+ BooleanValue bool `json:"boolean_value,omitempty"`+ // TimeValue holds the value of the "time_value" field.+ TimeValue time.Time `json:"time_value,omitempty"`// Edges holds the relations/edges for other nodes in the graph.// The values are being populated by the TemplateFieldQuery when eager-loading is set.Edges TemplateFieldEdges `json:"edges"`@@ -63,9 +69,13 @@ func (*TemplateField) scanValues(columns []string) ([]any, error) {values := make([]any, len(columns))for i := range columns {switch columns[i] {+ case templatefield.FieldBooleanValue:+ values[i] = new(sql.NullBool)+ case templatefield.FieldNumberValue:+ values[i] = new(sql.NullInt64)case templatefield.FieldName, templatefield.FieldDescription, templatefield.FieldType, templatefield.FieldTextValue:values[i] = new(sql.NullString)- case templatefield.FieldCreatedAt, templatefield.FieldUpdatedAt:+ case templatefield.FieldCreatedAt, templatefield.FieldUpdatedAt, templatefield.FieldTimeValue:values[i] = new(sql.NullTime)case templatefield.FieldID:values[i] = new(uuid.UUID)@@ -128,6 +138,24 @@ func (_m *TemplateField) assignValues(columns []string, values []any) error {} else if value.Valid {_m.TextValue = value.String}+ case templatefield.FieldNumberValue:+ if value, ok := values[i].(*sql.NullInt64); !ok {+ return fmt.Errorf("unexpected type %T for field number_value", values[i])+ } else if value.Valid {+ _m.NumberValue = int(value.Int64)+ }+ case templatefield.FieldBooleanValue:+ if value, ok := values[i].(*sql.NullBool); !ok {+ return fmt.Errorf("unexpected type %T for field boolean_value", values[i])+ } else if value.Valid {+ _m.BooleanValue = value.Bool+ }+ case templatefield.FieldTimeValue:+ if value, ok := values[i].(*sql.NullTime); !ok {+ return fmt.Errorf("unexpected type %T for field time_value", values[i])+ } else if value.Valid {+ _m.TimeValue = value.Time+ }case templatefield.ForeignKeys[0]:if value, ok := values[i].(*sql.NullScanner); !ok {return fmt.Errorf("unexpected type %T for field item_template_fields", values[i])@@ -193,6 +221,15 @@ func (_m *TemplateField) String() string {builder.WriteString(", ")builder.WriteString("text_value=")builder.WriteString(_m.TextValue)+ builder.WriteString(", ")+ builder.WriteString("number_value=")+ builder.WriteString(fmt.Sprintf("%v", _m.NumberValue))+ builder.WriteString(", ")+ builder.WriteString("boolean_value=")+ builder.WriteString(fmt.Sprintf("%v", _m.BooleanValue))+ builder.WriteString(", ")+ builder.WriteString("time_value=")+ builder.WriteString(_m.TimeValue.Format(time.ANSIC))builder.WriteByte(')')return builder.String()}diff --git a/backend/internal/data/ent/templatefield/templatefield.go b/backend/internal/data/ent/templatefield/templatefield.goindex 6dbde586..2aeb3466 100644--- a/backend/internal/data/ent/templatefield/templatefield.go+++ b/backend/internal/data/ent/templatefield/templatefield.go@@ -28,6 +28,12 @@ const (FieldType = "type"// FieldTextValue holds the string denoting the text_value field in the database.FieldTextValue = "text_value"+ // FieldNumberValue holds the string denoting the number_value field in the database.+ FieldNumberValue = "number_value"+ // FieldBooleanValue holds the string denoting the boolean_value field in the database.+ FieldBooleanValue = "boolean_value"+ // FieldTimeValue holds the string denoting the time_value field in the database.+ FieldTimeValue = "time_value"// EdgeItemTemplate holds the string denoting the item_template edge name in mutations.EdgeItemTemplate = "item_template"// Table holds the table name of the templatefield in the database.@@ -50,6 +56,9 @@ var Columns = []string{FieldDescription,FieldType,FieldTextValue,+ FieldNumberValue,+ FieldBooleanValue,+ FieldTimeValue,}// ForeignKeys holds the SQL foreign-keys that are owned by the "template_fields"@@ -86,6 +95,10 @@ var (DescriptionValidator func(string) error// TextValueValidator is a validator for the "text_value" field. It is called by the builders before save.TextValueValidator func(string) error+ // DefaultBooleanValue holds the default value on creation for the "boolean_value" field.+ DefaultBooleanValue bool+ // DefaultTimeValue holds the default value on creation for the "time_value" field.+ DefaultTimeValue func() time.Time// DefaultID holds the default value on creation for the "id" field.DefaultID func() uuid.UUID)@@ -95,7 +108,10 @@ type Type string// Type values.const (- TypeText Type = "text"+ TypeText Type = "text"+ TypeNumber Type = "number"+ TypeBoolean Type = "boolean"+ TypeTime Type = "time")func (_type Type) String() string {@@ -105,7 +121,7 @@ func (_type Type) String() string {// TypeValidator is a validator for the "type" field enum values. It is called by the builders before save.func TypeValidator(_type Type) error {switch _type {- case TypeText:+ case TypeText, TypeNumber, TypeBoolean, TypeTime:return nildefault:return fmt.Errorf("templatefield: invalid enum value for type field: %q", _type)@@ -150,6 +166,21 @@ func ByTextValue(opts ...sql.OrderTermOption) OrderOption {return sql.OrderByField(FieldTextValue, opts...).ToFunc()}+// ByNumberValue orders the results by the number_value field.+func ByNumberValue(opts ...sql.OrderTermOption) OrderOption {+ return sql.OrderByField(FieldNumberValue, opts...).ToFunc()+}++// ByBooleanValue orders the results by the boolean_value field.+func ByBooleanValue(opts ...sql.OrderTermOption) OrderOption {+ return sql.OrderByField(FieldBooleanValue, opts...).ToFunc()+}++// ByTimeValue orders the results by the time_value field.+func ByTimeValue(opts ...sql.OrderTermOption) OrderOption {+ return sql.OrderByField(FieldTimeValue, opts...).ToFunc()+}+// ByItemTemplateField orders the results by item_template field.func ByItemTemplateField(field string, opts ...sql.OrderTermOption) OrderOption {return func(s *sql.Selector) {diff --git a/backend/internal/data/ent/templatefield/where.go b/backend/internal/data/ent/templatefield/where.goindex 98021a2a..e8b24e81 100644--- a/backend/internal/data/ent/templatefield/where.go+++ b/backend/internal/data/ent/templatefield/where.go@@ -81,6 +81,21 @@ func TextValue(v string) predicate.TemplateField {return predicate.TemplateField(sql.FieldEQ(FieldTextValue, v))}+// NumberValue applies equality check predicate on the "number_value" field. It's identical to NumberValueEQ.+func NumberValue(v int) predicate.TemplateField {+ return predicate.TemplateField(sql.FieldEQ(FieldNumberValue, v))+}++// BooleanValue applies equality check predicate on the "boolean_value" field. It's identical to BooleanValueEQ.+func BooleanValue(v bool) predicate.TemplateField {+ return predicate.TemplateField(sql.FieldEQ(FieldBooleanValue, v))+}++// TimeValue applies equality check predicate on the "time_value" field. It's identical to TimeValueEQ.+func TimeValue(v time.Time) predicate.TemplateField {+ return predicate.TemplateField(sql.FieldEQ(FieldTimeValue, v))+}+// CreatedAtEQ applies the EQ predicate on the "created_at" field.func CreatedAtEQ(v time.Time) predicate.TemplateField {return predicate.TemplateField(sql.FieldEQ(FieldCreatedAt, v))@@ -396,6 +411,106 @@ func TextValueContainsFold(v string) predicate.TemplateField {return predicate.TemplateField(sql.FieldContainsFold(FieldTextValue, v))}+// NumberValueEQ applies the EQ predicate on the "number_value" field.+func NumberValueEQ(v int) predicate.TemplateField {+ return predicate.TemplateField(sql.FieldEQ(FieldNumberValue, v))+}++// NumberValueNEQ applies the NEQ predicate on the "number_value" field.+func NumberValueNEQ(v int) predicate.TemplateField {+ return predicate.TemplateField(sql.FieldNEQ(FieldNumberValue, v))+}++// NumberValueIn applies the In predicate on the "number_value" field.+func NumberValueIn(vs ...int) predicate.TemplateField {+ return predicate.TemplateField(sql.FieldIn(FieldNumberValue, vs...))+}++// NumberValueNotIn applies the NotIn predicate on the "number_value" field.+func NumberValueNotIn(vs ...int) predicate.TemplateField {+ return predicate.TemplateField(sql.FieldNotIn(FieldNumberValue, vs...))+}++// NumberValueGT applies the GT predicate on the "number_value" field.+func NumberValueGT(v int) predicate.TemplateField {+ return predicate.TemplateField(sql.FieldGT(FieldNumberValue, v))+}++// NumberValueGTE applies the GTE predicate on the "number_value" field.+func NumberValueGTE(v int) predicate.TemplateField {+ return predicate.TemplateField(sql.FieldGTE(FieldNumberValue, v))+}++// NumberValueLT applies the LT predicate on the "number_value" field.+func NumberValueLT(v int) predicate.TemplateField {+ return predicate.TemplateField(sql.FieldLT(FieldNumberValue, v))+}++// NumberValueLTE applies the LTE predicate on the "number_value" field.+func NumberValueLTE(v int) predicate.TemplateField {+ return predicate.TemplateField(sql.FieldLTE(FieldNumberValue, v))+}++// NumberValueIsNil applies the IsNil predicate on the "number_value" field.+func NumberValueIsNil() predicate.TemplateField {+ return predicate.TemplateField(sql.FieldIsNull(FieldNumberValue))+}++// NumberValueNotNil applies the NotNil predicate on the "number_value" field.+func NumberValueNotNil() predicate.TemplateField {+ return predicate.TemplateField(sql.FieldNotNull(FieldNumberValue))+}++// BooleanValueEQ applies the EQ predicate on the "boolean_value" field.+func BooleanValueEQ(v bool) predicate.TemplateField {+ return predicate.TemplateField(sql.FieldEQ(FieldBooleanValue, v))+}++// BooleanValueNEQ applies the NEQ predicate on the "boolean_value" field.+func BooleanValueNEQ(v bool) predicate.TemplateField {+ return predicate.TemplateField(sql.FieldNEQ(FieldBooleanValue, v))+}++// TimeValueEQ applies the EQ predicate on the "time_value" field.+func TimeValueEQ(v time.Time) predicate.TemplateField {+ return predicate.TemplateField(sql.FieldEQ(FieldTimeValue, v))+}++// TimeValueNEQ applies the NEQ predicate on the "time_value" field.+func TimeValueNEQ(v time.Time) predicate.TemplateField {+ return predicate.TemplateField(sql.FieldNEQ(FieldTimeValue, v))+}++// TimeValueIn applies the In predicate on the "time_value" field.+func TimeValueIn(vs ...time.Time) predicate.TemplateField {+ return predicate.TemplateField(sql.FieldIn(FieldTimeValue, vs...))+}++// TimeValueNotIn applies the NotIn predicate on the "time_value" field.+func TimeValueNotIn(vs ...time.Time) predicate.TemplateField {+ return predicate.TemplateField(sql.FieldNotIn(FieldTimeValue, vs...))+}++// TimeValueGT applies the GT predicate on the "time_value" field.+func TimeValueGT(v time.Time) predicate.TemplateField {+ return predicate.TemplateField(sql.FieldGT(FieldTimeValue, v))+}++// TimeValueGTE applies the GTE predicate on the "time_value" field.+func TimeValueGTE(v time.Time) predicate.TemplateField {+ return predicate.TemplateField(sql.FieldGTE(FieldTimeValue, v))+}++// TimeValueLT applies the LT predicate on the "time_value" field.+func TimeValueLT(v time.Time) predicate.TemplateField {+ return predicate.TemplateField(sql.FieldLT(FieldTimeValue, v))+}++// TimeValueLTE applies the LTE predicate on the "time_value" field.+func TimeValueLTE(v time.Time) predicate.TemplateField {+ return predicate.TemplateField(sql.FieldLTE(FieldTimeValue, v))+}+// HasItemTemplate applies the HasEdge predicate on the "item_template" edge.func HasItemTemplate() predicate.TemplateField {return predicate.TemplateField(func(s *sql.Selector) {diff --git a/backend/internal/data/ent/templatefield_create.go b/backend/internal/data/ent/templatefield_create.goindex fa42ba87..f4c5a117 100644--- a/backend/internal/data/ent/templatefield_create.go+++ b/backend/internal/data/ent/templatefield_create.go@@ -90,6 +90,48 @@ func (_c *TemplateFieldCreate) SetNillableTextValue(v *string) *TemplateFieldCrereturn _c}+// SetNumberValue sets the "number_value" field.+func (_c *TemplateFieldCreate) SetNumberValue(v int) *TemplateFieldCreate {+ _c.mutation.SetNumberValue(v)+ return _c+}++// SetNillableNumberValue sets the "number_value" field if the given value is not nil.+func (_c *TemplateFieldCreate) SetNillableNumberValue(v *int) *TemplateFieldCreate {+ if v != nil {+ _c.SetNumberValue(*v)+ }+ return _c+}++// SetBooleanValue sets the "boolean_value" field.+func (_c *TemplateFieldCreate) SetBooleanValue(v bool) *TemplateFieldCreate {+ _c.mutation.SetBooleanValue(v)+ return _c+}++// SetNillableBooleanValue sets the "boolean_value" field if the given value is not nil.+func (_c *TemplateFieldCreate) SetNillableBooleanValue(v *bool) *TemplateFieldCreate {+ if v != nil {+ _c.SetBooleanValue(*v)+ }+ return _c+}++// SetTimeValue sets the "time_value" field.+func (_c *TemplateFieldCreate) SetTimeValue(v time.Time) *TemplateFieldCreate {+ _c.mutation.SetTimeValue(v)+ return _c+}++// SetNillableTimeValue sets the "time_value" field if the given value is not nil.+func (_c *TemplateFieldCreate) SetNillableTimeValue(v *time.Time) *TemplateFieldCreate {+ if v != nil {+ _c.SetTimeValue(*v)+ }+ return _c+}+// SetID sets the "id" field.func (_c *TemplateFieldCreate) SetID(v uuid.UUID) *TemplateFieldCreate {_c.mutation.SetID(v)@@ -166,6 +208,14 @@ func (_c *TemplateFieldCreate) defaults() {v := templatefield.DefaultUpdatedAt()_c.mutation.SetUpdatedAt(v)}+ if _, ok := _c.mutation.BooleanValue(); !ok {+ v := templatefield.DefaultBooleanValue+ _c.mutation.SetBooleanValue(v)+ }+ if _, ok := _c.mutation.TimeValue(); !ok {+ v := templatefield.DefaultTimeValue()+ _c.mutation.SetTimeValue(v)+ }if _, ok := _c.mutation.ID(); !ok {v := templatefield.DefaultID()_c.mutation.SetID(v)@@ -206,6 +256,12 @@ func (_c *TemplateFieldCreate) check() error {return &ValidationError{Name: "text_value", err: fmt.Errorf(`ent: validator failed for field "TemplateField.text_value": %w`, err)}}}+ if _, ok := _c.mutation.BooleanValue(); !ok {+ return &ValidationError{Name: "boolean_value", err: errors.New(`ent: missing required field "TemplateField.boolean_value"`)}+ }+ if _, ok := _c.mutation.TimeValue(); !ok {+ return &ValidationError{Name: "time_value", err: errors.New(`ent: missing required field "TemplateField.time_value"`)}+ }return nil}@@ -265,6 +321,18 @@ func (_c *TemplateFieldCreate) createSpec() (*TemplateField, *sqlgraph.CreateSpe_spec.SetField(templatefield.FieldTextValue, field.TypeString, value)_node.TextValue = value}+ if value, ok := _c.mutation.NumberValue(); ok {+ _spec.SetField(templatefield.FieldNumberValue, field.TypeInt, value)+ _node.NumberValue = value+ }+ if value, ok := _c.mutation.BooleanValue(); ok {+ _spec.SetField(templatefield.FieldBooleanValue, field.TypeBool, value)+ _node.BooleanValue = value+ }+ if value, ok := _c.mutation.TimeValue(); ok {+ _spec.SetField(templatefield.FieldTimeValue, field.TypeTime, value)+ _node.TimeValue = value+ }if nodes := _c.mutation.ItemTemplateIDs(); len(nodes) > 0 {edge := &sqlgraph.EdgeSpec{Rel: sqlgraph.M2O,diff --git a/backend/internal/data/ent/templatefield_update.go b/backend/internal/data/ent/templatefield_update.goindex 521659c0..acff9c09 100644--- a/backend/internal/data/ent/templatefield_update.go+++ b/backend/internal/data/ent/templatefield_update.go@@ -104,6 +104,61 @@ func (_u *TemplateFieldUpdate) ClearTextValue() *TemplateFieldUpdate {return _u}+// SetNumberValue sets the "number_value" field.+func (_u *TemplateFieldUpdate) SetNumberValue(v int) *TemplateFieldUpdate {+ _u.mutation.ResetNumberValue()+ _u.mutation.SetNumberValue(v)+ return _u+}++// SetNillableNumberValue sets the "number_value" field if the given value is not nil.+func (_u *TemplateFieldUpdate) SetNillableNumberValue(v *int) *TemplateFieldUpdate {+ if v != nil {+ _u.SetNumberValue(*v)+ }+ return _u+}++// AddNumberValue adds value to the "number_value" field.+func (_u *TemplateFieldUpdate) AddNumberValue(v int) *TemplateFieldUpdate {+ _u.mutation.AddNumberValue(v)+ return _u+}++// ClearNumberValue clears the value of the "number_value" field.+func (_u *TemplateFieldUpdate) ClearNumberValue() *TemplateFieldUpdate {+ _u.mutation.ClearNumberValue()+ return _u+}++// SetBooleanValue sets the "boolean_value" field.+func (_u *TemplateFieldUpdate) SetBooleanValue(v bool) *TemplateFieldUpdate {+ _u.mutation.SetBooleanValue(v)+ return _u+}++// SetNillableBooleanValue sets the "boolean_value" field if the given value is not nil.+func (_u *TemplateFieldUpdate) SetNillableBooleanValue(v *bool) *TemplateFieldUpdate {+ if v != nil {+ _u.SetBooleanValue(*v)+ }+ return _u+}++// SetTimeValue sets the "time_value" field.+func (_u *TemplateFieldUpdate) SetTimeValue(v time.Time) *TemplateFieldUpdate {+ _u.mutation.SetTimeValue(v)+ return _u+}++// SetNillableTimeValue sets the "time_value" field if the given value is not nil.+func (_u *TemplateFieldUpdate) SetNillableTimeValue(v *time.Time) *TemplateFieldUpdate {+ if v != nil {+ _u.SetTimeValue(*v)+ }+ return _u+}+// SetItemTemplateID sets the "item_template" edge to the ItemTemplate entity by ID.func (_u *TemplateFieldUpdate) SetItemTemplateID(id uuid.UUID) *TemplateFieldUpdate {_u.mutation.SetItemTemplateID(id)@@ -228,6 +283,21 @@ func (_u *TemplateFieldUpdate) sqlSave(ctx context.Context) (_node int, err erroif _u.mutation.TextValueCleared() {_spec.ClearField(templatefield.FieldTextValue, field.TypeString)}+ if value, ok := _u.mutation.NumberValue(); ok {+ _spec.SetField(templatefield.FieldNumberValue, field.TypeInt, value)+ }+ if value, ok := _u.mutation.AddedNumberValue(); ok {+ _spec.AddField(templatefield.FieldNumberValue, field.TypeInt, value)+ }+ if _u.mutation.NumberValueCleared() {+ _spec.ClearField(templatefield.FieldNumberValue, field.TypeInt)+ }+ if value, ok := _u.mutation.BooleanValue(); ok {+ _spec.SetField(templatefield.FieldBooleanValue, field.TypeBool, value)+ }+ if value, ok := _u.mutation.TimeValue(); ok {+ _spec.SetField(templatefield.FieldTimeValue, field.TypeTime, value)+ }if _u.mutation.ItemTemplateCleared() {edge := &sqlgraph.EdgeSpec{Rel: sqlgraph.M2O,@@ -351,6 +421,61 @@ func (_u *TemplateFieldUpdateOne) ClearTextValue() *TemplateFieldUpdateOne {return _u}+// SetNumberValue sets the "number_value" field.+func (_u *TemplateFieldUpdateOne) SetNumberValue(v int) *TemplateFieldUpdateOne {+ _u.mutation.ResetNumberValue()+ _u.mutation.SetNumberValue(v)+ return _u+}++// SetNillableNumberValue sets the "number_value" field if the given value is not nil.+func (_u *TemplateFieldUpdateOne) SetNillableNumberValue(v *int) *TemplateFieldUpdateOne {+ if v != nil {+ _u.SetNumberValue(*v)+ }+ return _u+}++// AddNumberValue adds value to the "number_value" field.+func (_u *TemplateFieldUpdateOne) AddNumberValue(v int) *TemplateFieldUpdateOne {+ _u.mutation.AddNumberValue(v)+ return _u+}++// ClearNumberValue clears the value of the "number_value" field.+func (_u *TemplateFieldUpdateOne) ClearNumberValue() *TemplateFieldUpdateOne {+ _u.mutation.ClearNumberValue()+ return _u+}++// SetBooleanValue sets the "boolean_value" field.+func (_u *TemplateFieldUpdateOne) SetBooleanValue(v bool) *TemplateFieldUpdateOne {+ _u.mutation.SetBooleanValue(v)+ return _u+}++// SetNillableBooleanValue sets the "boolean_value" field if the given value is not nil.+func (_u *TemplateFieldUpdateOne) SetNillableBooleanValue(v *bool) *TemplateFieldUpdateOne {+ if v != nil {+ _u.SetBooleanValue(*v)+ }+ return _u+}++// SetTimeValue sets the "time_value" field.+func (_u *TemplateFieldUpdateOne) SetTimeValue(v time.Time) *TemplateFieldUpdateOne {+ _u.mutation.SetTimeValue(v)+ return _u+}++// SetNillableTimeValue sets the "time_value" field if the given value is not nil.+func (_u *TemplateFieldUpdateOne) SetNillableTimeValue(v *time.Time) *TemplateFieldUpdateOne {+ if v != nil {+ _u.SetTimeValue(*v)+ }+ return _u+}+// SetItemTemplateID sets the "item_template" edge to the ItemTemplate entity by ID.func (_u *TemplateFieldUpdateOne) SetItemTemplateID(id uuid.UUID) *TemplateFieldUpdateOne {_u.mutation.SetItemTemplateID(id)@@ -505,6 +630,21 @@ func (_u *TemplateFieldUpdateOne) sqlSave(ctx context.Context) (_node *TemplateFif _u.mutation.TextValueCleared() {_spec.ClearField(templatefield.FieldTextValue, field.TypeString)}+ if value, ok := _u.mutation.NumberValue(); ok {+ _spec.SetField(templatefield.FieldNumberValue, field.TypeInt, value)+ }+ if value, ok := _u.mutation.AddedNumberValue(); ok {+ _spec.AddField(templatefield.FieldNumberValue, field.TypeInt, value)+ }+ if _u.mutation.NumberValueCleared() {+ _spec.ClearField(templatefield.FieldNumberValue, field.TypeInt)+ }+ if value, ok := _u.mutation.BooleanValue(); ok {+ _spec.SetField(templatefield.FieldBooleanValue, field.TypeBool, value)+ }+ if value, ok := _u.mutation.TimeValue(); ok {+ _spec.SetField(templatefield.FieldTimeValue, field.TypeTime, value)+ }if _u.mutation.ItemTemplateCleared() {edge := &sqlgraph.EdgeSpec{Rel: sqlgraph.M2O,diff --git a/backend/internal/data/migrations/postgres/20260211200601_template_custom_fields_types.sql b/backend/internal/data/migrations/postgres/20260211200601_template_custom_fields_types.sqlnew file mode 100644index 00000000..a0a71426--- /dev/null+++ b/backend/internal/data/migrations/postgres/20260211200601_template_custom_fields_types.sql@@ -0,0 +1,5 @@+-- +goose Up+-- +goose no transaction+ALTER TABLE template_fields ADD COLUMN number_value INTEGER;+ALTER TABLE template_fields ADD COLUMN boolean_value BOOLEAN DEFAULT FALSE;+ALTER TABLE template_fields ADD COLUMN time_value timestamp;\ No newline at end of filediff --git a/backend/internal/data/migrations/sqlite3/20260211200600_template_custom_fields_types.sql b/backend/internal/data/migrations/sqlite3/20260211200600_template_custom_fields_types.sqlnew file mode 100644index 00000000..96edb28b--- /dev/null+++ b/backend/internal/data/migrations/sqlite3/20260211200600_template_custom_fields_types.sql@@ -0,0 +1,5 @@+-- +goose Up+-- +goose no transaction+ALTER TABLE template_fields ADD COLUMN number_value INTEGER;+ALTER TABLE template_fields ADD COLUMN boolean_value BOOLEAN DEFAULT FALSE;+ALTER TABLE template_fields ADD COLUMN time_value DATETIME;\ No newline at end of filediff --git a/docs/public/api/openapi-3.0.json b/docs/public/api/openapi-3.0.jsonindex 2f694ac7..6cdb869e 100644--- a/docs/public/api/openapi-3.0.json+++ b/docs/public/api/openapi-3.0.json@@ -3912,6 +3912,10 @@"ent.TemplateField": {"type": "object","properties": {+ "boolean_value": {+ "description": "BooleanValue holds the value of the \"boolean_value\" field.",+ "type": "boolean"+ },"created_at": {"description": "CreatedAt holds the value of the \"created_at\" field.","type": "string"@@ -3936,10 +3940,18 @@"description": "Name holds the value of the \"name\" field.","type": "string"},+ "number_value": {+ "description": "NumberValue holds the value of the \"number_value\" field.",+ "type": "integer"+ },"text_value": {"description": "TextValue holds the value of the \"text_value\" field.","type": "string"},+ "time_value": {+ "description": "TimeValue holds the value of the \"time_value\" field.",+ "type": "string"+ },"type": {"description": "Type holds the value of the \"type\" field.","allOf": [@@ -5503,10 +5515,16 @@"templatefield.Type": {"type": "string","enum": [- "text"+ "text",+ "number",+ "boolean",+ "time"],"x-enum-varnames": [- "TypeText"+ "TypeText",+ "TypeNumber",+ "TypeBoolean",+ "TypeTime"]},"user.Role": {diff --git a/docs/public/api/openapi-3.0.yaml b/docs/public/api/openapi-3.0.yamlindex ff303844..079cac0d 100644--- a/docs/public/api/openapi-3.0.yaml+++ b/docs/public/api/openapi-3.0.yaml@@ -2423,6 +2423,9 @@ components:ent.TemplateField:type: objectproperties:+ boolean_value:+ description: BooleanValue holds the value of the "boolean_value" field.+ type: booleancreated_at:description: CreatedAt holds the value of the "created_at" field.type: string@@ -2442,9 +2445,15 @@ components:name:description: Name holds the value of the "name" field.type: string+ number_value:+ description: NumberValue holds the value of the "number_value" field.+ type: integertext_value:description: TextValue holds the value of the "text_value" field.type: string+ time_value:+ description: TimeValue holds the value of the "time_value" field.+ type: stringtype:description: Type holds the value of the "type" field.allOf:@@ -3509,8 +3518,14 @@ components:type: stringenum:- text+ - number+ - boolean+ - timex-enum-varnames:- TypeText+ - TypeNumber+ - TypeBoolean+ - TypeTimeuser.Role:type: stringenum:diff --git a/docs/public/api/swagger-2.0.json b/docs/public/api/swagger-2.0.jsonindex 8662b78e..2b64e355 100644--- a/docs/public/api/swagger-2.0.json+++ b/docs/public/api/swagger-2.0.json@@ -3713,6 +3713,10 @@"ent.TemplateField": {"type": "object","properties": {+ "boolean_value": {+ "description": "BooleanValue holds the value of the \"boolean_value\" field.",+ "type": "boolean"+ },"created_at": {"description": "CreatedAt holds the value of the \"created_at\" field.","type": "string"@@ -3737,10 +3741,18 @@"description": "Name holds the value of the \"name\" field.","type": "string"},+ "number_value": {+ "description": "NumberValue holds the value of the \"number_value\" field.",+ "type": "integer"+ },"text_value": {"description": "TextValue holds the value of the \"text_value\" field.","type": "string"},+ "time_value": {+ "description": "TimeValue holds the value of the \"time_value\" field.",+ "type": "string"+ },"type": {"description": "Type holds the value of the \"type\" field.","allOf": [@@ -5304,10 +5316,16 @@"templatefield.Type": {"type": "string","enum": [- "text"+ "text",+ "number",+ "boolean",+ "time"],"x-enum-varnames": [- "TypeText"+ "TypeText",+ "TypeNumber",+ "TypeBoolean",+ "TypeTime"]},"user.Role": {diff --git a/docs/public/api/swagger-2.0.yaml b/docs/public/api/swagger-2.0.yamlindex a340de23..e113de4f 100644--- a/docs/public/api/swagger-2.0.yaml+++ b/docs/public/api/swagger-2.0.yaml@@ -675,6 +675,9 @@ definitions:type: objectent.TemplateField:properties:+ boolean_value:+ description: BooleanValue holds the value of the "boolean_value" field.+ type: booleancreated_at:description: CreatedAt holds the value of the "created_at" field.type: string@@ -693,9 +696,15 @@ definitions:name:description: Name holds the value of the "name" field.type: string+ number_value:+ description: NumberValue holds the value of the "number_value" field.+ type: integertext_value:description: TextValue holds the value of the "text_value" field.type: string+ time_value:+ description: TimeValue holds the value of the "time_value" field.+ type: stringtype:allOf:- $ref: '#/definitions/templatefield.Type'@@ -1759,9 +1768,15 @@ definitions:templatefield.Type:enum:- text+ - number+ - boolean+ - timetype: stringx-enum-varnames:- TypeText+ - TypeNumber+ - TypeBoolean+ - TypeTimeuser.Role:enum:- userdiff --git a/frontend/lib/api/types/data-contracts.ts b/frontend/lib/api/types/data-contracts.tsindex 442f09fa..c64915eb 100644--- a/frontend/lib/api/types/data-contracts.ts+++ b/frontend/lib/api/types/data-contracts.ts@@ -19,6 +19,9 @@ export enum UserRole {export enum TemplatefieldType {TypeText = "text",+ TypeNumber = "number",+ TypeBoolean = "boolean",+ TypeTime = "time",}export enum MaintenanceFilterStatus {@@ -477,6 +480,8 @@ export interface EntTagEdges {}export interface EntTemplateField {+ /** BooleanValue holds the value of the "boolean_value" field. */+ boolean_value: boolean;/** CreatedAt holds the value of the "created_at" field. */created_at: string;/** Description holds the value of the "description" field. */@@ -490,8 +495,12 @@ export interface EntTemplateField {id: string;/** Name holds the value of the "name" field. */name: string;+ /** NumberValue holds the value of the "number_value" field. */+ number_value: number;/** TextValue holds the value of the "text_value" field. */text_value: string;+ /** TimeValue holds the value of the "time_value" field. */+ time_value: string;/** Type holds the value of the "type" field. */type: TemplatefieldType;/** UpdatedAt holds the value of the "updated_at" field. */