🚀 Auto-deploy: GPI atualizado em 03/04/2026 20:24:53
This commit is contained in:
@@ -33,13 +33,18 @@ export const createProject = async (data: ProjectData & { organizationId?: strin
|
||||
|
||||
export const getAllProjects = async (organizationId?: string, isGlobalAdmin?: boolean, status?: string) => {
|
||||
try {
|
||||
const { data: projects, error } = await supabase
|
||||
let query = supabase
|
||||
.from('projects')
|
||||
.select('*');
|
||||
.select('*, painting_schemes(*)');
|
||||
|
||||
if (status) {
|
||||
query = query.eq('status', status);
|
||||
}
|
||||
|
||||
const { data: projects, error } = await query;
|
||||
|
||||
// Se tabela não existir, retorna array vazio
|
||||
if (error) {
|
||||
console.log('Projects table not found, returning empty array');
|
||||
console.log('Error fetching projects:', error);
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -54,7 +59,7 @@ export const getDashboardProjects = async (organizationId?: string) => {
|
||||
try {
|
||||
const { data: projects, error } = await supabase
|
||||
.from('projects')
|
||||
.select('*');
|
||||
.select('*, painting_schemes(*)');
|
||||
|
||||
if (error) return [];
|
||||
return projects || [];
|
||||
@@ -91,7 +96,7 @@ export const archiveProject = async (id: string, organizationId?: string, isGlob
|
||||
export const getProjectById = async (id: string) => {
|
||||
const { data, error } = await supabase
|
||||
.from('projects')
|
||||
.select('*')
|
||||
.select('*, painting_schemes(*)')
|
||||
.eq('id', id)
|
||||
.single();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user