Add dynamic admin panel for managing entities (#108)

This commit is contained in:
Mike Stefanello 2025-04-22 08:26:35 -04:00 committed by GitHub
parent 60009df0bf
commit 1a6874fd82
47 changed files with 2173 additions and 320 deletions

View file

@ -84,6 +84,20 @@ func (uu *UserUpdate) SetNillableVerified(b *bool) *UserUpdate {
return uu
}
// SetAdmin sets the "admin" field.
func (uu *UserUpdate) SetAdmin(b bool) *UserUpdate {
uu.mutation.SetAdmin(b)
return uu
}
// SetNillableAdmin sets the "admin" field if the given value is not nil.
func (uu *UserUpdate) SetNillableAdmin(b *bool) *UserUpdate {
if b != nil {
uu.SetAdmin(*b)
}
return uu
}
// AddOwnerIDs adds the "owner" edge to the PasswordToken entity by IDs.
func (uu *UserUpdate) AddOwnerIDs(ids ...int) *UserUpdate {
uu.mutation.AddOwnerIDs(ids...)
@ -196,6 +210,9 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) {
if value, ok := uu.mutation.Verified(); ok {
_spec.SetField(user.FieldVerified, field.TypeBool, value)
}
if value, ok := uu.mutation.Admin(); ok {
_spec.SetField(user.FieldAdmin, field.TypeBool, value)
}
if uu.mutation.OwnerCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
@ -317,6 +334,20 @@ func (uuo *UserUpdateOne) SetNillableVerified(b *bool) *UserUpdateOne {
return uuo
}
// SetAdmin sets the "admin" field.
func (uuo *UserUpdateOne) SetAdmin(b bool) *UserUpdateOne {
uuo.mutation.SetAdmin(b)
return uuo
}
// SetNillableAdmin sets the "admin" field if the given value is not nil.
func (uuo *UserUpdateOne) SetNillableAdmin(b *bool) *UserUpdateOne {
if b != nil {
uuo.SetAdmin(*b)
}
return uuo
}
// AddOwnerIDs adds the "owner" edge to the PasswordToken entity by IDs.
func (uuo *UserUpdateOne) AddOwnerIDs(ids ...int) *UserUpdateOne {
uuo.mutation.AddOwnerIDs(ids...)
@ -459,6 +490,9 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error)
if value, ok := uuo.mutation.Verified(); ok {
_spec.SetField(user.FieldVerified, field.TypeBool, value)
}
if value, ok := uuo.mutation.Admin(); ok {
_spec.SetField(user.FieldAdmin, field.TypeBool, value)
}
if uuo.mutation.OwnerCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,