mirror of
https://github.com/hay-kot/homebox.git
synced 2025-06-02 10:32:29 +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
|
@ -177,41 +177,8 @@ func (uu *UserUpdate) RemoveAuthTokens(a ...*AuthTokens) *UserUpdate {
|
|||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (uu *UserUpdate) Save(ctx context.Context) (int, error) {
|
||||
var (
|
||||
err error
|
||||
affected int
|
||||
)
|
||||
uu.defaults()
|
||||
if len(uu.hooks) == 0 {
|
||||
if err = uu.check(); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
affected, err = uu.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*UserMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err = uu.check(); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
uu.mutation = mutation
|
||||
affected, err = uu.sqlSave(ctx)
|
||||
mutation.done = true
|
||||
return affected, err
|
||||
})
|
||||
for i := len(uu.hooks) - 1; i >= 0; i-- {
|
||||
if uu.hooks[i] == nil {
|
||||
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = uu.hooks[i](mut)
|
||||
}
|
||||
if _, err := mut.Mutate(ctx, uu.mutation); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
return affected, err
|
||||
return withHooks[int, UserMutation](ctx, uu.sqlSave, uu.mutation, uu.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
|
@ -273,6 +240,9 @@ func (uu *UserUpdate) check() error {
|
|||
}
|
||||
|
||||
func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
||||
if err := uu.check(); err != nil {
|
||||
return n, err
|
||||
}
|
||||
_spec := &sqlgraph.UpdateSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: user.Table,
|
||||
|
@ -414,6 +384,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
|||
}
|
||||
return 0, err
|
||||
}
|
||||
uu.mutation.done = true
|
||||
return n, nil
|
||||
}
|
||||
|
||||
|
@ -578,47 +549,8 @@ func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne
|
|||
|
||||
// Save executes the query and returns the updated User entity.
|
||||
func (uuo *UserUpdateOne) Save(ctx context.Context) (*User, error) {
|
||||
var (
|
||||
err error
|
||||
node *User
|
||||
)
|
||||
uuo.defaults()
|
||||
if len(uuo.hooks) == 0 {
|
||||
if err = uuo.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
node, err = uuo.sqlSave(ctx)
|
||||
} else {
|
||||
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
|
||||
mutation, ok := m.(*UserMutation)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected mutation type %T", m)
|
||||
}
|
||||
if err = uuo.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
uuo.mutation = mutation
|
||||
node, err = uuo.sqlSave(ctx)
|
||||
mutation.done = true
|
||||
return node, err
|
||||
})
|
||||
for i := len(uuo.hooks) - 1; i >= 0; i-- {
|
||||
if uuo.hooks[i] == nil {
|
||||
return nil, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
|
||||
}
|
||||
mut = uuo.hooks[i](mut)
|
||||
}
|
||||
v, err := mut.Mutate(ctx, uuo.mutation)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
nv, ok := v.(*User)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unexpected node type %T returned from UserMutation", v)
|
||||
}
|
||||
node = nv
|
||||
}
|
||||
return node, err
|
||||
return withHooks[*User, UserMutation](ctx, uuo.sqlSave, uuo.mutation, uuo.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
|
@ -680,6 +612,9 @@ func (uuo *UserUpdateOne) check() error {
|
|||
}
|
||||
|
||||
func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) {
|
||||
if err := uuo.check(); err != nil {
|
||||
return _node, err
|
||||
}
|
||||
_spec := &sqlgraph.UpdateSpec{
|
||||
Node: &sqlgraph.NodeSpec{
|
||||
Table: user.Table,
|
||||
|
@ -841,5 +776,6 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error)
|
|||
}
|
||||
return nil, err
|
||||
}
|
||||
uuo.mutation.done = true
|
||||
return _node, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue