-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: list devices based on permissions
- Loading branch information
1 parent
b8c5154
commit 2436614
Showing
18 changed files
with
939 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
-- +goose Up | ||
-- disable the enforcement of foreign-keys constraints | ||
PRAGMA foreign_keys = off; | ||
-- create "new_dahua_permissions" table | ||
CREATE TABLE `new_dahua_permissions` (`user_id` integer NULL, `group_id` integer NULL, `device_id` integer NOT NULL, `level` integer NOT NULL, CONSTRAINT `0` FOREIGN KEY (`device_id`) REFERENCES `dahua_devices` (`id`) ON UPDATE CASCADE ON DELETE CASCADE, CONSTRAINT `1` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON UPDATE CASCADE ON DELETE CASCADE, CONSTRAINT `2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON UPDATE CASCADE ON DELETE CASCADE); | ||
-- copy rows from old table "dahua_permissions" to new temporary table "new_dahua_permissions" | ||
INSERT INTO `new_dahua_permissions` (`user_id`, `group_id`, `device_id`) SELECT `user_id`, `group_id`, `device_id` FROM `dahua_permissions`; | ||
-- drop "dahua_permissions" table after copying rows | ||
DROP TABLE `dahua_permissions`; | ||
-- rename temporary table "new_dahua_permissions" to "dahua_permissions" | ||
ALTER TABLE `new_dahua_permissions` RENAME TO `dahua_permissions`; | ||
-- create index "dahua_permissions_user_id_device_id" to table: "dahua_permissions" | ||
CREATE UNIQUE INDEX `dahua_permissions_user_id_device_id` ON `dahua_permissions` (`user_id`, `device_id`); | ||
-- create index "dahua_permissions_group_id_device_id" to table: "dahua_permissions" | ||
CREATE UNIQUE INDEX `dahua_permissions_group_id_device_id` ON `dahua_permissions` (`group_id`, `device_id`); | ||
-- enable back the enforcement of foreign-keys constraints | ||
PRAGMA foreign_keys = on; | ||
|
||
-- +goose Down | ||
-- reverse: create index "dahua_permissions_group_id_device_id" to table: "dahua_permissions" | ||
DROP INDEX `dahua_permissions_group_id_device_id`; | ||
-- reverse: create index "dahua_permissions_user_id_device_id" to table: "dahua_permissions" | ||
DROP INDEX `dahua_permissions_user_id_device_id`; | ||
-- reverse: create "new_dahua_permissions" table | ||
DROP TABLE `new_dahua_permissions`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
h1:o8JBZ3wyYZ6BcnXbnExh/xAzDZodh/60NdLuOgOAeUY= | ||
h1:OALKVgKef9vRTB38+EIZnMsM75/+feypay54rrqeLOA= | ||
20240114082916_initial.sql h1:6T2vRM1rfcsNzTh9YR0sXB8U+T3GZ6PiJcZc23WvXl8= | ||
20240117044510_initial.sql h1:91cIrQzdHSR9DIvMzRnuBlbTptlf877EieEYXT3wRaU= | ||
20240117054837_initial.sql h1:Xw8Z7y27y9fCrv5VnGjb5W1XwtHClBgiGr92AlRL9pM= | ||
20240117055231_initial.sql h1:/CD25FfvoH5yUaDdzIMnZ0HOUV1LJm9jxpKoP+mKWSU= | ||
20240118025315_initial.sql h1:0NT8HEKbPi2uMxuMv0SYyyhg821qZ+SRzGoH//8ytrA= | ||
20240120004552_initial.sql h1:PG61nxPoo4MSEgZCy7Vojc+txW8GOS4tv57rSiswzwE= | ||
20240121020400_initial.sql h1:PVapHcXZ7bgNOp0W6ZkT/VMJnjk2NUUVWOtt6Ktt7ms= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { cache } from "@solidjs/router"; | ||
import { useClient } from "~/providers/client"; | ||
|
||
export const getHome = cache(() => useClient().page.home({}).then((req) => req.response), "getHome") | ||
|
||
export function loadHome() { | ||
void getHome() | ||
} |
Oops, something went wrong.