klesh commented on code in PR #6001:
URL:
https://github.com/apache/incubator-devlake/pull/6001#discussion_r1314579585
##########
backend/plugins/webhook/api/deployments.go:
##########
@@ -124,12 +125,30 @@ func PostDeploymentCicdTask(input
*plugin.ApiResourceInput) (*plugin.ApiResource
RepoId: request.RepoId,
RepoUrl: request.RepoUrl,
}
- err = db.CreateOrUpdate(deploymentCommit)
+ err = tx.CreateOrUpdate(deploymentCommit)
Review Comment:
Please use `TxHelper` instead
##########
backend/core/models/domainlayer/devops/cicd_deployment_commit.go:
##########
@@ -42,6 +42,24 @@ type CicdDeploymentCommit struct {
PrevSuccessDeploymentCommitId string `gorm:"type:varchar(255)"`
}
-func (CicdDeploymentCommit) TableName() string {
+func (t CicdDeploymentCommit) TableName() string {
Review Comment:
`t` doesn't seem to be used anywhere.
##########
backend/core/models/domainlayer/devops/cicd_deployment_commit.go:
##########
@@ -42,6 +42,24 @@ type CicdDeploymentCommit struct {
PrevSuccessDeploymentCommitId string `gorm:"type:varchar(255)"`
}
-func (CicdDeploymentCommit) TableName() string {
+func (t CicdDeploymentCommit) TableName() string {
return "cicd_deployment_commits"
}
+
+func (t CicdDeploymentCommit) Deployment() *CICDDeployment {
Review Comment:
The naming `Deployment()` looks like it would return the `referencing`
deployment NOT creating a new entity.
Please prefix it with `To` like `ToDeployment`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]