mirror of
https://github.com/hay-kot/homebox.git
synced 2025-06-04 11:32:28 +00:00
feat: QR Codes (#226)
* code gen updates * qrcode support * remove opacity on toast * update item view to use tab-like pages * adjust view for cards * fix old API calls for ioutils * move embed * extract QR code * add docs for QR codes * add QR code
This commit is contained in:
parent
f532b39c46
commit
c19fe94c08
88 changed files with 3151 additions and 6454 deletions
|
@ -172,50 +172,8 @@ func (ifc *ItemFieldCreate) Mutation() *ItemFieldMutation {
|
|||
|
||||
// Save creates the ItemField in the database.
|
||||
func (ifc *ItemFieldCreate) Save(ctx context.Context) (*ItemField, error) {
|
||||
var (
|
||||
err error
|
||||
node *ItemField
|
||||
)
|
||||
ifc.defaults()
|
||||
if len(ifc.hooks) == 0 {
|
||||
if err = ifc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
node, err = ifc.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*ItemFieldMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err = ifc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ifc.mutation = mutation
|
||||
if node, err = ifc.sqlSave(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
mutation.id = &node.ID
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(ifc.hooks) - 1; i >= 0; i-- {
|
||||
if ifc.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = ifc.hooks[i](mut)
|
||||
}
|
||||
v, err := mut.Mutate(ctx, ifc.mutation)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
nv, ok := v.(*ItemField)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected node type %T returned from ItemFieldMutation", v)
|
||||
}
|
||||
node = nv
|
||||
}
|
||||
return node, err
|
||||
return withHooks[*ItemField, ItemFieldMutation](ctx, ifc.sqlSave, ifc.mutation, ifc.hooks)
|
||||
}
|
||||
|
||||
// SaveX calls Save and panics if Save returns an error.
|
||||
|
@ -308,6 +266,9 @@ func (ifc *ItemFieldCreate) check() error {
|
|||
}
|
||||
|
||||
func (ifc *ItemFieldCreate) sqlSave(ctx context.Context) (*ItemField, error) {
|
||||
if err := ifc.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_node, _spec := ifc.createSpec()
|
||||
if err := sqlgraph.CreateNode(ctx, ifc.driver, _spec); err != nil {
|
||||
if sqlgraph.IsConstraintError(err) {
|
||||
|
@ -322,6 +283,8 @@ func (ifc *ItemFieldCreate) sqlSave(ctx context.Context) (*ItemField, error) {
|
|||
return nil, err
|
||||
}
|
||||
}
|
||||
ifc.mutation.id = &_node.ID
|
||||
ifc.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue