mirror of
https://github.com/jjbrunton/Sauci.git
synced 2026-10-31 18:19:43 +00:00
Add feature opt-ins, dashboard view, and tests
Introduce feature_interests schema + realtime publication and surface opt-in trends in the admin dashboard. Add Jest test infrastructure/coverage for the mobile app and update push-all to run mobile checks before pushing. Co-authored-by: Claude Code <claude@anthropic.com>
This commit is contained in:
1 parent
1452519c76
commit
f7aa6ed8dd
29 files changed
+5207
-68
No files matched your search
@@ -0,0 +1,27 @@
|
||||
-- Track user opt-ins for upcoming/coming-soon features
|
||||
|
||||
CREATE TABLE feature_interests (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
user_id UUID NOT NULL REFERENCES auth.users(id) ON DELETE CASCADE,
|
||||
feature_name TEXT NOT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
UNIQUE (user_id, feature_name)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_feature_interests_user_id ON feature_interests(user_id);
|
||||
CREATE INDEX idx_feature_interests_feature_name ON feature_interests(feature_name);
|
||||
|
||||
ALTER TABLE feature_interests ENABLE ROW LEVEL SECURITY;
|
||||
|
||||
CREATE POLICY "Users can view their own interests"
|
||||
ON feature_interests FOR SELECT
|
||||
USING (auth.uid() = user_id);
|
||||
|
||||
CREATE POLICY "Users can express interest in features"
|
||||
ON feature_interests FOR INSERT
|
||||
WITH CHECK (auth.uid() = user_id);
|
||||
|
||||
CREATE POLICY "Users can remove their interest"
|
||||
ON feature_interests FOR DELETE
|
||||
USING (auth.uid() = user_id);
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
-- Allow admins to view all feature interest opt-ins
|
||||
|
||||
CREATE POLICY "Admins with view_users permission can view all feature interests"
|
||||
ON feature_interests FOR SELECT
|
||||
USING (has_permission('view_users'));
|
||||
@@ -0,0 +1,14 @@
|
||||
-- Enable realtime updates for feature interest opt-ins
|
||||
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_publication_tables
|
||||
WHERE pubname = 'supabase_realtime'
|
||||
AND schemaname = 'public'
|
||||
AND tablename = 'feature_interests'
|
||||
) THEN
|
||||
ALTER PUBLICATION supabase_realtime ADD TABLE feature_interests;
|
||||
END IF;
|
||||
END $$;
|
||||
Reference in new issue
Block a user