mirror of
https://github.com/hay-kot/homebox.git
synced 2025-06-04 19:42: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
|
@ -0,0 +1,6 @@
|
|||
-- create "notifiers" table
|
||||
CREATE TABLE `notifiers` (`id` uuid NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, `name` text NOT NULL, `url` text NOT NULL, `is_active` bool NOT NULL DEFAULT true, `user_id` uuid NOT NULL, PRIMARY KEY (`id`), CONSTRAINT `notifiers_users_notifiers` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE);
|
||||
-- create index "notifier_user_id" to table: "notifiers"
|
||||
CREATE INDEX `notifier_user_id` ON `notifiers` (`user_id`);
|
||||
-- create index "notifier_user_id_is_active" to table: "notifiers"
|
||||
CREATE INDEX `notifier_user_id_is_active` ON `notifiers` (`user_id`, `is_active`);
|
|
@ -0,0 +1,20 @@
|
|||
-- disable the enforcement of foreign-keys constraints
|
||||
PRAGMA foreign_keys = off;
|
||||
-- create "new_notifiers" table
|
||||
CREATE TABLE `new_notifiers` (`id` uuid NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, `name` text NOT NULL, `url` text NOT NULL, `is_active` bool NOT NULL DEFAULT true, `group_id` uuid NOT NULL, `user_id` uuid NOT NULL, PRIMARY KEY (`id`), CONSTRAINT `notifiers_groups_notifiers` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE, CONSTRAINT `notifiers_users_notifiers` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE);
|
||||
-- copy rows from old table "notifiers" to new temporary table "new_notifiers"
|
||||
INSERT INTO `new_notifiers` (`id`, `created_at`, `updated_at`, `name`, `url`, `is_active`, `user_id`) SELECT `id`, `created_at`, `updated_at`, `name`, `url`, `is_active`, `user_id` FROM `notifiers`;
|
||||
-- drop "notifiers" table after copying rows
|
||||
DROP TABLE `notifiers`;
|
||||
-- rename temporary table "new_notifiers" to "notifiers"
|
||||
ALTER TABLE `new_notifiers` RENAME TO `notifiers`;
|
||||
-- create index "notifier_user_id" to table: "notifiers"
|
||||
CREATE INDEX `notifier_user_id` ON `notifiers` (`user_id`);
|
||||
-- create index "notifier_user_id_is_active" to table: "notifiers"
|
||||
CREATE INDEX `notifier_user_id_is_active` ON `notifiers` (`user_id`, `is_active`);
|
||||
-- create index "notifier_group_id" to table: "notifiers"
|
||||
CREATE INDEX `notifier_group_id` ON `notifiers` (`group_id`);
|
||||
-- create index "notifier_group_id_is_active" to table: "notifiers"
|
||||
CREATE INDEX `notifier_group_id_is_active` ON `notifiers` (`group_id`, `is_active`);
|
||||
-- enable back the enforcement of foreign-keys constraints
|
||||
PRAGMA foreign_keys = on;
|
|
@ -1,4 +1,4 @@
|
|||
h1:o94ZiQarQV54hzXXKoOUNL/DvHYieveswCLwJaUMGPo=
|
||||
h1:VjVLPBHzJ8N1Hiw+Aeitb0alnVn9UFilnajCzc+pie8=
|
||||
20220929052825_init.sql h1:ZlCqm1wzjDmofeAcSX3jE4h4VcdTNGpRg2eabztDy9Q=
|
||||
20221001210956_group_invitations.sql h1:YQKJFtE39wFOcRNbZQ/d+ZlHwrcfcsZlcv/pLEYdpjw=
|
||||
20221009173029_add_user_roles.sql h1:vWmzAfgEWQeGk0Vn70zfVPCcfEZth3E0JcvyKTjpYyU=
|
||||
|
@ -10,3 +10,5 @@ h1:o94ZiQarQV54hzXXKoOUNL/DvHYieveswCLwJaUMGPo=
|
|||
20221205234214_add_maintenance_entries.sql h1:B56VzCuDsed1k3/sYUoKlOkP90DcdLufxFK0qYvoafU=
|
||||
20221205234812_cascade_delete_roles.sql h1:VIiaImR48nCHF3uFbOYOX1E79Ta5HsUBetGaSAbh9Gk=
|
||||
20230227024134_add_scheduled_date.sql h1:8qO5OBZ0AzsfYEQOAQQrYIjyhSwM+v1A+/ylLSoiyoc=
|
||||
20230305065819_add_notifier_types.sql h1:r5xrgCKYQ2o9byBqYeAX1zdp94BLdaxf4vq9OmGHNl0=
|
||||
20230305071524_add_group_id_to_notifiers.sql h1:xDShqbyClcFhvJbwclOHdczgXbdffkxXNWjV61hL/t4=
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue