@@ -286,7 +286,8 @@ export async function getProjectsForUser({
286
286
. from ( 'projects' )
287
287
. select ( '*, teams(name)' )
288
288
. eq ( 'organization_id' , organizationId )
289
- . ilike ( 'name' , `%${ query } %` ) ;
289
+ . ilike ( 'name' , `%${ query } %` )
290
+ . is ( 'deleted_at' , null ) ;
290
291
291
292
if ( userRole !== 'admin' || userId !== 'owner' ) {
292
293
// For non-admin users, get their team memberships
@@ -333,7 +334,8 @@ export async function getProjectsListForUser({
333
334
. from ( 'projects' )
334
335
. select ( 'id, name, slug, latest_action_on, created_at, repo_id, latest_drift_output' )
335
336
. eq ( 'organization_id' , organizationId )
336
- . ilike ( 'name' , `%${ query } %` ) ;
337
+ . ilike ( 'name' , `%${ query } %` )
338
+ . is ( 'deleted_at' , null ) ;
337
339
338
340
if ( userRole !== 'admin' || userId !== 'owner' ) {
339
341
// For non-admin users, get their team memberships
@@ -399,7 +401,8 @@ export async function getSlimProjectsForUser({
399
401
let supabaseQuery = supabase
400
402
. from ( 'projects' )
401
403
. select ( 'id,name, slug, latest_action_on, created_at, repo_id' )
402
- . in ( 'id' , projectIds ) ;
404
+ . in ( 'id' , projectIds )
405
+ . is ( 'deleted_at' , null ) ;
403
406
404
407
if ( userRole !== 'admin' || userId !== 'owner' ) {
405
408
// For non-admin users, get their team memberships
@@ -463,7 +466,8 @@ export async function getProjectsIdsListForUser({
463
466
. from ( 'projects' )
464
467
. select ( 'id,name, slug, latest_action_on, created_at, repo_id' )
465
468
. eq ( 'organization_id' , organizationId )
466
- . ilike ( 'name' , `%${ query } %` ) ;
469
+ . ilike ( 'name' , `%${ query } %` )
470
+ . is ( 'deleted_at' , null ) ;
467
471
468
472
if ( userRole !== 'admin' || userId !== 'owner' ) {
469
473
// For non-admin users, get their team memberships
@@ -538,7 +542,8 @@ export async function getProjectsCountForUser({
538
542
. from ( 'projects' )
539
543
. select ( '*' , { count : 'exact' , head : true } )
540
544
. eq ( 'organization_id' , organizationId )
541
- . ilike ( 'name' , `%${ query } %` ) ;
545
+ . ilike ( 'name' , `%${ query } %` )
546
+ . is ( 'deleted_at' , null ) ;
542
547
543
548
if ( userRole . member_role !== 'admin' ) {
544
549
// For non-admin users, get their team memberships
@@ -585,6 +590,7 @@ export const getAllProjectsInOrganization = async ({
585
590
. from ( "projects" )
586
591
. select ( "*" )
587
592
. eq ( "organization_id" , organizationId )
593
+ . is ( 'deleted_at' , null )
588
594
. range ( zeroIndexedPage * limit , ( zeroIndexedPage + 1 ) * limit - 1 ) ;
589
595
590
596
if ( query ) {
@@ -609,6 +615,7 @@ export const getAllProjectIdsInOrganization = async (organizationId: string) =>
609
615
. from ( "projects" )
610
616
. select ( "id" )
611
617
. eq ( "organization_id" , organizationId )
618
+ . is ( 'deleted_at' , null )
612
619
. order ( "created_at" , { ascending : false } ) ;
613
620
614
621
const { data, error } = await supabaseQuery ;
@@ -626,6 +633,7 @@ export const getProjectIdsInOrganization = async (organizationId: string, count:
626
633
const supabaseQuery = supabase
627
634
. from ( "projects" )
628
635
. select ( "id" )
636
+ . is ( 'deleted_at' , null )
629
637
. eq ( "organization_id" , organizationId ) ;
630
638
631
639
const { data, error } = await supabaseQuery ;
@@ -660,6 +668,7 @@ export const getOrganizationLevelProjects = async ({
660
668
. select ( "*" )
661
669
. eq ( "organization_id" , organizationId )
662
670
. is ( 'team_id' , null )
671
+ . is ( 'deleted_at' , null )
663
672
. range ( zeroIndexedPage * limit , ( zeroIndexedPage + 1 ) * limit - 1 ) ;
664
673
665
674
if ( query ) {
@@ -698,6 +707,7 @@ export const getProjects = async ({
698
707
. from ( "projects" )
699
708
. select ( "*" )
700
709
. eq ( "organization_id" , organizationId )
710
+ . is ( 'deleted_at' , null )
701
711
. range ( zeroIndexedPage * limit , ( zeroIndexedPage + 1 ) * limit - 1 ) ;
702
712
703
713
// Add team filter
@@ -742,6 +752,7 @@ export const getAllProjectsListInOrganization = async ({
742
752
. from ( "projects" )
743
753
. select ( "id,name, slug, latest_action_on, created_at, repo_id" )
744
754
. eq ( "organization_id" , organizationId )
755
+ . is ( 'deleted_at' , null )
745
756
. range ( zeroIndexedPage * limit , ( zeroIndexedPage + 1 ) * limit - 1 ) ;
746
757
747
758
if ( query ) {
@@ -793,6 +804,7 @@ export const getProjectsList = async ({
793
804
. from ( "projects" )
794
805
. select ( "id,name, slug, latest_action_on, created_at, repo_id" )
795
806
. eq ( "organization_id" , organizationId )
807
+ . is ( 'deleted_at' , null )
796
808
. range ( zeroIndexedPage * limit , ( zeroIndexedPage + 1 ) * limit - 1 ) ;
797
809
798
810
// Add team filter
@@ -891,6 +903,7 @@ export const getProjectsForUserTotalCount = async ({
891
903
head : true ,
892
904
} )
893
905
. eq ( "organization_id" , organizationId )
906
+ . is ( 'deleted_at' , null )
894
907
. range ( zeroIndexedPage * limit , ( zeroIndexedPage + 1 ) * limit - 1 ) ;
895
908
896
909
if ( query ) {
0 commit comments