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
|
@ -344,6 +344,59 @@ var (
|
|||
},
|
||||
},
|
||||
}
|
||||
// NotifiersColumns holds the columns for the "notifiers" table.
|
||||
NotifiersColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeUUID},
|
||||
{Name: "created_at", Type: field.TypeTime},
|
||||
{Name: "updated_at", Type: field.TypeTime},
|
||||
{Name: "name", Type: field.TypeString, Size: 255},
|
||||
{Name: "url", Type: field.TypeString, Size: 2083},
|
||||
{Name: "is_active", Type: field.TypeBool, Default: true},
|
||||
{Name: "group_id", Type: field.TypeUUID},
|
||||
{Name: "user_id", Type: field.TypeUUID},
|
||||
}
|
||||
// NotifiersTable holds the schema information for the "notifiers" table.
|
||||
NotifiersTable = &schema.Table{
|
||||
Name: "notifiers",
|
||||
Columns: NotifiersColumns,
|
||||
PrimaryKey: []*schema.Column{NotifiersColumns[0]},
|
||||
ForeignKeys: []*schema.ForeignKey{
|
||||
{
|
||||
Symbol: "notifiers_groups_notifiers",
|
||||
Columns: []*schema.Column{NotifiersColumns[6]},
|
||||
RefColumns: []*schema.Column{GroupsColumns[0]},
|
||||
OnDelete: schema.Cascade,
|
||||
},
|
||||
{
|
||||
Symbol: "notifiers_users_notifiers",
|
||||
Columns: []*schema.Column{NotifiersColumns[7]},
|
||||
RefColumns: []*schema.Column{UsersColumns[0]},
|
||||
OnDelete: schema.Cascade,
|
||||
},
|
||||
},
|
||||
Indexes: []*schema.Index{
|
||||
{
|
||||
Name: "notifier_user_id",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{NotifiersColumns[7]},
|
||||
},
|
||||
{
|
||||
Name: "notifier_user_id_is_active",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{NotifiersColumns[7], NotifiersColumns[5]},
|
||||
},
|
||||
{
|
||||
Name: "notifier_group_id",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{NotifiersColumns[6]},
|
||||
},
|
||||
{
|
||||
Name: "notifier_group_id_is_active",
|
||||
Unique: false,
|
||||
Columns: []*schema.Column{NotifiersColumns[6], NotifiersColumns[5]},
|
||||
},
|
||||
},
|
||||
}
|
||||
// UsersColumns holds the columns for the "users" table.
|
||||
UsersColumns = []*schema.Column{
|
||||
{Name: "id", Type: field.TypeUUID},
|
||||
|
@ -353,8 +406,8 @@ var (
|
|||
{Name: "email", Type: field.TypeString, Unique: true, Size: 255},
|
||||
{Name: "password", Type: field.TypeString, Size: 255},
|
||||
{Name: "is_superuser", Type: field.TypeBool, Default: false},
|
||||
{Name: "role", Type: field.TypeEnum, Enums: []string{"user", "owner"}, Default: "user"},
|
||||
{Name: "superuser", Type: field.TypeBool, Default: false},
|
||||
{Name: "role", Type: field.TypeEnum, Enums: []string{"user", "owner"}, Default: "user"},
|
||||
{Name: "activated_on", Type: field.TypeTime, Nullable: true},
|
||||
{Name: "group_users", Type: field.TypeUUID},
|
||||
}
|
||||
|
@ -410,6 +463,7 @@ var (
|
|||
LabelsTable,
|
||||
LocationsTable,
|
||||
MaintenanceEntriesTable,
|
||||
NotifiersTable,
|
||||
UsersTable,
|
||||
LabelItemsTable,
|
||||
}
|
||||
|
@ -430,6 +484,8 @@ func init() {
|
|||
LocationsTable.ForeignKeys[0].RefTable = GroupsTable
|
||||
LocationsTable.ForeignKeys[1].RefTable = LocationsTable
|
||||
MaintenanceEntriesTable.ForeignKeys[0].RefTable = ItemsTable
|
||||
NotifiersTable.ForeignKeys[0].RefTable = GroupsTable
|
||||
NotifiersTable.ForeignKeys[1].RefTable = UsersTable
|
||||
UsersTable.ForeignKeys[0].RefTable = GroupsTable
|
||||
LabelItemsTable.ForeignKeys[0].RefTable = LabelsTable
|
||||
LabelItemsTable.ForeignKeys[1].RefTable = ItemsTable
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue