diff --git a/src/integrations/supabase/types.ts b/src/integrations/supabase/types.ts index 100e462..10a7930 100644 --- a/src/integrations/supabase/types.ts +++ b/src/integrations/supabase/types.ts @@ -2595,7 +2595,7 @@ export type Database = { } } Enums: { - app_role: "admin" | "attorney" | "staff" + app_role: "admin" | "attorney" | "staff" | "paralegal" | "legal_clerk" case_status: | "intake" | "active" @@ -2745,7 +2745,7 @@ export type CompositeTypes< export const Constants = { public: { Enums: { - app_role: ["admin", "attorney", "staff"], + app_role: ["admin", "attorney", "staff", "paralegal", "legal_clerk"], case_status: [ "intake", "active", diff --git a/src/lib/auth.tsx b/src/lib/auth.tsx index b49428c..e833eed 100644 --- a/src/lib/auth.tsx +++ b/src/lib/auth.tsx @@ -2,7 +2,7 @@ import { createContext, useContext, useEffect, useState, type ReactNode } from " import type { Session, User } from "@supabase/supabase-js"; import { supabase } from "@/integrations/supabase/client"; -export type AppRole = "admin" | "attorney" | "staff"; +export type AppRole = "admin" | "attorney" | "paralegal" | "legal_clerk" | "staff"; interface AuthState { session: Session | null; diff --git a/src/routes/admin.users.tsx b/src/routes/admin.users.tsx index 62bd671..e866344 100644 --- a/src/routes/admin.users.tsx +++ b/src/routes/admin.users.tsx @@ -73,6 +73,8 @@ interface UserRow { const ROLE_LABEL: Record = { admin: "Administrator", attorney: "Attorney", + paralegal: "Paralegal", + legal_clerk: "Legal Clerk", staff: "Staff", }; diff --git a/supabase/functions/admin-invite-user/index.ts b/supabase/functions/admin-invite-user/index.ts index 80ef7d4..d009905 100644 --- a/supabase/functions/admin-invite-user/index.ts +++ b/supabase/functions/admin-invite-user/index.ts @@ -7,7 +7,7 @@ const corsHeaders = { "Access-Control-Allow-Methods": "POST, OPTIONS", }; -type Role = "admin" | "attorney" | "staff"; +type Role = "admin" | "attorney" | "paralegal" | "legal_clerk" | "staff"; interface InviteBody { email: string; @@ -63,7 +63,7 @@ Deno.serve(async (req) => { headers: { ...corsHeaders, "Content-Type": "application/json" }, }); } - if (!["admin", "attorney", "staff"].includes(body.role)) { + if (!["admin", "attorney", "paralegal", "legal_clerk", "staff"].includes(body.role)) { return new Response(JSON.stringify({ error: "Invalid role" }), { status: 400, headers: { ...corsHeaders, "Content-Type": "application/json" }, diff --git a/supabase/functions/admin-update-role/index.ts b/supabase/functions/admin-update-role/index.ts index 35808b0..7437cb4 100644 --- a/supabase/functions/admin-update-role/index.ts +++ b/supabase/functions/admin-update-role/index.ts @@ -7,7 +7,7 @@ const corsHeaders = { "Access-Control-Allow-Methods": "POST, OPTIONS", }; -type Role = "admin" | "attorney" | "staff"; +type Role = "admin" | "attorney" | "paralegal" | "legal_clerk" | "staff"; Deno.serve(async (req) => { if (req.method === "OPTIONS") return new Response(null, { headers: corsHeaders }); @@ -46,7 +46,7 @@ Deno.serve(async (req) => { } const { user_id, role } = (await req.json()) as { user_id: string; role: Role }; - if (!user_id || !["admin", "attorney", "staff"].includes(role)) { + if (!user_id || !["admin", "attorney", "paralegal", "legal_clerk", "staff"].includes(role)) { return new Response(JSON.stringify({ error: "Invalid input" }), { status: 400, headers: { ...corsHeaders, "Content-Type": "application/json" }, diff --git a/supabase/migrations/20260418011922_232c2125-6e97-45d3-b46f-16b0897c7a85.sql b/supabase/migrations/20260418011922_232c2125-6e97-45d3-b46f-16b0897c7a85.sql new file mode 100644 index 0000000..ec2e13a --- /dev/null +++ b/supabase/migrations/20260418011922_232c2125-6e97-45d3-b46f-16b0897c7a85.sql @@ -0,0 +1,2 @@ +ALTER TYPE public.app_role ADD VALUE IF NOT EXISTS 'paralegal'; +ALTER TYPE public.app_role ADD VALUE IF NOT EXISTS 'legal_clerk'; \ No newline at end of file