From 32e8fd7ef72eaf4222a60f34baa8e9775fd67c87 Mon Sep 17 00:00:00 2001
From: zychen5186 <brianchen5197@gmail.com>
Date: Mon, 3 Jun 2024 23:51:38 -0700
Subject: [PATCH] Merge getDomain and GetDomain

Signed-off-by: zychen5186 <brianchen5197@gmail.com>
---
 flyteadmin/pkg/manager/impl/project_manager.go | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/flyteadmin/pkg/manager/impl/project_manager.go b/flyteadmin/pkg/manager/impl/project_manager.go
index 66021993f2e..3a6857e0fee 100644
--- a/flyteadmin/pkg/manager/impl/project_manager.go
+++ b/flyteadmin/pkg/manager/impl/project_manager.go
@@ -42,7 +42,7 @@ func (m *ProjectManager) CreateProject(ctx context.Context, request admin.Projec
 	return &admin.ProjectRegisterResponse{}, nil
 }
 
-func (m *ProjectManager) getDomains() []*admin.Domain {
+func (m *ProjectManager) GetDomains(ctx context.Context, request admin.GetDomainRequest) *admin.Domains {
 	configDomains := m.config.ApplicationConfiguration().GetDomainsConfig()
 	var domains = make([]*admin.Domain, len(*configDomains))
 	for index, configDomain := range *configDomains {
@@ -51,12 +51,8 @@ func (m *ProjectManager) getDomains() []*admin.Domain {
 			Name: configDomain.Name,
 		}
 	}
-	return domains
-}
-
-func (m *ProjectManager) GetDomains(ctx context.Context, request admin.GetDomainRequest) *admin.Domains {
 	return &admin.Domains{
-		Domains: m.getDomains(),
+		Domains: domains,
 	}
 }
 
@@ -93,7 +89,7 @@ func (m *ProjectManager) ListProjects(ctx context.Context, request admin.Project
 	if err != nil {
 		return nil, err
 	}
-	projects := transformers.FromProjectModels(projectModels, m.getDomains())
+	projects := transformers.FromProjectModels(projectModels, m.GetDomains(ctx, admin.GetDomainRequest{}).Domains)
 
 	var token string
 	if len(projects) == int(request.Limit) {
@@ -140,7 +136,7 @@ func (m *ProjectManager) GetProject(ctx context.Context, request admin.ProjectGe
 	if err != nil {
 		return nil, err
 	}
-	projectResponse := transformers.FromProjectModel(projectModel, m.getDomains())
+	projectResponse := transformers.FromProjectModel(projectModel, m.GetDomains(ctx, admin.GetDomainRequest{}).Domains)
 
 	return &projectResponse, nil
 }