Update types

This commit is contained in:
Arthur Belleville 2025-06-28 14:52:30 +02:00
parent 028c98230e
commit 10dad92a5b
No known key found for this signature in database
8 changed files with 33 additions and 96 deletions

View file

@ -1,7 +1,7 @@
import React from "react";
import { DeleteDevisModalButton } from "@ui/components/devis/DeleteDevisModal";
import { ViewDevisModalButton } from "@ui/components/devis/ViewDevisModal";
import { Database } from "@ui/types/db";
import { Database } from "@ui/types/database.types";
import { Button } from "@ui/ui-library/button";
import { Download } from "lucide-react";

View file

@ -1,4 +1,4 @@
import { Database } from "@ui/types/db";
import { Database } from "@ui/types/database.types";
import { Button } from "@ui/ui-library/button";
import { DialogBody, DialogFooter } from "@ui/ui-library/dialog";

View file

@ -1,5 +1,5 @@
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { Database } from "@ui/types/db";
import { Database } from "@ui/types/database.types";
import { supabase } from "./auth";
import { useSession } from "@ui/contexts/SessionContext";

View file

@ -13,7 +13,7 @@ import {
useUpdateDevis,
} from "@ui/hooks/devis";
import { useState } from "react";
import { Database } from "@ui/types/db";
import { Database } from "@ui/types/database.types";
import { CalendarDate, DateValue } from "@internationalized/date";
import { RowActionMenu } from "@ui/components/RowActionMenu";
import { CustomLoadingOverlay } from "@ui/components/CustomLoadingOverlay";

View file

@ -15,8 +15,7 @@ export default function ChatProvider({
tokenOrProvider: user.streamToken,
userData: {
id: user.id,
// @ts-expect-error - name is not defined in the user type
name: user.name || "",
name: user.name ?? "",
},
});

View file

@ -63,30 +63,48 @@ export type Database = {
}
Relationships: []
}
feedbacks: {
Row: {
created_at: string | null
fd_type: string
id: number
message: string
user_id: string
}
Insert: {
created_at?: string | null
fd_type: string
id?: number
message: string
user_id: string
}
Update: {
created_at?: string | null
fd_type?: string
id?: number
message?: string
user_id?: string
}
Relationships: []
}
profiles: {
Row: {
avatar_url: string | null
email: string | null
full_name: string | null
id: string
updated_at: string | null
website: string | null
name: string | null
}
Insert: {
avatar_url?: string | null
email?: string | null
full_name?: string | null
id: string
updated_at?: string | null
website?: string | null
name?: string | null
}
Update: {
avatar_url?: string | null
email?: string | null
full_name?: string | null
id?: string
updated_at?: string | null
website?: string | null
name?: string | null
}
Relationships: []
}

View file

@ -1,80 +0,0 @@
export type Json =
| string
| number
| boolean
| null
| { [key: string]: Json | undefined }
| Json[];
export type Database = {
public: {
Tables: {
devis: {
Row: {
client_email: string;
created_at: string;
date: string;
due_date: string;
id: string;
items: Json;
notes: string | null;
number: string;
status: Database["public"]["Enums"]["devis_status"];
subtotal: number;
tax: number;
terms: string | null;
total: number;
updated_at: string;
user_id: string;
};
Insert: {
client_email: string;
created_at?: string;
date: string;
due_date: string;
id?: string;
items?: Json;
notes?: string | null;
number: string;
status?: Database["public"]["Enums"]["devis_status"];
subtotal: number;
tax: number;
terms?: string | null;
total: number;
updated_at?: string;
user_id: string;
};
Update: {
client_email?: string;
created_at?: string;
date?: string;
due_date?: string;
id?: string;
items?: Json;
notes?: string | null;
number?: string;
status?: Database["public"]["Enums"]["devis_status"];
subtotal?: number;
tax?: number;
terms?: string | null;
total?: number;
updated_at?: string;
user_id?: string;
};
Relationships: [];
};
};
Views: {
[_ in never]: never;
};
Functions: {
[_ in never]: never;
};
Enums: {
devis_status: "draft" | "sent" | "accepted" | "rejected" | "expired";
};
CompositeTypes: {
[_ in never]: never;
};
};
};

View file

@ -1,4 +1,4 @@
import { Database } from "@ui/types/db";
import { Database } from "@ui/types/database.types";
import jsPDF from "jspdf";
export const calculateTax = (amount: number, taxRate: number) => {