mirror of
https://github.com/jjbrunton/Sauci.git
synced 2026-11-01 18:19:43 +00:00
Add streaks, scheduled releases, and notification settings
- Couple streaks with milestone notifications - Scheduled pack releases with admin UI - Notification preferences screen - Refactored profile settings screens - Partner activity notifications
This commit is contained in:
1 parent
12f312421b
commit
494ed17fe2
82 files changed
+4189
-725
No files matched your search
@@ -1,27 +1,43 @@
|
||||
-- Track user opt-ins for upcoming/coming-soon features
|
||||
|
||||
-- Table to track user interest in upcoming 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)
|
||||
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
|
||||
user_id UUID NOT NULL REFERENCES auth.users(id) ON DELETE CASCADE,
|
||||
feature_name TEXT NOT NULL,
|
||||
created_at TIMESTAMPTZ DEFAULT NOW() NOT NULL,
|
||||
|
||||
-- Ensure a user can only express interest in a feature once
|
||||
UNIQUE(user_id, feature_name)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_feature_interests_user_id ON feature_interests(user_id);
|
||||
-- Index for querying by feature
|
||||
CREATE INDEX idx_feature_interests_feature_name ON feature_interests(feature_name);
|
||||
|
||||
-- Index for querying by user
|
||||
CREATE INDEX idx_feature_interests_user_id ON feature_interests(user_id);
|
||||
|
||||
-- Enable RLS
|
||||
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);
|
||||
|
||||
-- Users can insert their own interest
|
||||
CREATE POLICY "Users can express interest in features"
|
||||
ON feature_interests FOR INSERT
|
||||
WITH CHECK (auth.uid() = user_id);
|
||||
ON feature_interests
|
||||
FOR INSERT
|
||||
TO authenticated
|
||||
WITH CHECK (auth.uid() = user_id);
|
||||
|
||||
-- Users can view their own interests
|
||||
CREATE POLICY "Users can view their own interests"
|
||||
ON feature_interests
|
||||
FOR SELECT
|
||||
TO authenticated
|
||||
USING (auth.uid() = user_id);
|
||||
|
||||
-- Users can delete their own interests
|
||||
CREATE POLICY "Users can remove their interest"
|
||||
ON feature_interests FOR DELETE
|
||||
USING (auth.uid() = user_id);
|
||||
ON feature_interests
|
||||
FOR DELETE
|
||||
TO authenticated
|
||||
USING (auth.uid() = user_id);
|
||||
|
||||
-- Grant service role full access for admin queries
|
||||
GRANT ALL ON feature_interests TO service_role;;
|
||||
Reference in new issue
Block a user