Added ownership and app existence validation to the user app secrets routes.
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
CREATE TABLE user_app_secrets (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid (),
|
||||
id UUID DEFAULT gen_random_uuid (),
|
||||
app_id UUID NOT NULL CONSTRAINT fk_user_app_secrets_app REFERENCES user_apps (id) ON DELETE CASCADE,
|
||||
secret_hash BYTEA NOT NULL CHECK (
|
||||
octet_length(secret_hash) = 32
|
||||
),
|
||||
expires_at TIMESTAMPTZ NOT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
PRIMARY KEY (id, app_id)
|
||||
);
|
||||
|
||||
CREATE INDEX ix_user_app_secrets_app_id ON user_app_secrets (app_id);
|
||||
Reference in New Issue
Block a user