Remove tenant service pattern
Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
@@ -25,17 +25,18 @@ import (
|
||||
)
|
||||
|
||||
type FrameworkService struct {
|
||||
svc *TenantService
|
||||
svc *Service
|
||||
}
|
||||
|
||||
func (s FrameworkService) Get(
|
||||
ctx context.Context,
|
||||
scope coredata.Scoper,
|
||||
frameworkID gid.GID,
|
||||
) (*coredata.Framework, error) {
|
||||
framework := &coredata.Framework{}
|
||||
|
||||
err := s.svc.pg.WithConn(ctx, func(ctx context.Context, conn pg.Querier) error {
|
||||
err := framework.LoadByID(ctx, conn, s.svc.scope, frameworkID)
|
||||
err := framework.LoadByID(ctx, conn, scope, frameworkID)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot load framework: %w", err)
|
||||
}
|
||||
@@ -51,6 +52,7 @@ func (s FrameworkService) Get(
|
||||
|
||||
func (s FrameworkService) GenerateLightLogoURL(
|
||||
ctx context.Context,
|
||||
scope coredata.Scoper,
|
||||
frameworkID gid.GID,
|
||||
expiresIn time.Duration,
|
||||
) (*string, error) {
|
||||
@@ -60,7 +62,7 @@ func (s FrameworkService) GenerateLightLogoURL(
|
||||
ctx,
|
||||
func(ctx context.Context, conn pg.Querier) error {
|
||||
framework := &coredata.Framework{}
|
||||
if err := framework.LoadByID(ctx, conn, s.svc.scope, frameworkID); err != nil {
|
||||
if err := framework.LoadByID(ctx, conn, scope, frameworkID); err != nil {
|
||||
return fmt.Errorf("cannot load framework: %w", err)
|
||||
}
|
||||
|
||||
@@ -68,7 +70,7 @@ func (s FrameworkService) GenerateLightLogoURL(
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := file.LoadByID(ctx, conn, s.svc.scope, *framework.LightLogoFileID); err != nil {
|
||||
if err := file.LoadByID(ctx, conn, scope, *framework.LightLogoFileID); err != nil {
|
||||
return fmt.Errorf("cannot load file: %w", err)
|
||||
}
|
||||
|
||||
@@ -93,6 +95,7 @@ func (s FrameworkService) GenerateLightLogoURL(
|
||||
|
||||
func (s FrameworkService) GenerateDarkLogoURL(
|
||||
ctx context.Context,
|
||||
scope coredata.Scoper,
|
||||
frameworkID gid.GID,
|
||||
expiresIn time.Duration,
|
||||
) (*string, error) {
|
||||
@@ -102,7 +105,7 @@ func (s FrameworkService) GenerateDarkLogoURL(
|
||||
ctx,
|
||||
func(ctx context.Context, conn pg.Querier) error {
|
||||
framework := &coredata.Framework{}
|
||||
if err := framework.LoadByID(ctx, conn, s.svc.scope, frameworkID); err != nil {
|
||||
if err := framework.LoadByID(ctx, conn, scope, frameworkID); err != nil {
|
||||
return fmt.Errorf("cannot load framework: %w", err)
|
||||
}
|
||||
|
||||
@@ -110,7 +113,7 @@ func (s FrameworkService) GenerateDarkLogoURL(
|
||||
return nil
|
||||
}
|
||||
|
||||
if err := file.LoadByID(ctx, conn, s.svc.scope, *framework.DarkLogoFileID); err != nil {
|
||||
if err := file.LoadByID(ctx, conn, scope, *framework.DarkLogoFileID); err != nil {
|
||||
return fmt.Errorf("cannot load file: %w", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user