-
-
Notifications
You must be signed in to change notification settings - Fork 4
feat(notification)!: inherit invitations #176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sthelemann
wants to merge
16
commits into
main
Choose a base branch
from
feat/invitation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
9e5af43
feat(invitation): add invitations
sthelemann 6adb115
fix(role): make role reset independent of user name
sthelemann 1ce8e75
chore(role): remove function `set_local_superuser`
sthelemann d5917f3
chore(renaming): rename table `invitation`
sthelemann 6d6715e
fix(test): modify security mode for two functions
sthelemann 280ae3c
fix(notification): modify table `notification`
sthelemann 9392e58
Merge branch 'beta' into feat/invitation
sthelemann 748758a
chore(policy): simplify policies
sthelemann 9bdd042
chore: define policies in table definition files
sthelemann 9949a49
Merge branch 'beta' into feat/invitation
dargmuesli b7adc45
chore: review
dargmuesli 82b9b4a
feat(invitation): modify function `invite`
sthelemann 051766d
feat(invitation): cleanup policies
sthelemann 4981600
feat(invitation): undo changes from previous commits
sthelemann a9b1281
Merge branch 'main' into feat/invitation
sthelemann 60d363d
Merge branch 'main' into feat/invitation
sthelemann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,23 +1,36 @@ | ||
| BEGIN; | ||
|
|
||
| CREATE TABLE vibetype_private.notification ( | ||
| CREATE TABLE vibetype.notification ( | ||
| id UUID PRIMARY KEY DEFAULT gen_random_uuid(), | ||
|
|
||
| channel TEXT NOT NULL, | ||
| is_acknowledged BOOLEAN, | ||
| payload TEXT NOT NULL CHECK (octet_length(payload) <= 8000), | ||
|
|
||
| created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP | ||
| created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
| created_by UUID NOT NULL REFERENCES vibetype.account(id) ON DELETE CASCADE | ||
| ); | ||
|
|
||
| COMMENT ON TABLE vibetype_private.notification IS 'A notification.'; | ||
| COMMENT ON COLUMN vibetype_private.notification.id IS 'The notification''s internal id.'; | ||
| COMMENT ON COLUMN vibetype_private.notification.channel IS 'The notification''s channel.'; | ||
| COMMENT ON COLUMN vibetype_private.notification.is_acknowledged IS 'Whether the notification was acknowledged.'; | ||
| COMMENT ON COLUMN vibetype_private.notification.payload IS 'The notification''s payload.'; | ||
| COMMENT ON COLUMN vibetype_private.notification.created_at IS 'The timestamp of the notification''s creation.'; | ||
| CREATE INDEX idx_notification_created_by ON vibetype.notification USING btree (created_by); | ||
|
|
||
| COMMENT ON TABLE vibetype.notification IS 'A notification.'; | ||
| COMMENT ON COLUMN vibetype.notification.id IS 'The notification''s internal id.'; | ||
| COMMENT ON COLUMN vibetype.notification.channel IS 'The notification''s channel.'; | ||
| COMMENT ON COLUMN vibetype.notification.is_acknowledged IS 'Whether the notification was acknowledged.'; | ||
| COMMENT ON COLUMN vibetype.notification.payload IS 'The notification''s payload.'; | ||
| COMMENT ON COLUMN vibetype.notification.created_at IS 'The timestamp of the notification''s creation.'; | ||
| COMMENT ON COLUMN vibetype.notification.created_by IS 'Reference to the account that created the notification.'; | ||
|
|
||
| GRANT SELECT ON vibetype.notification TO vibetype_account; | ||
|
|
||
| ALTER TABLE vibetype.notification ENABLE ROW LEVEL SECURITY; | ||
|
|
||
| CREATE POLICY notification_all ON vibetype.notification FOR ALL | ||
| USING ( | ||
| created_by = vibetype.invoker_account_id() | ||
| ); | ||
|
|
||
| \set role_service_grafana_username `cat /run/secrets/postgres_role_service_grafana_username` | ||
| GRANT SELECT ON TABLE vibetype_private.notification TO :role_service_grafana_username; | ||
| GRANT SELECT ON TABLE vibetype.notification TO :role_service_grafana_username; | ||
|
|
||
| COMMIT; | ||
This file contains hidden or 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,17 @@ | ||
| BEGIN; | ||
|
|
||
| CREATE TABLE vibetype.notification_invitation ( | ||
| guest_id UUID NOT NULL REFERENCES vibetype.guest(id) | ||
| ) | ||
| INHERITS (vibetype.notification); | ||
|
|
||
| CREATE INDEX idx_invitation_guest_id ON vibetype.notification_invitation USING btree (guest_id); | ||
|
|
||
| COMMENT ON TABLE vibetype.notification_invitation IS '@omit update,delete\nStores invitations and their statuses.'; | ||
| COMMENT ON COLUMN vibetype.notification_invitation.guest_id IS 'The ID of the guest associated with this invitation.'; | ||
|
|
||
| GRANT SELECT ON vibetype.notification_invitation TO vibetype_account; | ||
|
|
||
| ALTER TABLE vibetype.notification_invitation ENABLE ROW LEVEL SECURITY; | ||
|
|
||
| COMMIT; |
This file contains hidden or 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,5 +1,7 @@ | ||
| BEGIN; | ||
|
|
||
| DROP TABLE vibetype_private.notification; | ||
| DROP POLICY notification_all ON vibetype.notification; | ||
|
|
||
| DROP TABLE vibetype.notification; | ||
|
|
||
| COMMIT; |
This file contains hidden or 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,5 @@ | ||
| BEGIN; | ||
|
|
||
| DROP TABLE vibetype.notification_invitation; | ||
|
|
||
| COMMIT; |
This file contains hidden or 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 hidden or 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 hidden or 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,28 @@ | ||
| BEGIN; | ||
|
|
||
| SELECT | ||
| -- inherited from vibetype.notification | ||
| id, | ||
| channel, | ||
| is_acknowledged, | ||
| payload, | ||
| created_by, | ||
| created_at, | ||
| -- columns specific for vibetype.notification_invitation | ||
| guest_id | ||
| FROM vibetype.notification_invitation | ||
| WHERE FALSE; | ||
|
|
||
| DO $$ | ||
| BEGIN | ||
| ASSERT (SELECT pg_catalog.has_table_privilege('vibetype_account', 'vibetype.notification_invitation', 'SELECT')); | ||
| ASSERT NOT (SELECT pg_catalog.has_table_privilege('vibetype_account', 'vibetype.notification_invitation', 'INSERT')); | ||
| ASSERT NOT (SELECT pg_catalog.has_table_privilege('vibetype_account', 'vibetype.notification_invitation', 'UPDATE')); | ||
| ASSERT NOT (SELECT pg_catalog.has_table_privilege('vibetype_account', 'vibetype.notification_invitation', 'DELETE')); | ||
| ASSERT NOT (SELECT pg_catalog.has_table_privilege('vibetype_anonymous', 'vibetype.notification_invitation', 'SELECT')); | ||
| ASSERT NOT (SELECT pg_catalog.has_table_privilege('vibetype_anonymous', 'vibetype.notification_invitation', 'INSERT')); | ||
| ASSERT NOT (SELECT pg_catalog.has_table_privilege('vibetype_anonymous', 'vibetype.notification_invitation', 'UPDATE')); | ||
| ASSERT NOT (SELECT pg_catalog.has_table_privilege('vibetype_anonymous', 'vibetype.notification_invitation', 'DELETE')); | ||
| END $$; | ||
|
|
||
| ROLLBACK; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.