Skip to content

Commit 75b4598

Browse files
Merge pull request #289 from SheetMetalConnect/claude/review-pr-280-ui-UUQs4
Review merged PR for incomplete UI changes
2 parents ed84554 + 566fd52 commit 75b4598

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/hooks/useFeatureFlags.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export function useFeatureFlags() {
153153
if (error) throw error;
154154

155155
// Merge with defaults to ensure all flags exist
156-
const storedFlags = (data as any)?.feature_flags as Partial<FeatureFlags> | null;
156+
const storedFlags = data?.feature_flags as Partial<FeatureFlags> | null;
157157
return {
158158
...DEFAULT_FEATURE_FLAGS,
159159
...(storedFlags || {}),
@@ -176,7 +176,7 @@ export function useFeatureFlags() {
176176

177177
const { error } = await supabase
178178
.from('tenants')
179-
.update({ feature_flags: mergedFlags } as any)
179+
.update({ feature_flags: mergedFlags })
180180
.eq('id', tenant.id);
181181

182182
if (error) throw error;

src/integrations/supabase/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3027,6 +3027,7 @@ export type Database = {
30273027
demo_mode_enabled: boolean | null
30283028
factory_closing_time: string | null
30293029
factory_opening_time: string | null
3030+
feature_flags: Json | null
30303031
grace_period_ends_at: string | null
30313032
id: string
30323033
last_parts_reset_date: string | null
@@ -3077,6 +3078,7 @@ export type Database = {
30773078
demo_mode_enabled?: boolean | null
30783079
factory_closing_time?: string | null
30793080
factory_opening_time?: string | null
3081+
feature_flags?: Json | null
30803082
grace_period_ends_at?: string | null
30813083
id?: string
30823084
last_parts_reset_date?: string | null
@@ -3127,6 +3129,7 @@ export type Database = {
31273129
demo_mode_enabled?: boolean | null
31283130
factory_closing_time?: string | null
31293131
factory_opening_time?: string | null
3132+
feature_flags?: Json | null
31303133
grace_period_ends_at?: string | null
31313134
id?: string
31323135
last_parts_reset_date?: string | null
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- Add feature_flags column to tenants table
2+
-- This column stores per-tenant feature flag settings as JSONB
3+
-- Default is empty object, which will fall back to all features enabled in the application code
4+
5+
ALTER TABLE public.tenants
6+
ADD COLUMN IF NOT EXISTS feature_flags JSONB DEFAULT '{}';
7+
8+
-- Add a comment to document the column
9+
COMMENT ON COLUMN public.tenants.feature_flags IS 'JSONB object storing feature flag settings. Keys: analytics, monitoring, shipping, operatorViews, integrations, issues, capacity, assignments. All default to true if not specified.';

0 commit comments

Comments
 (0)