Added Paralegal & Clerk roles
X-Lovable-Edit-ID: edt-86aab16f-7113-4a88-a887-180d7c71bf34 Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
@@ -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",
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
@@ -73,6 +73,8 @@ interface UserRow {
|
||||
const ROLE_LABEL: Record<AppRole, string> = {
|
||||
admin: "Administrator",
|
||||
attorney: "Attorney",
|
||||
paralegal: "Paralegal",
|
||||
legal_clerk: "Legal Clerk",
|
||||
staff: "Staff",
|
||||
};
|
||||
|
||||
|
||||
@@ -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" },
|
||||
|
||||
@@ -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" },
|
||||
|
||||
@@ -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';
|
||||
Reference in New Issue
Block a user