Skip to content

Commit e8ba7d3

Browse files
enhancement: changes in core for multiple git-platform support
1 parent 5885c56 commit e8ba7d3

File tree

45 files changed

+325
-359
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+325
-359
lines changed

app/protobufs/project.proto

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,13 @@ service ProjectService {
99
}
1010

1111
message GenerateCodeRequest {
12-
string json = 1;
13-
string userName = 2;
14-
string projectName = 3;
15-
string repositoryName = 4;
16-
string gitRepositoryIsPublic = 5;
17-
string gitRepositoryBranch = 6;
18-
string gitPlatformName = 7;
19-
string gitPlatformUrl = 8;
20-
string gitPlatformUserName = 9;
21-
string gitPlatformPassword = 10;
22-
string gitPlatformEmail = 11 ;
23-
string metadata = 12;
12+
string projectName = 1;
13+
string projectJson = 2;
14+
string gitRepositoryName = 3;
15+
string gitPlatformName = 4;
16+
string gitPlatformURL = 5;
17+
string gitPlatformUserName = 6;
18+
string projectMetadata = 7;
2419
}
2520

2621
message GenerateCodeResponse{

app/src/models/code.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,13 @@ export interface Project {
114114
projectName: string;
115115
userName: string;
116116
json: string;
117-
repositoryName: string;
117+
gitRepositoryName: string;
118+
gitRepositoryIsPublic: boolean;
119+
gitRepositoryBranch: string;
120+
gitPlatformName: string;
121+
gitPlatformURL: string;
122+
gitPlatformUserName: string;
118123
metadata: string;
119-
repositoryIsPublic: boolean;
120-
repositoryBranch: string;
121-
platformName: string;
122-
platformUrl: string;
123-
platformUserName: string;
124-
platformPersonalAccessToken: string;
125-
platformEmail: string;
126124
}
127125

128126
export interface GenerateCodeRequest {

app/src/routes/codeOperations.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,13 @@ codeOperationsRouter.post('/generate', requireEmailMiddleware, async (request, r
111111
projectName: projectEntity.display_name,
112112
userName: projectEntity.git_platform_user_name,
113113
json: projectEntity.json,
114-
repositoryName: projectEntity.repository_name,
114+
gitRepositoryName: projectEntity.repository_name,
115115
metadata: projectEntity.metadata as string,
116-
repositoryIsPublic: projectEntity.is_repository_public,
117-
repositoryBranch: projectEntity.repository_branch,
118-
platformName: projectEntity.git_platform_name,
119-
platformUrl: gitPlatformEntity.url,
120-
platformUserName: projectEntity.git_platform_user_name,
121-
platformPersonalAccessToken: gitPlatformEntity.personal_access_token,
122-
platformEmail: projectEntity.owner_email,
116+
gitRepositoryIsPublic: projectEntity.is_repository_public,
117+
gitRepositoryBranch: projectEntity.repository_branch,
118+
gitPlatformName: projectEntity.git_platform_name,
119+
gitPlatformURL: gitPlatformEntity.url,
120+
gitPlatformUserName: projectEntity.git_platform_user_name,
123121
};
124122

125123
// call to grpc server to generate the project

core/api/v1/project.proto

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,13 @@ service ProjectService {
99
}
1010

1111
message GenerateCodeRequest {
12-
string json = 1;
13-
string userName = 2;
14-
string projectName = 3;
15-
string repositoryName = 4;
16-
string gitRepositoryIsPublic = 5;
17-
string gitRepositoryBranch = 6;
18-
string gitPlatformName = 7;
19-
string gitPlatformUrl = 8;
20-
string gitPlatformUserName = 9;
21-
string gitPlatformPassword = 10;
22-
string gitPlatformEmail = 11 ;
23-
string metadata = 12;
12+
string projectName = 1;
13+
string projectJson = 2;
14+
string gitRepositoryName = 3;
15+
string gitPlatformName = 4;
16+
string gitPlatformURL = 5;
17+
string gitPlatformUserName = 6;
18+
string projectMetadata = 7;
2419
}
2520

2621
message GenerateCodeResponse{

core/gen/api/v1/project.pb.go

Lines changed: 32 additions & 84 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/internal/converter/grpc/converter.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,21 @@ import (
99

1010
// GetProject converts *project.GenerateCodeRequest to *core.Project
1111
func GetProject(input *project.GenerateCodeRequest) (*core.Project, error) {
12-
compageJSON, err := converter.GetCompageJSON(input.Json)
12+
compageJSON, err := converter.GetCompageJSON(input.ProjectJson)
1313
if err != nil {
1414
return nil, err
1515
}
1616

1717
return &core.Project{
18-
CompageJSON: compageJSON,
19-
Name: input.ProjectName,
20-
RepositoryName: input.RepositoryName,
21-
UserName: input.UserName,
22-
Metadata: converter.GetMetadata(input.Metadata),
18+
CompageJSON: compageJSON,
19+
Name: input.ProjectName,
20+
GitRepositoryName: input.GitRepositoryName,
21+
GitPlatformUserName: input.GitPlatformUserName,
22+
GitPlatformURL: input.GitPlatformURL,
23+
Metadata: converter.GetMetadata(input.ProjectMetadata),
2324
ModificationDetails: core.ModificationDetails{
24-
CreatedBy: input.UserName,
25-
UpdatedBy: input.UserName,
25+
CreatedBy: input.GitPlatformUserName,
26+
UpdatedBy: input.GitPlatformUserName,
2627
CreatedAt: time.Now(),
2728
UpdatedAt: time.Now(),
2829
},

core/internal/core/models.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,14 @@ type ModificationDetails struct {
1717
// Project is top level struct depicting the monorepo and resembling to github repository.
1818
// It has a single compage.json and can have multiple nodes and edges (projects and connections) internally.
1919
type Project struct {
20-
Name string `json:"name"`
21-
RepositoryName string `json:"repositoryName"`
22-
UserName string `json:"userName"`
23-
CompageJSON *CompageJSON `json:"compageJSON"`
24-
Metadata map[string]interface{} `json:"metadata"`
20+
Name string `json:"name"`
21+
CompageJSON *CompageJSON `json:"compageJSON"`
22+
GitRepositoryName string `json:"gitRepositoryName"`
23+
GitRepositoryURL string `json:"gitRepositoryURL"`
24+
GitPlatformName string `json:"gitPlatformName"`
25+
GitPlatformURL string `json:"gitPlatformURL"`
26+
GitPlatformUserName string `json:"gitPlatformUserName"`
27+
Metadata map[string]interface{} `json:"metadata"`
2528
ModificationDetails
2629
}
2730

core/internal/integrations/deepsource/copier.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,25 @@ const TomlFile = ".deepsource.toml.tmpl"
1111
// Copier integrations specific copier
1212
type Copier struct {
1313
ProjectDirectoryName string
14-
RepositoryName string
14+
GitRepositoryName string
1515
TemplatesRootPath string
1616
Data map[string]interface{}
1717
}
1818

1919
func NewCopier(project *core.Project) *Copier {
2020
// retrieve project named directory
21-
//userName, repositoryName, projectDirectoryName, templatesRootPath string
21+
//gitPlatformUserName, gitRepositoryName, projectDirectoryName, templatesRootPath string
2222
// populate map to replace templates
2323
data := map[string]interface{}{
24-
"RepositoryName": project.RepositoryName,
25-
"UserName": project.UserName,
24+
"GitRepositoryName": project.GitRepositoryName,
25+
"GitPlatformUserName": project.GitPlatformUserName,
2626
}
2727

2828
return &Copier{
2929
// TODO change this path to constant. Add language specific analysers in a generic way later.
3030
TemplatesRootPath: utils.GetProjectRootPath("templates/common-templates"),
3131
ProjectDirectoryName: utils.GetProjectDirectoryName(project.Name),
32-
RepositoryName: project.RepositoryName,
32+
GitRepositoryName: project.GitRepositoryName,
3333
Data: data,
3434
}
3535
}

core/internal/integrations/readme/copier.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,25 @@ const File = "README.md.tmpl"
1111
// Copier integrations specific copier
1212
type Copier struct {
1313
ProjectDirectoryName string
14-
RepositoryName string
14+
GitRepositoryName string
1515
TemplatesRootPath string
1616
Data map[string]interface{}
1717
}
1818

1919
func NewCopier(project *core.Project) *Copier {
2020
// retrieve project named directory
21-
//userName, repositoryName, projectDirectoryName, templatesRootPath string
21+
//gitPlatformUserName, gitRepositoryName, projectDirectoryName, templatesRootPath string
2222
// populate map to replace templates
2323
data := map[string]interface{}{
24-
"RepositoryName": project.RepositoryName,
25-
"UserName": project.UserName,
24+
"GitRepositoryName": project.GitRepositoryName,
25+
"GitPlatformUserName": project.GitPlatformUserName,
2626
}
2727

2828
return &Copier{
2929
// TODO change this path to constant. Add language specific analysers in a generic way later.
3030
TemplatesRootPath: utils.GetProjectRootPath("templates/common-templates"),
3131
ProjectDirectoryName: utils.GetProjectDirectoryName(project.Name),
32-
RepositoryName: project.RepositoryName,
32+
GitRepositoryName: project.GitRepositoryName,
3333
Data: data,
3434
}
3535
}

0 commit comments

Comments
 (0)