mirror of
https://github.com/hay-kot/homebox.git
synced 2025-06-05 03:52:29 +00:00
feat: Notifiers CRUD (#337)
* introduce scaffold for new models * wip: shoutrrr wrapper (may remove) * update schema files * gen: ent code * gen: migrations * go mod tidy * add group_id to notifier * db migration * new mapper helpers * notifier repo * introduce experimental adapter pattern for hdlrs * refactor adapters to fit more common use cases * new routes for notifiers * update errors to fix validation panic * go tidy * reverse checkbox label display * wip: notifiers UI * use badges instead of text * improve documentation * add scaffold schema reference * remove notifier service * refactor schema folder * support group edges via scaffold * delete test file * include link to API docs * audit and update documentation + improve format * refactor schema edges * refactor * add custom validator * set validate + order fields by name * fix failing tests
This commit is contained in:
parent
2665b666f1
commit
23b5892aef
100 changed files with 11437 additions and 2075 deletions
|
@ -35,12 +35,12 @@ type Location struct {
|
|||
|
||||
// LocationEdges holds the relations/edges for other nodes in the graph.
|
||||
type LocationEdges struct {
|
||||
// Group holds the value of the group edge.
|
||||
Group *Group `json:"group,omitempty"`
|
||||
// Parent holds the value of the parent edge.
|
||||
Parent *Location `json:"parent,omitempty"`
|
||||
// Children holds the value of the children edge.
|
||||
Children []*Location `json:"children,omitempty"`
|
||||
// Group holds the value of the group edge.
|
||||
Group *Group `json:"group,omitempty"`
|
||||
// Items holds the value of the items edge.
|
||||
Items []*Item `json:"items,omitempty"`
|
||||
// loadedTypes holds the information for reporting if a
|
||||
|
@ -48,10 +48,23 @@ type LocationEdges struct {
|
|||
loadedTypes [4]bool
|
||||
}
|
||||
|
||||
// GroupOrErr returns the Group value or an error if the edge
|
||||
// was not loaded in eager-loading, or loaded but was not found.
|
||||
func (e LocationEdges) GroupOrErr() (*Group, error) {
|
||||
if e.loadedTypes[0] {
|
||||
if e.Group == nil {
|
||||
// Edge was loaded but was not found.
|
||||
return nil, &NotFoundError{label: group.Label}
|
||||
}
|
||||
return e.Group, nil
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "group"}
|
||||
}
|
||||
|
||||
// ParentOrErr returns the Parent value or an error if the edge
|
||||
// was not loaded in eager-loading, or loaded but was not found.
|
||||
func (e LocationEdges) ParentOrErr() (*Location, error) {
|
||||
if e.loadedTypes[0] {
|
||||
if e.loadedTypes[1] {
|
||||
if e.Parent == nil {
|
||||
// Edge was loaded but was not found.
|
||||
return nil, &NotFoundError{label: location.Label}
|
||||
|
@ -64,25 +77,12 @@ func (e LocationEdges) ParentOrErr() (*Location, error) {
|
|||
// ChildrenOrErr returns the Children value or an error if the edge
|
||||
// was not loaded in eager-loading.
|
||||
func (e LocationEdges) ChildrenOrErr() ([]*Location, error) {
|
||||
if e.loadedTypes[1] {
|
||||
if e.loadedTypes[2] {
|
||||
return e.Children, nil
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "children"}
|
||||
}
|
||||
|
||||
// GroupOrErr returns the Group value or an error if the edge
|
||||
// was not loaded in eager-loading, or loaded but was not found.
|
||||
func (e LocationEdges) GroupOrErr() (*Group, error) {
|
||||
if e.loadedTypes[2] {
|
||||
if e.Group == nil {
|
||||
// Edge was loaded but was not found.
|
||||
return nil, &NotFoundError{label: group.Label}
|
||||
}
|
||||
return e.Group, nil
|
||||
}
|
||||
return nil, &NotLoadedError{edge: "group"}
|
||||
}
|
||||
|
||||
// ItemsOrErr returns the Items value or an error if the edge
|
||||
// was not loaded in eager-loading.
|
||||
func (e LocationEdges) ItemsOrErr() ([]*Item, error) {
|
||||
|
@ -171,6 +171,11 @@ func (l *Location) assignValues(columns []string, values []any) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// QueryGroup queries the "group" edge of the Location entity.
|
||||
func (l *Location) QueryGroup() *GroupQuery {
|
||||
return NewLocationClient(l.config).QueryGroup(l)
|
||||
}
|
||||
|
||||
// QueryParent queries the "parent" edge of the Location entity.
|
||||
func (l *Location) QueryParent() *LocationQuery {
|
||||
return NewLocationClient(l.config).QueryParent(l)
|
||||
|
@ -181,11 +186,6 @@ func (l *Location) QueryChildren() *LocationQuery {
|
|||
return NewLocationClient(l.config).QueryChildren(l)
|
||||
}
|
||||
|
||||
// QueryGroup queries the "group" edge of the Location entity.
|
||||
func (l *Location) QueryGroup() *GroupQuery {
|
||||
return NewLocationClient(l.config).QueryGroup(l)
|
||||
}
|
||||
|
||||
// QueryItems queries the "items" edge of the Location entity.
|
||||
func (l *Location) QueryItems() *ItemQuery {
|
||||
return NewLocationClient(l.config).QueryItems(l)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue