@@ -47,7 +47,7 @@ func (r *CASBackendRepo) List(ctx context.Context, orgID uuid.UUID) ([]*biz.CASB
4747 ctx , span := otelx .Start (ctx , casBackendRepoTracer , "CASBackendRepo.List" )
4848 defer span .End ()
4949
50- backends , err := orgScopedQuery (r .data .DB , orgID ).QueryCasBackends ().WithOrganization ().
50+ backends , err := orgScopedQuery (r .data .DB , orgID ).QueryCasBackends ().
5151 Where (casbackend .DeletedAtIsNil ()).
5252 Order (ent .Desc (casbackend .FieldCreatedAt )).
5353 All (ctx )
@@ -68,7 +68,7 @@ func (r *CASBackendRepo) FindDefaultBackend(ctx context.Context, orgID uuid.UUID
6868 ctx , span := otelx .Start (ctx , casBackendRepoTracer , "CASBackendRepo.FindDefaultBackend" )
6969 defer span .End ()
7070
71- backend , err := orgScopedQuery (r .data .DB , orgID ).QueryCasBackends ().WithOrganization ().
71+ backend , err := orgScopedQuery (r .data .DB , orgID ).QueryCasBackends ().
7272 Where (casbackend .Default (true ), casbackend .DeletedAtIsNil ()).
7373 Only (ctx )
7474 if err != nil && ! ent .IsNotFound (err ) {
@@ -83,7 +83,7 @@ func (r *CASBackendRepo) FindFallbackBackend(ctx context.Context, orgID uuid.UUI
8383 ctx , span := otelx .Start (ctx , casBackendRepoTracer , "CASBackendRepo.FindFallbackBackend" )
8484 defer span .End ()
8585
86- backend , err := orgScopedQuery (r .data .DB , orgID ).QueryCasBackends ().WithOrganization ().
86+ backend , err := orgScopedQuery (r .data .DB , orgID ).QueryCasBackends ().
8787 Where (casbackend .Fallback (true ), casbackend .DeletedAtIsNil ()).
8888 Only (ctx )
8989 if err != nil && ! ent .IsNotFound (err ) {
@@ -98,7 +98,7 @@ func (r *CASBackendRepo) FindInlineBackend(ctx context.Context, orgID uuid.UUID)
9898 ctx , span := otelx .Start (ctx , casBackendRepoTracer , "CASBackendRepo.FindInlineBackend" )
9999 defer span .End ()
100100
101- backend , err := orgScopedQuery (r .data .DB , orgID ).QueryCasBackends ().WithOrganization ().
101+ backend , err := orgScopedQuery (r .data .DB , orgID ).QueryCasBackends ().
102102 Where (casbackend .ProviderEQ (biz .CASBackendInline ), casbackend .DeletedAtIsNil ()).
103103 Only (ctx )
104104 if err != nil && ! ent .IsNotFound (err ) {
@@ -264,7 +264,7 @@ func (r *CASBackendRepo) FindByID(ctx context.Context, id uuid.UUID) (*biz.CASBa
264264 ctx , span := otelx .Start (ctx , casBackendRepoTracer , "CASBackendRepo.FindByID" )
265265 defer span .End ()
266266
267- backend , err := r .data .DB .CASBackend .Query ().WithOrganization ().
267+ backend , err := r .data .DB .CASBackend .Query ().
268268 Where (casbackend .ID (id ), casbackend .DeletedAtIsNil ()).Only (ctx )
269269 if err != nil && ! ent .IsNotFound (err ) {
270270 return nil , err
@@ -281,7 +281,7 @@ func (r *CASBackendRepo) FindByIDInOrg(ctx context.Context, orgID, id uuid.UUID)
281281 ctx , span := otelx .Start (ctx , casBackendRepoTracer , "CASBackendRepo.FindByIDInOrg" )
282282 defer span .End ()
283283
284- backend , err := orgScopedQuery (r .data .DB , orgID ).QueryCasBackends ().WithOrganization ().
284+ backend , err := orgScopedQuery (r .data .DB , orgID ).QueryCasBackends ().
285285 Where (casbackend .ID (id ), casbackend .DeletedAtIsNil ()).Only (ctx )
286286 if err != nil && ! ent .IsNotFound (err ) {
287287 return nil , err
@@ -298,7 +298,6 @@ func (r *CASBackendRepo) FindByNameInOrg(ctx context.Context, orgID uuid.UUID, n
298298
299299 backend , err := orgScopedQuery (r .data .DB , orgID ).
300300 QueryCasBackends ().
301- WithOrganization ().
302301 Where (casbackend .Name (name ), casbackend .DeletedAtIsNil ()).Only (ctx )
303302 if err != nil {
304303 if ent .IsNotFound (err ) {
@@ -352,7 +351,6 @@ func (r *CASBackendRepo) ListBackends(ctx context.Context, defaultsOrFallbacks b
352351 defer span .End ()
353352
354353 query := r .data .DB .CASBackend .Query ().
355- WithOrganization ().
356354 Where (casbackend .DeletedAtIsNil (),
357355 casbackend .ProviderNEQ (biz .CASBackendInline ),
358356 casbackend .HasOrganizationWith (
@@ -406,10 +404,7 @@ func entCASBackendToBiz(backend *ent.CASBackend) *biz.CASBackend {
406404 Limits : limits ,
407405 Fallback : backend .Fallback ,
408406 Managed : backend .Managed ,
409- }
410-
411- if org := backend .Edges .Organization ; org != nil {
412- r .OrganizationID = org .ID
407+ OrganizationID : backend .OrganizationCasBackends ,
413408 }
414409
415410 return r
0 commit comments