diff --git a/backend/internal/data/ent/attachment_create.go b/backend/internal/data/ent/attachment_create.go index 5ce7ef3..0c8e239 100644 --- a/backend/internal/data/ent/attachment_create.go +++ b/backend/internal/data/ent/attachment_create.go @@ -231,10 +231,7 @@ func (ac *AttachmentCreate) createSpec() (*Attachment, *sqlgraph.CreateSpec) { Columns: []string{attachment.ItemColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -251,10 +248,7 @@ func (ac *AttachmentCreate) createSpec() (*Attachment, *sqlgraph.CreateSpec) { Columns: []string{attachment.DocumentColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: document.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(document.FieldID, field.TypeUUID), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/attachment_update.go b/backend/internal/data/ent/attachment_update.go index e4b747d..7ee7117 100644 --- a/backend/internal/data/ent/attachment_update.go +++ b/backend/internal/data/ent/attachment_update.go @@ -168,10 +168,7 @@ func (au *AttachmentUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{attachment.ItemColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -184,10 +181,7 @@ func (au *AttachmentUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{attachment.ItemColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -203,10 +197,7 @@ func (au *AttachmentUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{attachment.DocumentColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: document.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(document.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -219,10 +210,7 @@ func (au *AttachmentUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{attachment.DocumentColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: document.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(document.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -417,10 +405,7 @@ func (auo *AttachmentUpdateOne) sqlSave(ctx context.Context) (_node *Attachment, Columns: []string{attachment.ItemColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -433,10 +418,7 @@ func (auo *AttachmentUpdateOne) sqlSave(ctx context.Context) (_node *Attachment, Columns: []string{attachment.ItemColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -452,10 +434,7 @@ func (auo *AttachmentUpdateOne) sqlSave(ctx context.Context) (_node *Attachment, Columns: []string{attachment.DocumentColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: document.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(document.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -468,10 +447,7 @@ func (auo *AttachmentUpdateOne) sqlSave(ctx context.Context) (_node *Attachment, Columns: []string{attachment.DocumentColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: document.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(document.FieldID, field.TypeUUID), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/authroles_create.go b/backend/internal/data/ent/authroles_create.go index 566d107..64e717c 100644 --- a/backend/internal/data/ent/authroles_create.go +++ b/backend/internal/data/ent/authroles_create.go @@ -143,10 +143,7 @@ func (arc *AuthRolesCreate) createSpec() (*AuthRoles, *sqlgraph.CreateSpec) { Columns: []string{authroles.TokenColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: authtokens.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(authtokens.FieldID, field.TypeUUID), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/authroles_update.go b/backend/internal/data/ent/authroles_update.go index ca222e4..9f16e35 100644 --- a/backend/internal/data/ent/authroles_update.go +++ b/backend/internal/data/ent/authroles_update.go @@ -133,10 +133,7 @@ func (aru *AuthRolesUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{authroles.TokenColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: authtokens.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(authtokens.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -149,10 +146,7 @@ func (aru *AuthRolesUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{authroles.TokenColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: authtokens.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(authtokens.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -314,10 +308,7 @@ func (aruo *AuthRolesUpdateOne) sqlSave(ctx context.Context) (_node *AuthRoles, Columns: []string{authroles.TokenColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: authtokens.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(authtokens.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -330,10 +321,7 @@ func (aruo *AuthRolesUpdateOne) sqlSave(ctx context.Context) (_node *AuthRoles, Columns: []string{authroles.TokenColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: authtokens.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(authtokens.FieldID, field.TypeUUID), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/authtokens_create.go b/backend/internal/data/ent/authtokens_create.go index a8f2971..8ef18d6 100644 --- a/backend/internal/data/ent/authtokens_create.go +++ b/backend/internal/data/ent/authtokens_create.go @@ -249,10 +249,7 @@ func (atc *AuthTokensCreate) createSpec() (*AuthTokens, *sqlgraph.CreateSpec) { Columns: []string{authtokens.UserColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: user.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -269,10 +266,7 @@ func (atc *AuthTokensCreate) createSpec() (*AuthTokens, *sqlgraph.CreateSpec) { Columns: []string{authtokens.RolesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: authroles.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(authroles.FieldID, field.TypeInt), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/authtokens_update.go b/backend/internal/data/ent/authtokens_update.go index 11f34db..2ed3e83 100644 --- a/backend/internal/data/ent/authtokens_update.go +++ b/backend/internal/data/ent/authtokens_update.go @@ -174,10 +174,7 @@ func (atu *AuthTokensUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{authtokens.UserColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: user.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -190,10 +187,7 @@ func (atu *AuthTokensUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{authtokens.UserColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: user.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -209,10 +203,7 @@ func (atu *AuthTokensUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{authtokens.RolesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: authroles.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(authroles.FieldID, field.TypeInt), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -225,10 +216,7 @@ func (atu *AuthTokensUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{authtokens.RolesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: authroles.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(authroles.FieldID, field.TypeInt), }, } for _, k := range nodes { @@ -429,10 +417,7 @@ func (atuo *AuthTokensUpdateOne) sqlSave(ctx context.Context) (_node *AuthTokens Columns: []string{authtokens.UserColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: user.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -445,10 +430,7 @@ func (atuo *AuthTokensUpdateOne) sqlSave(ctx context.Context) (_node *AuthTokens Columns: []string{authtokens.UserColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: user.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -464,10 +446,7 @@ func (atuo *AuthTokensUpdateOne) sqlSave(ctx context.Context) (_node *AuthTokens Columns: []string{authtokens.RolesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: authroles.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(authroles.FieldID, field.TypeInt), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -480,10 +459,7 @@ func (atuo *AuthTokensUpdateOne) sqlSave(ctx context.Context) (_node *AuthTokens Columns: []string{authtokens.RolesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: authroles.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(authroles.FieldID, field.TypeInt), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/client.go b/backend/internal/data/ent/client.go index 4c5843b..6b4fbe3 100644 --- a/backend/internal/data/ent/client.go +++ b/backend/internal/data/ent/client.go @@ -11,6 +11,10 @@ import ( "github.com/google/uuid" "github.com/hay-kot/homebox/backend/internal/data/ent/migrate" + "entgo.io/ent" + "entgo.io/ent/dialect" + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" "github.com/hay-kot/homebox/backend/internal/data/ent/attachment" "github.com/hay-kot/homebox/backend/internal/data/ent/authroles" "github.com/hay-kot/homebox/backend/internal/data/ent/authtokens" @@ -24,10 +28,6 @@ import ( "github.com/hay-kot/homebox/backend/internal/data/ent/maintenanceentry" "github.com/hay-kot/homebox/backend/internal/data/ent/notifier" "github.com/hay-kot/homebox/backend/internal/data/ent/user" - - "entgo.io/ent/dialect" - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" ) // Client is the client that holds all ent builders. @@ -89,6 +89,55 @@ func (c *Client) init() { c.User = NewUserClient(c.config) } +type ( + // config is the configuration for the client and its builder. + config struct { + // driver used for executing database requests. + driver dialect.Driver + // debug enable a debug logging. + debug bool + // log used for logging on debug mode. + log func(...any) + // hooks to execute on mutations. + hooks *hooks + // interceptors to execute on queries. + inters *inters + } + // Option function to configure the client. + Option func(*config) +) + +// options applies the options on the config object. +func (c *config) options(opts ...Option) { + for _, opt := range opts { + opt(c) + } + if c.debug { + c.driver = dialect.Debug(c.driver, c.log) + } +} + +// Debug enables debug logging on the ent.Driver. +func Debug() Option { + return func(c *config) { + c.debug = true + } +} + +// Log sets the logging function for debug mode. +func Log(fn func(...any)) Option { + return func(c *config) { + c.log = fn + } +} + +// Driver configures the client driver. +func Driver(driver dialect.Driver) Option { + return func(c *config) { + c.driver = driver + } +} + // Open opens a database/sql.DB specified by the driver name and // the data source name, and returns a new client attached to it. // Optional parameters can be added for configuring the client. @@ -193,37 +242,25 @@ func (c *Client) Close() error { // Use adds the mutation hooks to all the entity clients. // In order to add hooks to a specific client, call: `client.Node.Use(...)`. func (c *Client) Use(hooks ...Hook) { - c.Attachment.Use(hooks...) - c.AuthRoles.Use(hooks...) - c.AuthTokens.Use(hooks...) - c.Document.Use(hooks...) - c.Group.Use(hooks...) - c.GroupInvitationToken.Use(hooks...) - c.Item.Use(hooks...) - c.ItemField.Use(hooks...) - c.Label.Use(hooks...) - c.Location.Use(hooks...) - c.MaintenanceEntry.Use(hooks...) - c.Notifier.Use(hooks...) - c.User.Use(hooks...) + for _, n := range []interface{ Use(...Hook) }{ + c.Attachment, c.AuthRoles, c.AuthTokens, c.Document, c.Group, + c.GroupInvitationToken, c.Item, c.ItemField, c.Label, c.Location, + c.MaintenanceEntry, c.Notifier, c.User, + } { + n.Use(hooks...) + } } // Intercept adds the query interceptors to all the entity clients. // In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`. func (c *Client) Intercept(interceptors ...Interceptor) { - c.Attachment.Intercept(interceptors...) - c.AuthRoles.Intercept(interceptors...) - c.AuthTokens.Intercept(interceptors...) - c.Document.Intercept(interceptors...) - c.Group.Intercept(interceptors...) - c.GroupInvitationToken.Intercept(interceptors...) - c.Item.Intercept(interceptors...) - c.ItemField.Intercept(interceptors...) - c.Label.Intercept(interceptors...) - c.Location.Intercept(interceptors...) - c.MaintenanceEntry.Intercept(interceptors...) - c.Notifier.Intercept(interceptors...) - c.User.Intercept(interceptors...) + for _, n := range []interface{ Intercept(...Interceptor) }{ + c.Attachment, c.AuthRoles, c.AuthTokens, c.Document, c.Group, + c.GroupInvitationToken, c.Item, c.ItemField, c.Label, c.Location, + c.MaintenanceEntry, c.Notifier, c.User, + } { + n.Intercept(interceptors...) + } } // Mutate implements the ent.Mutator interface. @@ -2369,3 +2406,15 @@ func (c *UserClient) mutate(ctx context.Context, m *UserMutation) (Value, error) return nil, fmt.Errorf("ent: unknown User mutation op: %q", m.Op()) } } + +// hooks and interceptors per client, for fast access. +type ( + hooks struct { + Attachment, AuthRoles, AuthTokens, Document, Group, GroupInvitationToken, Item, + ItemField, Label, Location, MaintenanceEntry, Notifier, User []ent.Hook + } + inters struct { + Attachment, AuthRoles, AuthTokens, Document, Group, GroupInvitationToken, Item, + ItemField, Label, Location, MaintenanceEntry, Notifier, User []ent.Interceptor + } +) diff --git a/backend/internal/data/ent/config.go b/backend/internal/data/ent/config.go deleted file mode 100644 index afb648b..0000000 --- a/backend/internal/data/ent/config.go +++ /dev/null @@ -1,90 +0,0 @@ -// Code generated by ent, DO NOT EDIT. - -package ent - -import ( - "entgo.io/ent" - "entgo.io/ent/dialect" -) - -// Option function to configure the client. -type Option func(*config) - -// Config is the configuration for the client and its builder. -type config struct { - // driver used for executing database requests. - driver dialect.Driver - // debug enable a debug logging. - debug bool - // log used for logging on debug mode. - log func(...any) - // hooks to execute on mutations. - hooks *hooks - // interceptors to execute on queries. - inters *inters -} - -// hooks and interceptors per client, for fast access. -type ( - hooks struct { - Attachment []ent.Hook - AuthRoles []ent.Hook - AuthTokens []ent.Hook - Document []ent.Hook - Group []ent.Hook - GroupInvitationToken []ent.Hook - Item []ent.Hook - ItemField []ent.Hook - Label []ent.Hook - Location []ent.Hook - MaintenanceEntry []ent.Hook - Notifier []ent.Hook - User []ent.Hook - } - inters struct { - Attachment []ent.Interceptor - AuthRoles []ent.Interceptor - AuthTokens []ent.Interceptor - Document []ent.Interceptor - Group []ent.Interceptor - GroupInvitationToken []ent.Interceptor - Item []ent.Interceptor - ItemField []ent.Interceptor - Label []ent.Interceptor - Location []ent.Interceptor - MaintenanceEntry []ent.Interceptor - Notifier []ent.Interceptor - User []ent.Interceptor - } -) - -// Options applies the options on the config object. -func (c *config) options(opts ...Option) { - for _, opt := range opts { - opt(c) - } - if c.debug { - c.driver = dialect.Debug(c.driver, c.log) - } -} - -// Debug enables debug logging on the ent.Driver. -func Debug() Option { - return func(c *config) { - c.debug = true - } -} - -// Log sets the logging function for debug mode. -func Log(fn func(...any)) Option { - return func(c *config) { - c.log = fn - } -} - -// Driver configures the client driver. -func Driver(driver dialect.Driver) Option { - return func(c *config) { - c.driver = driver - } -} diff --git a/backend/internal/data/ent/context.go b/backend/internal/data/ent/context.go deleted file mode 100644 index 7811bfa..0000000 --- a/backend/internal/data/ent/context.go +++ /dev/null @@ -1,33 +0,0 @@ -// Code generated by ent, DO NOT EDIT. - -package ent - -import ( - "context" -) - -type clientCtxKey struct{} - -// FromContext returns a Client stored inside a context, or nil if there isn't one. -func FromContext(ctx context.Context) *Client { - c, _ := ctx.Value(clientCtxKey{}).(*Client) - return c -} - -// NewContext returns a new context with the given Client attached. -func NewContext(parent context.Context, c *Client) context.Context { - return context.WithValue(parent, clientCtxKey{}, c) -} - -type txCtxKey struct{} - -// TxFromContext returns a Tx stored inside a context, or nil if there isn't one. -func TxFromContext(ctx context.Context) *Tx { - tx, _ := ctx.Value(txCtxKey{}).(*Tx) - return tx -} - -// NewTxContext returns a new context with the given Tx attached. -func NewTxContext(parent context.Context, tx *Tx) context.Context { - return context.WithValue(parent, txCtxKey{}, tx) -} diff --git a/backend/internal/data/ent/document_create.go b/backend/internal/data/ent/document_create.go index eabfc0f..efda81f 100644 --- a/backend/internal/data/ent/document_create.go +++ b/backend/internal/data/ent/document_create.go @@ -238,10 +238,7 @@ func (dc *DocumentCreate) createSpec() (*Document, *sqlgraph.CreateSpec) { Columns: []string{document.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -258,10 +255,7 @@ func (dc *DocumentCreate) createSpec() (*Document, *sqlgraph.CreateSpec) { Columns: []string{document.AttachmentsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: attachment.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/document_update.go b/backend/internal/data/ent/document_update.go index a172e5f..0d4a028 100644 --- a/backend/internal/data/ent/document_update.go +++ b/backend/internal/data/ent/document_update.go @@ -190,10 +190,7 @@ func (du *DocumentUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{document.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -206,10 +203,7 @@ func (du *DocumentUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{document.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -225,10 +219,7 @@ func (du *DocumentUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{document.AttachmentsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: attachment.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -241,10 +232,7 @@ func (du *DocumentUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{document.AttachmentsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: attachment.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -260,10 +248,7 @@ func (du *DocumentUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{document.AttachmentsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: attachment.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -480,10 +465,7 @@ func (duo *DocumentUpdateOne) sqlSave(ctx context.Context) (_node *Document, err Columns: []string{document.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -496,10 +478,7 @@ func (duo *DocumentUpdateOne) sqlSave(ctx context.Context) (_node *Document, err Columns: []string{document.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -515,10 +494,7 @@ func (duo *DocumentUpdateOne) sqlSave(ctx context.Context) (_node *Document, err Columns: []string{document.AttachmentsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: attachment.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -531,10 +507,7 @@ func (duo *DocumentUpdateOne) sqlSave(ctx context.Context) (_node *Document, err Columns: []string{document.AttachmentsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: attachment.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -550,10 +523,7 @@ func (duo *DocumentUpdateOne) sqlSave(ctx context.Context) (_node *Document, err Columns: []string{document.AttachmentsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: attachment.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/ent.go b/backend/internal/data/ent/ent.go index 6963add..ba8d451 100644 --- a/backend/internal/data/ent/ent.go +++ b/backend/internal/data/ent/ent.go @@ -45,6 +45,32 @@ type ( MutateFunc = ent.MutateFunc ) +type clientCtxKey struct{} + +// FromContext returns a Client stored inside a context, or nil if there isn't one. +func FromContext(ctx context.Context) *Client { + c, _ := ctx.Value(clientCtxKey{}).(*Client) + return c +} + +// NewContext returns a new context with the given Client attached. +func NewContext(parent context.Context, c *Client) context.Context { + return context.WithValue(parent, clientCtxKey{}, c) +} + +type txCtxKey struct{} + +// TxFromContext returns a Tx stored inside a context, or nil if there isn't one. +func TxFromContext(ctx context.Context) *Tx { + tx, _ := ctx.Value(txCtxKey{}).(*Tx) + return tx +} + +// NewTxContext returns a new context with the given Tx attached. +func NewTxContext(parent context.Context, tx *Tx) context.Context { + return context.WithValue(parent, txCtxKey{}, tx) +} + // OrderFunc applies an ordering on the sql selector. type OrderFunc func(*sql.Selector) @@ -503,7 +529,7 @@ func withHooks[V Value, M any, PM interface { return exec(ctx) } var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutationT, ok := m.(PM) + mutationT, ok := any(m).(PM) if !ok { return nil, fmt.Errorf("unexpected mutation type %T", m) } diff --git a/backend/internal/data/ent/group_create.go b/backend/internal/data/ent/group_create.go index 98d2726..f10f2c7 100644 --- a/backend/internal/data/ent/group_create.go +++ b/backend/internal/data/ent/group_create.go @@ -331,10 +331,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { Columns: []string{group.UsersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: user.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -350,10 +347,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { Columns: []string{group.LocationsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -369,10 +363,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { Columns: []string{group.ItemsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -388,10 +379,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { Columns: []string{group.LabelsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: label.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -407,10 +395,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { Columns: []string{group.DocumentsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: document.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(document.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -426,10 +411,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { Columns: []string{group.InvitationTokensColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: groupinvitationtoken.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(groupinvitationtoken.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -445,10 +427,7 @@ func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { Columns: []string{group.NotifiersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: notifier.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(notifier.FieldID, field.TypeUUID), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/group_update.go b/backend/internal/data/ent/group_update.go index bd496c0..7e22cb2 100644 --- a/backend/internal/data/ent/group_update.go +++ b/backend/internal/data/ent/group_update.go @@ -399,10 +399,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{group.UsersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: user.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -415,10 +412,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{group.UsersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: user.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -434,10 +428,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{group.UsersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: user.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -453,10 +444,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{group.LocationsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -469,10 +457,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{group.LocationsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -488,10 +473,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{group.LocationsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -507,10 +489,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{group.ItemsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -523,10 +502,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{group.ItemsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -542,10 +518,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{group.ItemsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -561,10 +534,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{group.LabelsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: label.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -577,10 +547,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{group.LabelsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: label.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -596,10 +563,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{group.LabelsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: label.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -615,10 +579,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{group.DocumentsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: document.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(document.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -631,10 +592,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{group.DocumentsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: document.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(document.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -650,10 +608,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{group.DocumentsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: document.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(document.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -669,10 +624,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{group.InvitationTokensColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: groupinvitationtoken.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(groupinvitationtoken.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -685,10 +637,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{group.InvitationTokensColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: groupinvitationtoken.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(groupinvitationtoken.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -704,10 +653,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{group.InvitationTokensColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: groupinvitationtoken.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(groupinvitationtoken.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -723,10 +669,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{group.NotifiersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: notifier.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(notifier.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -739,10 +682,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{group.NotifiersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: notifier.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(notifier.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -758,10 +698,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{group.NotifiersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: notifier.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(notifier.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1182,10 +1119,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error Columns: []string{group.UsersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: user.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -1198,10 +1132,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error Columns: []string{group.UsersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: user.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1217,10 +1148,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error Columns: []string{group.UsersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: user.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1236,10 +1164,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error Columns: []string{group.LocationsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -1252,10 +1177,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error Columns: []string{group.LocationsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1271,10 +1193,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error Columns: []string{group.LocationsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1290,10 +1209,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error Columns: []string{group.ItemsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -1306,10 +1222,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error Columns: []string{group.ItemsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1325,10 +1238,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error Columns: []string{group.ItemsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1344,10 +1254,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error Columns: []string{group.LabelsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: label.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -1360,10 +1267,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error Columns: []string{group.LabelsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: label.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1379,10 +1283,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error Columns: []string{group.LabelsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: label.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1398,10 +1299,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error Columns: []string{group.DocumentsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: document.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(document.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -1414,10 +1312,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error Columns: []string{group.DocumentsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: document.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(document.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1433,10 +1328,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error Columns: []string{group.DocumentsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: document.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(document.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1452,10 +1344,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error Columns: []string{group.InvitationTokensColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: groupinvitationtoken.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(groupinvitationtoken.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -1468,10 +1357,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error Columns: []string{group.InvitationTokensColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: groupinvitationtoken.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(groupinvitationtoken.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1487,10 +1373,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error Columns: []string{group.InvitationTokensColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: groupinvitationtoken.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(groupinvitationtoken.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1506,10 +1389,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error Columns: []string{group.NotifiersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: notifier.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(notifier.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -1522,10 +1402,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error Columns: []string{group.NotifiersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: notifier.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(notifier.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1541,10 +1418,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error Columns: []string{group.NotifiersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: notifier.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(notifier.FieldID, field.TypeUUID), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/groupinvitationtoken_create.go b/backend/internal/data/ent/groupinvitationtoken_create.go index e45fb27..e478ace 100644 --- a/backend/internal/data/ent/groupinvitationtoken_create.go +++ b/backend/internal/data/ent/groupinvitationtoken_create.go @@ -254,10 +254,7 @@ func (gitc *GroupInvitationTokenCreate) createSpec() (*GroupInvitationToken, *sq Columns: []string{groupinvitationtoken.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/groupinvitationtoken_update.go b/backend/internal/data/ent/groupinvitationtoken_update.go index 7a4caaa..73d6b5c 100644 --- a/backend/internal/data/ent/groupinvitationtoken_update.go +++ b/backend/internal/data/ent/groupinvitationtoken_update.go @@ -175,10 +175,7 @@ func (gitu *GroupInvitationTokenUpdate) sqlSave(ctx context.Context) (n int, err Columns: []string{groupinvitationtoken.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -191,10 +188,7 @@ func (gitu *GroupInvitationTokenUpdate) sqlSave(ctx context.Context) (n int, err Columns: []string{groupinvitationtoken.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -397,10 +391,7 @@ func (gituo *GroupInvitationTokenUpdateOne) sqlSave(ctx context.Context) (_node Columns: []string{groupinvitationtoken.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -413,10 +404,7 @@ func (gituo *GroupInvitationTokenUpdateOne) sqlSave(ctx context.Context) (_node Columns: []string{groupinvitationtoken.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/item_create.go b/backend/internal/data/ent/item_create.go index f7a3fb9..34dfa58 100644 --- a/backend/internal/data/ent/item_create.go +++ b/backend/internal/data/ent/item_create.go @@ -771,10 +771,7 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) { Columns: []string{item.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -791,10 +788,7 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) { Columns: []string{item.ParentColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -811,10 +805,7 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) { Columns: []string{item.ChildrenColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -830,10 +821,7 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) { Columns: item.LabelPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: label.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -849,10 +837,7 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) { Columns: []string{item.LocationColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -869,10 +854,7 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) { Columns: []string{item.FieldsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: itemfield.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(itemfield.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -888,10 +870,7 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) { Columns: []string{item.MaintenanceEntriesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: maintenanceentry.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(maintenanceentry.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -907,10 +886,7 @@ func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) { Columns: []string{item.AttachmentsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: attachment.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/item_update.go b/backend/internal/data/ent/item_update.go index 77d0b67..03932bf 100644 --- a/backend/internal/data/ent/item_update.go +++ b/backend/internal/data/ent/item_update.go @@ -911,10 +911,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{item.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -927,10 +924,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{item.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -946,10 +940,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{item.ParentColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -962,10 +953,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{item.ParentColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -981,10 +969,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{item.ChildrenColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -997,10 +982,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{item.ChildrenColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1016,10 +998,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{item.ChildrenColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1035,10 +1014,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: item.LabelPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: label.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -1051,10 +1027,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: item.LabelPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: label.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1070,10 +1043,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: item.LabelPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: label.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1089,10 +1059,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{item.LocationColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -1105,10 +1072,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{item.LocationColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1124,10 +1088,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{item.FieldsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: itemfield.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(itemfield.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -1140,10 +1101,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{item.FieldsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: itemfield.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(itemfield.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1159,10 +1117,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{item.FieldsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: itemfield.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(itemfield.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1178,10 +1133,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{item.MaintenanceEntriesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: maintenanceentry.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(maintenanceentry.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -1194,10 +1146,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{item.MaintenanceEntriesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: maintenanceentry.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(maintenanceentry.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1213,10 +1162,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{item.MaintenanceEntriesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: maintenanceentry.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(maintenanceentry.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1232,10 +1178,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{item.AttachmentsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: attachment.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -1248,10 +1191,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{item.AttachmentsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: attachment.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -1267,10 +1207,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{item.AttachmentsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: attachment.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -2204,10 +2141,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) Columns: []string{item.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -2220,10 +2154,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) Columns: []string{item.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -2239,10 +2170,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) Columns: []string{item.ParentColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -2255,10 +2183,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) Columns: []string{item.ParentColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -2274,10 +2199,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) Columns: []string{item.ChildrenColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -2290,10 +2212,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) Columns: []string{item.ChildrenColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -2309,10 +2228,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) Columns: []string{item.ChildrenColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -2328,10 +2244,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) Columns: item.LabelPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: label.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -2344,10 +2257,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) Columns: item.LabelPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: label.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -2363,10 +2273,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) Columns: item.LabelPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: label.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -2382,10 +2289,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) Columns: []string{item.LocationColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -2398,10 +2302,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) Columns: []string{item.LocationColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -2417,10 +2318,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) Columns: []string{item.FieldsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: itemfield.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(itemfield.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -2433,10 +2331,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) Columns: []string{item.FieldsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: itemfield.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(itemfield.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -2452,10 +2347,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) Columns: []string{item.FieldsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: itemfield.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(itemfield.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -2471,10 +2363,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) Columns: []string{item.MaintenanceEntriesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: maintenanceentry.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(maintenanceentry.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -2487,10 +2376,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) Columns: []string{item.MaintenanceEntriesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: maintenanceentry.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(maintenanceentry.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -2506,10 +2392,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) Columns: []string{item.MaintenanceEntriesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: maintenanceentry.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(maintenanceentry.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -2525,10 +2408,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) Columns: []string{item.AttachmentsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: attachment.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -2541,10 +2421,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) Columns: []string{item.AttachmentsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: attachment.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -2560,10 +2437,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) Columns: []string{item.AttachmentsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: attachment.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/itemfield_create.go b/backend/internal/data/ent/itemfield_create.go index c124c0e..19e49a2 100644 --- a/backend/internal/data/ent/itemfield_create.go +++ b/backend/internal/data/ent/itemfield_create.go @@ -341,10 +341,7 @@ func (ifc *ItemFieldCreate) createSpec() (*ItemField, *sqlgraph.CreateSpec) { Columns: []string{itemfield.ItemColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/itemfield_update.go b/backend/internal/data/ent/itemfield_update.go index b7ff379..83e956f 100644 --- a/backend/internal/data/ent/itemfield_update.go +++ b/backend/internal/data/ent/itemfield_update.go @@ -290,10 +290,7 @@ func (ifu *ItemFieldUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{itemfield.ItemColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -306,10 +303,7 @@ func (ifu *ItemFieldUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{itemfield.ItemColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -627,10 +621,7 @@ func (ifuo *ItemFieldUpdateOne) sqlSave(ctx context.Context) (_node *ItemField, Columns: []string{itemfield.ItemColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -643,10 +634,7 @@ func (ifuo *ItemFieldUpdateOne) sqlSave(ctx context.Context) (_node *ItemField, Columns: []string{itemfield.ItemColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/label_create.go b/backend/internal/data/ent/label_create.go index 8df2903..9a2c85f 100644 --- a/backend/internal/data/ent/label_create.go +++ b/backend/internal/data/ent/label_create.go @@ -266,10 +266,7 @@ func (lc *LabelCreate) createSpec() (*Label, *sqlgraph.CreateSpec) { Columns: []string{label.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -286,10 +283,7 @@ func (lc *LabelCreate) createSpec() (*Label, *sqlgraph.CreateSpec) { Columns: label.ItemsPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/label_update.go b/backend/internal/data/ent/label_update.go index 57464ff..303e2e8 100644 --- a/backend/internal/data/ent/label_update.go +++ b/backend/internal/data/ent/label_update.go @@ -238,10 +238,7 @@ func (lu *LabelUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{label.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -254,10 +251,7 @@ func (lu *LabelUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{label.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -273,10 +267,7 @@ func (lu *LabelUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: label.ItemsPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -289,10 +280,7 @@ func (lu *LabelUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: label.ItemsPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -308,10 +296,7 @@ func (lu *LabelUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: label.ItemsPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -576,10 +561,7 @@ func (luo *LabelUpdateOne) sqlSave(ctx context.Context) (_node *Label, err error Columns: []string{label.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -592,10 +574,7 @@ func (luo *LabelUpdateOne) sqlSave(ctx context.Context) (_node *Label, err error Columns: []string{label.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -611,10 +590,7 @@ func (luo *LabelUpdateOne) sqlSave(ctx context.Context) (_node *Label, err error Columns: label.ItemsPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -627,10 +603,7 @@ func (luo *LabelUpdateOne) sqlSave(ctx context.Context) (_node *Label, err error Columns: label.ItemsPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -646,10 +619,7 @@ func (luo *LabelUpdateOne) sqlSave(ctx context.Context) (_node *Label, err error Columns: label.ItemsPrimaryKey, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/location_create.go b/backend/internal/data/ent/location_create.go index 8f7fd76..5da1e10 100644 --- a/backend/internal/data/ent/location_create.go +++ b/backend/internal/data/ent/location_create.go @@ -277,10 +277,7 @@ func (lc *LocationCreate) createSpec() (*Location, *sqlgraph.CreateSpec) { Columns: []string{location.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -297,10 +294,7 @@ func (lc *LocationCreate) createSpec() (*Location, *sqlgraph.CreateSpec) { Columns: []string{location.ParentColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -317,10 +311,7 @@ func (lc *LocationCreate) createSpec() (*Location, *sqlgraph.CreateSpec) { Columns: []string{location.ChildrenColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -336,10 +327,7 @@ func (lc *LocationCreate) createSpec() (*Location, *sqlgraph.CreateSpec) { Columns: []string{location.ItemsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/location_update.go b/backend/internal/data/ent/location_update.go index effe5d1..d5de7f7 100644 --- a/backend/internal/data/ent/location_update.go +++ b/backend/internal/data/ent/location_update.go @@ -268,10 +268,7 @@ func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{location.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -284,10 +281,7 @@ func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{location.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -303,10 +297,7 @@ func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{location.ParentColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -319,10 +310,7 @@ func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{location.ParentColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -338,10 +326,7 @@ func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{location.ChildrenColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -354,10 +339,7 @@ func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{location.ChildrenColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -373,10 +355,7 @@ func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{location.ChildrenColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -392,10 +371,7 @@ func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{location.ItemsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -408,10 +384,7 @@ func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{location.ItemsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -427,10 +400,7 @@ func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{location.ItemsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -725,10 +695,7 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err Columns: []string{location.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -741,10 +708,7 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err Columns: []string{location.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -760,10 +724,7 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err Columns: []string{location.ParentColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -776,10 +737,7 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err Columns: []string{location.ParentColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -795,10 +753,7 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err Columns: []string{location.ChildrenColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -811,10 +766,7 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err Columns: []string{location.ChildrenColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -830,10 +782,7 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err Columns: []string{location.ChildrenColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -849,10 +798,7 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err Columns: []string{location.ItemsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -865,10 +811,7 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err Columns: []string{location.ItemsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -884,10 +827,7 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err Columns: []string{location.ItemsColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/maintenanceentry.go b/backend/internal/data/ent/maintenanceentry.go index 98301c8..790f456 100644 --- a/backend/internal/data/ent/maintenanceentry.go +++ b/backend/internal/data/ent/maintenanceentry.go @@ -34,6 +34,8 @@ type MaintenanceEntry struct { Description string `json:"description,omitempty"` // Cost holds the value of the "cost" field. Cost float64 `json:"cost,omitempty"` + // RemindersEnabled holds the value of the "reminders_enabled" field. + RemindersEnabled bool `json:"reminders_enabled,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the MaintenanceEntryQuery when eager-loading is set. Edges MaintenanceEntryEdges `json:"edges"` @@ -66,6 +68,8 @@ func (*MaintenanceEntry) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { + case maintenanceentry.FieldRemindersEnabled: + values[i] = new(sql.NullBool) case maintenanceentry.FieldCost: values[i] = new(sql.NullFloat64) case maintenanceentry.FieldName, maintenanceentry.FieldDescription: @@ -143,6 +147,12 @@ func (me *MaintenanceEntry) assignValues(columns []string, values []any) error { } else if value.Valid { me.Cost = value.Float64 } + case maintenanceentry.FieldRemindersEnabled: + if value, ok := values[i].(*sql.NullBool); !ok { + return fmt.Errorf("unexpected type %T for field reminders_enabled", values[i]) + } else if value.Valid { + me.RemindersEnabled = value.Bool + } } } return nil @@ -199,6 +209,9 @@ func (me *MaintenanceEntry) String() string { builder.WriteString(", ") builder.WriteString("cost=") builder.WriteString(fmt.Sprintf("%v", me.Cost)) + builder.WriteString(", ") + builder.WriteString("reminders_enabled=") + builder.WriteString(fmt.Sprintf("%v", me.RemindersEnabled)) builder.WriteByte(')') return builder.String() } diff --git a/backend/internal/data/ent/maintenanceentry/maintenanceentry.go b/backend/internal/data/ent/maintenanceentry/maintenanceentry.go index 690a696..95a4bac 100644 --- a/backend/internal/data/ent/maintenanceentry/maintenanceentry.go +++ b/backend/internal/data/ent/maintenanceentry/maintenanceentry.go @@ -29,6 +29,8 @@ const ( FieldDescription = "description" // FieldCost holds the string denoting the cost field in the database. FieldCost = "cost" + // FieldRemindersEnabled holds the string denoting the reminders_enabled field in the database. + FieldRemindersEnabled = "reminders_enabled" // EdgeItem holds the string denoting the item edge name in mutations. EdgeItem = "item" // Table holds the table name of the maintenanceentry in the database. @@ -53,6 +55,7 @@ var Columns = []string{ FieldName, FieldDescription, FieldCost, + FieldRemindersEnabled, } // ValidColumn reports if the column name is valid (part of the table columns). @@ -78,6 +81,8 @@ var ( DescriptionValidator func(string) error // DefaultCost holds the default value on creation for the "cost" field. DefaultCost float64 + // DefaultRemindersEnabled holds the default value on creation for the "reminders_enabled" field. + DefaultRemindersEnabled bool // DefaultID holds the default value on creation for the "id" field. DefaultID func() uuid.UUID ) diff --git a/backend/internal/data/ent/maintenanceentry/where.go b/backend/internal/data/ent/maintenanceentry/where.go index 798ce63..62d32af 100644 --- a/backend/internal/data/ent/maintenanceentry/where.go +++ b/backend/internal/data/ent/maintenanceentry/where.go @@ -96,6 +96,11 @@ func Cost(v float64) predicate.MaintenanceEntry { return predicate.MaintenanceEntry(sql.FieldEQ(FieldCost, v)) } +// RemindersEnabled applies equality check predicate on the "reminders_enabled" field. It's identical to RemindersEnabledEQ. +func RemindersEnabled(v bool) predicate.MaintenanceEntry { + return predicate.MaintenanceEntry(sql.FieldEQ(FieldRemindersEnabled, v)) +} + // CreatedAtEQ applies the EQ predicate on the "created_at" field. func CreatedAtEQ(v time.Time) predicate.MaintenanceEntry { return predicate.MaintenanceEntry(sql.FieldEQ(FieldCreatedAt, v)) @@ -476,6 +481,16 @@ func CostLTE(v float64) predicate.MaintenanceEntry { return predicate.MaintenanceEntry(sql.FieldLTE(FieldCost, v)) } +// RemindersEnabledEQ applies the EQ predicate on the "reminders_enabled" field. +func RemindersEnabledEQ(v bool) predicate.MaintenanceEntry { + return predicate.MaintenanceEntry(sql.FieldEQ(FieldRemindersEnabled, v)) +} + +// RemindersEnabledNEQ applies the NEQ predicate on the "reminders_enabled" field. +func RemindersEnabledNEQ(v bool) predicate.MaintenanceEntry { + return predicate.MaintenanceEntry(sql.FieldNEQ(FieldRemindersEnabled, v)) +} + // HasItem applies the HasEdge predicate on the "item" edge. func HasItem() predicate.MaintenanceEntry { return predicate.MaintenanceEntry(func(s *sql.Selector) { diff --git a/backend/internal/data/ent/maintenanceentry_create.go b/backend/internal/data/ent/maintenanceentry_create.go index d06195e..4b2e052 100644 --- a/backend/internal/data/ent/maintenanceentry_create.go +++ b/backend/internal/data/ent/maintenanceentry_create.go @@ -118,6 +118,20 @@ func (mec *MaintenanceEntryCreate) SetNillableCost(f *float64) *MaintenanceEntry return mec } +// SetRemindersEnabled sets the "reminders_enabled" field. +func (mec *MaintenanceEntryCreate) SetRemindersEnabled(b bool) *MaintenanceEntryCreate { + mec.mutation.SetRemindersEnabled(b) + return mec +} + +// SetNillableRemindersEnabled sets the "reminders_enabled" field if the given value is not nil. +func (mec *MaintenanceEntryCreate) SetNillableRemindersEnabled(b *bool) *MaintenanceEntryCreate { + if b != nil { + mec.SetRemindersEnabled(*b) + } + return mec +} + // SetID sets the "id" field. func (mec *MaintenanceEntryCreate) SetID(u uuid.UUID) *MaintenanceEntryCreate { mec.mutation.SetID(u) @@ -184,6 +198,10 @@ func (mec *MaintenanceEntryCreate) defaults() { v := maintenanceentry.DefaultCost mec.mutation.SetCost(v) } + if _, ok := mec.mutation.RemindersEnabled(); !ok { + v := maintenanceentry.DefaultRemindersEnabled + mec.mutation.SetRemindersEnabled(v) + } if _, ok := mec.mutation.ID(); !ok { v := maintenanceentry.DefaultID() mec.mutation.SetID(v) @@ -217,6 +235,9 @@ func (mec *MaintenanceEntryCreate) check() error { if _, ok := mec.mutation.Cost(); !ok { return &ValidationError{Name: "cost", err: errors.New(`ent: missing required field "MaintenanceEntry.cost"`)} } + if _, ok := mec.mutation.RemindersEnabled(); !ok { + return &ValidationError{Name: "reminders_enabled", err: errors.New(`ent: missing required field "MaintenanceEntry.reminders_enabled"`)} + } if _, ok := mec.mutation.ItemID(); !ok { return &ValidationError{Name: "item", err: errors.New(`ent: missing required edge "MaintenanceEntry.item"`)} } @@ -283,6 +304,10 @@ func (mec *MaintenanceEntryCreate) createSpec() (*MaintenanceEntry, *sqlgraph.Cr _spec.SetField(maintenanceentry.FieldCost, field.TypeFloat64, value) _node.Cost = value } + if value, ok := mec.mutation.RemindersEnabled(); ok { + _spec.SetField(maintenanceentry.FieldRemindersEnabled, field.TypeBool, value) + _node.RemindersEnabled = value + } if nodes := mec.mutation.ItemIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, @@ -291,10 +316,7 @@ func (mec *MaintenanceEntryCreate) createSpec() (*MaintenanceEntry, *sqlgraph.Cr Columns: []string{maintenanceentry.ItemColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/maintenanceentry_update.go b/backend/internal/data/ent/maintenanceentry_update.go index 8881e58..98c2ba6 100644 --- a/backend/internal/data/ent/maintenanceentry_update.go +++ b/backend/internal/data/ent/maintenanceentry_update.go @@ -129,6 +129,20 @@ func (meu *MaintenanceEntryUpdate) AddCost(f float64) *MaintenanceEntryUpdate { return meu } +// SetRemindersEnabled sets the "reminders_enabled" field. +func (meu *MaintenanceEntryUpdate) SetRemindersEnabled(b bool) *MaintenanceEntryUpdate { + meu.mutation.SetRemindersEnabled(b) + return meu +} + +// SetNillableRemindersEnabled sets the "reminders_enabled" field if the given value is not nil. +func (meu *MaintenanceEntryUpdate) SetNillableRemindersEnabled(b *bool) *MaintenanceEntryUpdate { + if b != nil { + meu.SetRemindersEnabled(*b) + } + return meu +} + // SetItem sets the "item" edge to the Item entity. func (meu *MaintenanceEntryUpdate) SetItem(i *Item) *MaintenanceEntryUpdate { return meu.SetItemID(i.ID) @@ -241,6 +255,9 @@ func (meu *MaintenanceEntryUpdate) sqlSave(ctx context.Context) (n int, err erro if value, ok := meu.mutation.AddedCost(); ok { _spec.AddField(maintenanceentry.FieldCost, field.TypeFloat64, value) } + if value, ok := meu.mutation.RemindersEnabled(); ok { + _spec.SetField(maintenanceentry.FieldRemindersEnabled, field.TypeBool, value) + } if meu.mutation.ItemCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, @@ -249,10 +266,7 @@ func (meu *MaintenanceEntryUpdate) sqlSave(ctx context.Context) (n int, err erro Columns: []string{maintenanceentry.ItemColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -265,10 +279,7 @@ func (meu *MaintenanceEntryUpdate) sqlSave(ctx context.Context) (n int, err erro Columns: []string{maintenanceentry.ItemColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -395,6 +406,20 @@ func (meuo *MaintenanceEntryUpdateOne) AddCost(f float64) *MaintenanceEntryUpdat return meuo } +// SetRemindersEnabled sets the "reminders_enabled" field. +func (meuo *MaintenanceEntryUpdateOne) SetRemindersEnabled(b bool) *MaintenanceEntryUpdateOne { + meuo.mutation.SetRemindersEnabled(b) + return meuo +} + +// SetNillableRemindersEnabled sets the "reminders_enabled" field if the given value is not nil. +func (meuo *MaintenanceEntryUpdateOne) SetNillableRemindersEnabled(b *bool) *MaintenanceEntryUpdateOne { + if b != nil { + meuo.SetRemindersEnabled(*b) + } + return meuo +} + // SetItem sets the "item" edge to the Item entity. func (meuo *MaintenanceEntryUpdateOne) SetItem(i *Item) *MaintenanceEntryUpdateOne { return meuo.SetItemID(i.ID) @@ -537,6 +562,9 @@ func (meuo *MaintenanceEntryUpdateOne) sqlSave(ctx context.Context) (_node *Main if value, ok := meuo.mutation.AddedCost(); ok { _spec.AddField(maintenanceentry.FieldCost, field.TypeFloat64, value) } + if value, ok := meuo.mutation.RemindersEnabled(); ok { + _spec.SetField(maintenanceentry.FieldRemindersEnabled, field.TypeBool, value) + } if meuo.mutation.ItemCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, @@ -545,10 +573,7 @@ func (meuo *MaintenanceEntryUpdateOne) sqlSave(ctx context.Context) (_node *Main Columns: []string{maintenanceentry.ItemColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -561,10 +586,7 @@ func (meuo *MaintenanceEntryUpdateOne) sqlSave(ctx context.Context) (_node *Main Columns: []string{maintenanceentry.ItemColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/migrate/schema.go b/backend/internal/data/ent/migrate/schema.go index 8d57b5c..1ce050a 100644 --- a/backend/internal/data/ent/migrate/schema.go +++ b/backend/internal/data/ent/migrate/schema.go @@ -328,6 +328,7 @@ var ( {Name: "name", Type: field.TypeString, Size: 255}, {Name: "description", Type: field.TypeString, Nullable: true, Size: 2500}, {Name: "cost", Type: field.TypeFloat64, Default: 0}, + {Name: "reminders_enabled", Type: field.TypeBool, Default: false}, {Name: "item_id", Type: field.TypeUUID}, } // MaintenanceEntriesTable holds the schema information for the "maintenance_entries" table. @@ -338,7 +339,7 @@ var ( ForeignKeys: []*schema.ForeignKey{ { Symbol: "maintenance_entries_items_maintenance_entries", - Columns: []*schema.Column{MaintenanceEntriesColumns[8]}, + Columns: []*schema.Column{MaintenanceEntriesColumns[9]}, RefColumns: []*schema.Column{ItemsColumns[0]}, OnDelete: schema.Cascade, }, diff --git a/backend/internal/data/ent/mutation.go b/backend/internal/data/ent/mutation.go index c55dd08..cb6c49d 100644 --- a/backend/internal/data/ent/mutation.go +++ b/backend/internal/data/ent/mutation.go @@ -9,6 +9,8 @@ import ( "sync" "time" + "entgo.io/ent" + "entgo.io/ent/dialect/sql" "github.com/google/uuid" "github.com/hay-kot/homebox/backend/internal/data/ent/attachment" "github.com/hay-kot/homebox/backend/internal/data/ent/authroles" @@ -24,9 +26,6 @@ import ( "github.com/hay-kot/homebox/backend/internal/data/ent/notifier" "github.com/hay-kot/homebox/backend/internal/data/ent/predicate" "github.com/hay-kot/homebox/backend/internal/data/ent/user" - - "entgo.io/ent" - "entgo.io/ent/dialect/sql" ) const ( @@ -9003,23 +9002,24 @@ func (m *LocationMutation) ResetEdge(name string) error { // MaintenanceEntryMutation represents an operation that mutates the MaintenanceEntry nodes in the graph. type MaintenanceEntryMutation struct { config - op Op - typ string - id *uuid.UUID - created_at *time.Time - updated_at *time.Time - date *time.Time - scheduled_date *time.Time - name *string - description *string - cost *float64 - addcost *float64 - clearedFields map[string]struct{} - item *uuid.UUID - cleareditem bool - done bool - oldValue func(context.Context) (*MaintenanceEntry, error) - predicates []predicate.MaintenanceEntry + op Op + typ string + id *uuid.UUID + created_at *time.Time + updated_at *time.Time + date *time.Time + scheduled_date *time.Time + name *string + description *string + cost *float64 + addcost *float64 + reminders_enabled *bool + clearedFields map[string]struct{} + item *uuid.UUID + cleareditem bool + done bool + oldValue func(context.Context) (*MaintenanceEntry, error) + predicates []predicate.MaintenanceEntry } var _ ent.Mutation = (*MaintenanceEntryMutation)(nil) @@ -9473,6 +9473,42 @@ func (m *MaintenanceEntryMutation) ResetCost() { m.addcost = nil } +// SetRemindersEnabled sets the "reminders_enabled" field. +func (m *MaintenanceEntryMutation) SetRemindersEnabled(b bool) { + m.reminders_enabled = &b +} + +// RemindersEnabled returns the value of the "reminders_enabled" field in the mutation. +func (m *MaintenanceEntryMutation) RemindersEnabled() (r bool, exists bool) { + v := m.reminders_enabled + if v == nil { + return + } + return *v, true +} + +// OldRemindersEnabled returns the old "reminders_enabled" field's value of the MaintenanceEntry entity. +// If the MaintenanceEntry 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 *MaintenanceEntryMutation) OldRemindersEnabled(ctx context.Context) (v bool, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldRemindersEnabled is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldRemindersEnabled requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldRemindersEnabled: %w", err) + } + return oldValue.RemindersEnabled, nil +} + +// ResetRemindersEnabled resets all changes to the "reminders_enabled" field. +func (m *MaintenanceEntryMutation) ResetRemindersEnabled() { + m.reminders_enabled = nil +} + // ClearItem clears the "item" edge to the Item entity. func (m *MaintenanceEntryMutation) ClearItem() { m.cleareditem = true @@ -9533,7 +9569,7 @@ func (m *MaintenanceEntryMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *MaintenanceEntryMutation) Fields() []string { - fields := make([]string, 0, 8) + fields := make([]string, 0, 9) if m.created_at != nil { fields = append(fields, maintenanceentry.FieldCreatedAt) } @@ -9558,6 +9594,9 @@ func (m *MaintenanceEntryMutation) Fields() []string { if m.cost != nil { fields = append(fields, maintenanceentry.FieldCost) } + if m.reminders_enabled != nil { + fields = append(fields, maintenanceentry.FieldRemindersEnabled) + } return fields } @@ -9582,6 +9621,8 @@ func (m *MaintenanceEntryMutation) Field(name string) (ent.Value, bool) { return m.Description() case maintenanceentry.FieldCost: return m.Cost() + case maintenanceentry.FieldRemindersEnabled: + return m.RemindersEnabled() } return nil, false } @@ -9607,6 +9648,8 @@ func (m *MaintenanceEntryMutation) OldField(ctx context.Context, name string) (e return m.OldDescription(ctx) case maintenanceentry.FieldCost: return m.OldCost(ctx) + case maintenanceentry.FieldRemindersEnabled: + return m.OldRemindersEnabled(ctx) } return nil, fmt.Errorf("unknown MaintenanceEntry field %s", name) } @@ -9672,6 +9715,13 @@ func (m *MaintenanceEntryMutation) SetField(name string, value ent.Value) error } m.SetCost(v) return nil + case maintenanceentry.FieldRemindersEnabled: + v, ok := value.(bool) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetRemindersEnabled(v) + return nil } return fmt.Errorf("unknown MaintenanceEntry field %s", name) } @@ -9781,6 +9831,9 @@ func (m *MaintenanceEntryMutation) ResetField(name string) error { case maintenanceentry.FieldCost: m.ResetCost() return nil + case maintenanceentry.FieldRemindersEnabled: + m.ResetRemindersEnabled() + return nil } return fmt.Errorf("unknown MaintenanceEntry field %s", name) } diff --git a/backend/internal/data/ent/notifier_create.go b/backend/internal/data/ent/notifier_create.go index 9de15cd..ed16da8 100644 --- a/backend/internal/data/ent/notifier_create.go +++ b/backend/internal/data/ent/notifier_create.go @@ -268,10 +268,7 @@ func (nc *NotifierCreate) createSpec() (*Notifier, *sqlgraph.CreateSpec) { Columns: []string{notifier.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -288,10 +285,7 @@ func (nc *NotifierCreate) createSpec() (*Notifier, *sqlgraph.CreateSpec) { Columns: []string{notifier.UserColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: user.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/notifier_update.go b/backend/internal/data/ent/notifier_update.go index 5d00cc2..5d75028 100644 --- a/backend/internal/data/ent/notifier_update.go +++ b/backend/internal/data/ent/notifier_update.go @@ -191,10 +191,7 @@ func (nu *NotifierUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{notifier.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -207,10 +204,7 @@ func (nu *NotifierUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{notifier.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -226,10 +220,7 @@ func (nu *NotifierUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{notifier.UserColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: user.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -242,10 +233,7 @@ func (nu *NotifierUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{notifier.UserColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: user.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -463,10 +451,7 @@ func (nuo *NotifierUpdateOne) sqlSave(ctx context.Context) (_node *Notifier, err Columns: []string{notifier.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -479,10 +464,7 @@ func (nuo *NotifierUpdateOne) sqlSave(ctx context.Context) (_node *Notifier, err Columns: []string{notifier.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -498,10 +480,7 @@ func (nuo *NotifierUpdateOne) sqlSave(ctx context.Context) (_node *Notifier, err Columns: []string{notifier.UserColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: user.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -514,10 +493,7 @@ func (nuo *NotifierUpdateOne) sqlSave(ctx context.Context) (_node *Notifier, err Columns: []string{notifier.UserColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: user.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/runtime.go b/backend/internal/data/ent/runtime.go index 9edc90b..7f3bd24 100644 --- a/backend/internal/data/ent/runtime.go +++ b/backend/internal/data/ent/runtime.go @@ -473,6 +473,10 @@ func init() { maintenanceentryDescCost := maintenanceentryFields[5].Descriptor() // maintenanceentry.DefaultCost holds the default value on creation for the cost field. maintenanceentry.DefaultCost = maintenanceentryDescCost.Default.(float64) + // maintenanceentryDescRemindersEnabled is the schema descriptor for reminders_enabled field. + maintenanceentryDescRemindersEnabled := maintenanceentryFields[6].Descriptor() + // maintenanceentry.DefaultRemindersEnabled holds the default value on creation for the reminders_enabled field. + maintenanceentry.DefaultRemindersEnabled = maintenanceentryDescRemindersEnabled.Default.(bool) // maintenanceentryDescID is the schema descriptor for id field. maintenanceentryDescID := maintenanceentryMixinFields0[0].Descriptor() // maintenanceentry.DefaultID holds the default value on creation for the id field. diff --git a/backend/internal/data/ent/runtime/runtime.go b/backend/internal/data/ent/runtime/runtime.go index f6cb4c1..c198804 100644 --- a/backend/internal/data/ent/runtime/runtime.go +++ b/backend/internal/data/ent/runtime/runtime.go @@ -5,6 +5,6 @@ package runtime // The schema-stitching logic is generated in github.com/hay-kot/homebox/backend/internal/data/ent/runtime.go const ( - Version = "v0.11.8" // Version of ent codegen. - Sum = "h1:M/M0QL1CYCUSdqGRXUrXhFYSDRJPsOOrr+RLEej/gyQ=" // Sum of ent codegen. + Version = "v0.11.10" // Version of ent codegen. + Sum = "h1:iqn32ybY5HRW3xSAyMNdNKpZhKgMf1Zunsej9yPKUI8=" // Sum of ent codegen. ) diff --git a/backend/internal/data/ent/schema/maintenance_entry.go b/backend/internal/data/ent/schema/maintenance_entry.go index 52b905b..1c623cf 100644 --- a/backend/internal/data/ent/schema/maintenance_entry.go +++ b/backend/internal/data/ent/schema/maintenance_entry.go @@ -33,8 +33,6 @@ func (MaintenanceEntry) Fields() []ent.Field { Optional(), field.Float("cost"). Default(0.0), - field.Bool("reminders_enabled"). - Default(false), } } diff --git a/backend/internal/data/ent/user_create.go b/backend/internal/data/ent/user_create.go index 14b4282..a53177b 100644 --- a/backend/internal/data/ent/user_create.go +++ b/backend/internal/data/ent/user_create.go @@ -370,10 +370,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Columns: []string{user.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -390,10 +387,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Columns: []string{user.AuthTokensColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: authtokens.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(authtokens.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -409,10 +403,7 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { Columns: []string{user.NotifiersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: notifier.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(notifier.FieldID, field.TypeUUID), }, } for _, k := range nodes { diff --git a/backend/internal/data/ent/user_update.go b/backend/internal/data/ent/user_update.go index 26c2330..88fb763 100644 --- a/backend/internal/data/ent/user_update.go +++ b/backend/internal/data/ent/user_update.go @@ -323,10 +323,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{user.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -339,10 +336,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{user.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -358,10 +352,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{user.AuthTokensColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: authtokens.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(authtokens.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -374,10 +365,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{user.AuthTokensColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: authtokens.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(authtokens.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -393,10 +381,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{user.AuthTokensColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: authtokens.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(authtokens.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -412,10 +397,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{user.NotifiersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: notifier.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(notifier.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -428,10 +410,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{user.NotifiersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: notifier.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(notifier.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -447,10 +426,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { Columns: []string{user.NotifiersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: notifier.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(notifier.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -799,10 +775,7 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) Columns: []string{user.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -815,10 +788,7 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) Columns: []string{user.GroupColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -834,10 +804,7 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) Columns: []string{user.AuthTokensColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: authtokens.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(authtokens.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -850,10 +817,7 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) Columns: []string{user.AuthTokensColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: authtokens.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(authtokens.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -869,10 +833,7 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) Columns: []string{user.AuthTokensColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: authtokens.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(authtokens.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -888,10 +849,7 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) Columns: []string{user.NotifiersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: notifier.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(notifier.FieldID, field.TypeUUID), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) @@ -904,10 +862,7 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) Columns: []string{user.NotifiersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: notifier.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(notifier.FieldID, field.TypeUUID), }, } for _, k := range nodes { @@ -923,10 +878,7 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) Columns: []string{user.NotifiersColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: notifier.FieldID, - }, + IDSpec: sqlgraph.NewFieldSpec(notifier.FieldID, field.TypeUUID), }, } for _, k := range nodes {